refetch backgrounds

This commit is contained in:
Georgi Gardev
2023-11-18 18:06:08 +02:00
parent 867dc98693
commit 2b33a70cc1
2 changed files with 27 additions and 19 deletions
+2
View File
@@ -1,4 +1,5 @@
import { createTagOrder } from '~/api/get-apps';
import { Settings } from '../widgets/Settings';
import style from './Sidebar.module.css';
type SidebarProps = {
@@ -22,6 +23,7 @@ export function Sidebar(props: SidebarProps) {
</li>
))}
</ul>
<Settings className={style.Settings} />
</div>
);
}
+25 -19
View File
@@ -1,25 +1,29 @@
import {
Modal,
ModalOverlay,
ModalContent,
ModalCloseButton,
ModalHeader,
ModalBody,
Checkbox,
ModalFooter,
Button,
Checkbox,
Flex,
Modal,
ModalBody,
ModalCloseButton,
ModalContent,
ModalFooter,
ModalHeader,
ModalOverlay,
createDisclosure,
} from '@hope-ui/solid';
import { HiSolidCog } from 'solid-icons/hi';
import { HiOutlineTrash, HiSolidCog } from 'solid-icons/hi';
import { useSettings } from '~/state/SettingsProvider';
export function Settings() {
type SettingsProps = {
className?: string;
};
export function Settings(props: SettingsProps) {
const { appSettings, setAppSettings } = useSettings();
const { isOpen, onOpen, onClose } = createDisclosure();
return (
<>
<div class={props.className}>
<HiSolidCog onClick={onOpen} size={24} />
<Modal opened={isOpen()} onClose={onClose}>
@@ -37,14 +41,16 @@ export function Settings() {
>
Show locations
</Checkbox>
<Checkbox
checked={appSettings.viewAsTable}
onChange={(e) =>
setAppSettings((prev) => ({ ...prev, viewAsTable: (e.target as any).checked }))
}
<a
style={{ display: 'flex', 'align-items': 'center', gap: '8px', cursor: 'pointer' }}
onClick={() => {
localStorage.removeItem('start-page-background');
window.location.reload();
}}
>
Table View
</Checkbox>
<HiOutlineTrash size={16} />
Reload background
</a>
</Flex>
</ModalBody>
<ModalFooter>
@@ -52,6 +58,6 @@ export function Settings() {
</ModalFooter>
</ModalContent>
</Modal>
</>
</div>
);
}