mirror of
https://github.com/ajnart/homarr.git
synced 2025-11-10 23:45:48 +01:00
🩹 Add default values for the categories to be opened by default
This commit is contained in:
@@ -21,10 +21,12 @@ import { DownloadsModule } from '../modules';
|
|||||||
const AppShelf = (props: any) => {
|
const AppShelf = (props: any) => {
|
||||||
const [toggledCategories, settoggledCategories] = useLocalStorage({
|
const [toggledCategories, settoggledCategories] = useLocalStorage({
|
||||||
key: 'app-shelf-toggled',
|
key: 'app-shelf-toggled',
|
||||||
defaultValue: {},
|
// This is a bit of a hack to get the 5 first categories to be toggled on by default
|
||||||
|
defaultValue: { 0: true, 1: true, 2: true, 3: true, 4: true } as Record<string, boolean>,
|
||||||
});
|
});
|
||||||
const [activeId, setActiveId] = useState(null);
|
const [activeId, setActiveId] = useState(null);
|
||||||
const { config, setConfig } = useConfig();
|
const { config, setConfig } = useConfig();
|
||||||
|
|
||||||
const sensors = useSensors(
|
const sensors = useSensors(
|
||||||
useSensor(TouchSensor, {
|
useSensor(TouchSensor, {
|
||||||
activationConstraint: {
|
activationConstraint: {
|
||||||
@@ -123,10 +125,15 @@ const AppShelf = (props: any) => {
|
|||||||
order={2}
|
order={2}
|
||||||
iconPosition="right"
|
iconPosition="right"
|
||||||
multiple
|
multiple
|
||||||
|
styles={{
|
||||||
|
item: {
|
||||||
|
borderRadius: '20px',
|
||||||
|
},
|
||||||
|
}}
|
||||||
initialState={toggledCategories}
|
initialState={toggledCategories}
|
||||||
onChange={(idx) => settoggledCategories(idx)}
|
onChange={(idx) => settoggledCategories(idx)}
|
||||||
>
|
>
|
||||||
{categoryList.map((category) => (
|
{categoryList.map((category, idx) => (
|
||||||
<Accordion.Item label={category}>{item(category)}</Accordion.Item>
|
<Accordion.Item label={category}>{item(category)}</Accordion.Item>
|
||||||
))}
|
))}
|
||||||
{/* Return the item for all services without category */}
|
{/* Return the item for all services without category */}
|
||||||
|
|||||||
Reference in New Issue
Block a user