diff --git a/src/components/Dashboard/Wrappers/Category/Category.tsx b/src/components/Dashboard/Wrappers/Category/Category.tsx index 9034a2e1a..3def31f10 100644 --- a/src/components/Dashboard/Wrappers/Category/Category.tsx +++ b/src/components/Dashboard/Wrappers/Category/Category.tsx @@ -1,6 +1,8 @@ -import { Group, Title } from '@mantine/core'; +import { Accordion, Title } from '@mantine/core'; +import { useLocalStorage } from '@mantine/hooks'; +import { useConfigContext } from '../../../../config/provider'; import { CategoryType } from '../../../../types/category'; -import { HomarrCardWrapper } from '../../Tiles/HomarrCardWrapper'; +import { useCardStyles } from '../../../layout/useCardStyles'; import { useEditModeStore } from '../../Views/useEditModeStore'; import { useGridstack } from '../gridstack/use-gridstack'; import { WrapperContent } from '../WrapperContent'; @@ -13,20 +15,47 @@ interface DashboardCategoryProps { export const DashboardCategory = ({ category }: DashboardCategoryProps) => { const { refs, apps, widgets } = useGridstack('category', category.id); const isEditMode = useEditModeStore((x) => x.enabled); + const { classes: cardClasses } = useCardStyles(true); + const { config } = useConfigContext(); + + const categoryList = config?.categories.map((x) => x.name) ?? []; + const [toggledCategories, setToggledCategories] = useLocalStorage({ + key: `${config?.configProperties.name}-app-shelf-toggled`, + // This is a bit of a hack to toggle the categories on the first load, return a string[] of the categories + defaultValue: categoryList, + }); return ( - - - {category.name} - {isEditMode ? : null} - -
- -
-
+ { + // Cancel if edit mode is on + if (isEditMode) return; + setToggledCategories([...state]); + }} + > + + }> + {category.name} + + +
+ +
+
+
+
); }; diff --git a/src/components/Dashboard/Wrappers/Category/CategoryEditMenu.tsx b/src/components/Dashboard/Wrappers/Category/CategoryEditMenu.tsx index 24c89bc8f..70b1ed85c 100644 --- a/src/components/Dashboard/Wrappers/Category/CategoryEditMenu.tsx +++ b/src/components/Dashboard/Wrappers/Category/CategoryEditMenu.tsx @@ -22,7 +22,7 @@ export const CategoryEditMenu = ({ category }: CategoryEditMenuProps) => { useCategoryActions(configName, category); return ( - +