diff --git a/src/components/Dashboard/Dashboard.tsx b/src/components/Dashboard/Dashboard.tsx
index a05a1ffeb..7ec984c36 100644
--- a/src/components/Dashboard/Dashboard.tsx
+++ b/src/components/Dashboard/Dashboard.tsx
@@ -11,14 +11,8 @@ export const Dashboard = () => {
return (
<>
{/* The following elemens are splitted because gridstack doesn't reinitialize them when using same item. */}
- {isEditMode ? (
- <>
-
-
- >
- ) : (
-
- )}
+ {isEditMode ? : }
+
>
);
};
diff --git a/src/components/Dashboard/Mobile/Ribbon/MobileRibbon.tsx b/src/components/Dashboard/Mobile/Ribbon/MobileRibbon.tsx
index 8993e3eba..92d905198 100644
--- a/src/components/Dashboard/Mobile/Ribbon/MobileRibbon.tsx
+++ b/src/components/Dashboard/Mobile/Ribbon/MobileRibbon.tsx
@@ -1,36 +1,68 @@
-import { ActionIcon, createStyles, useMantineTheme } from '@mantine/core';
-import { useMediaQuery } from '@mantine/hooks';
+import { ActionIcon, createStyles } from '@mantine/core';
+import { useDisclosure } from '@mantine/hooks';
import { IconChevronLeft, IconChevronRight } from '@tabler/icons';
+import { useConfigContext } from '../../../../config/provider';
+import { useScreenLargerThan } from '../../../../tools/hooks/useScreenLargerThan';
+import { MobileRibbonSidebarDrawer } from './MobileRibbonSidebarDrawer';
export const MobileRibbons = () => {
- const theme = useMantineTheme();
const { classes, cx } = useStyles();
+ const { config } = useConfigContext();
+ const [openedRight, rightSidebar] = useDisclosure(false);
+ const [openedLeft, leftSidebar] = useDisclosure(false);
+ const screenLargerThanMd = useScreenLargerThan('md');
- const screenSmallerThanSm = useMediaQuery(`(min-width: ${theme.breakpoints.sm}px)`);
-
- if (screenSmallerThanSm) {
+ if (screenLargerThanMd || !config) {
return <>>;
}
+ const layoutSettings = config.settings.customization.layout;
+
return (
-
-
-
+ {layoutSettings.enabledLeftSidebar ? (
+ <>
+
+
+
+
+ >
+ ) : null}
-
-
-
+ {layoutSettings.enabledRightSidebar ? (
+ <>
+
+
+
+
+ >
+ ) : null}
);
};
const useStyles = createStyles(() => ({
root: {
- position: 'absolute',
+ position: 'fixed',
top: 0,
left: 0,
- width: '100vw',
+ width: '100%',
height: '100%',
display: 'flex',
alignItems: 'center',
diff --git a/src/components/Dashboard/Mobile/Ribbon/MobileRibbonSidebarDrawer.tsx b/src/components/Dashboard/Mobile/Ribbon/MobileRibbonSidebarDrawer.tsx
new file mode 100644
index 000000000..ccf8e8e7b
--- /dev/null
+++ b/src/components/Dashboard/Mobile/Ribbon/MobileRibbonSidebarDrawer.tsx
@@ -0,0 +1,27 @@
+import { Drawer, Title } from '@mantine/core';
+import { DashboardSidebar } from '../../Wrappers/Sidebar/Sidebar';
+
+interface MobileRibbonSidebarDrawerProps {
+ onClose: () => void;
+ opened: boolean;
+ location: 'left' | 'right';
+}
+
+export const MobileRibbonSidebarDrawer = ({
+ location,
+ ...props
+}: MobileRibbonSidebarDrawerProps) => {
+ return (
+ {location} sidebar}
+ style={{
+ display: 'flex',
+ justifyContent: 'center',
+ }}
+ {...props}
+ >
+
+
+ );
+};
diff --git a/src/components/Dashboard/Views/DashboardView.tsx b/src/components/Dashboard/Views/DashboardView.tsx
index 885ca7245..9cb6342ac 100644
--- a/src/components/Dashboard/Views/DashboardView.tsx
+++ b/src/components/Dashboard/Views/DashboardView.tsx
@@ -1,6 +1,7 @@
import { Group, Stack } from '@mantine/core';
import { useMemo } from 'react';
import { useConfigContext } from '../../../config/provider';
+import { useScreenLargerThan } from '../../../tools/hooks/useScreenLargerThan';
import { CategoryType } from '../../../types/category';
import { WrapperType } from '../../../types/wrapper';
import { DashboardCategory } from '../Wrappers/Category/Category';
@@ -9,11 +10,14 @@ import { DashboardWrapper } from '../Wrappers/Wrapper/Wrapper';
export const DashboardView = () => {
const wrappers = useWrapperItems();
- const clockModule = useConfigContext().config?.integrations.clock;
+ const layoutSettings = useConfigContext()?.config?.settings.customization.layout;
+ const showSidebars = useScreenLargerThan('md');
return (
-
+ {layoutSettings?.enabledLeftSidebar && showSidebars ? (
+
+ ) : null}
{wrappers.map((item) =>
item.type === 'category' ? (
@@ -23,7 +27,9 @@ export const DashboardView = () => {
)
)}
-
+ {layoutSettings?.enabledRightSidebar && showSidebars ? (
+
+ ) : null}
);
};