diff --git a/public/locales/en/layout/screen-sizes.json b/public/locales/en/layout/screen-sizes.json new file mode 100644 index 000000000..cb0b0a5d3 --- /dev/null +++ b/public/locales/en/layout/screen-sizes.json @@ -0,0 +1,11 @@ +{ + "popover": { + "title": "Configuring for screen size \"{{size}}\"", + "description": "You are editing the size for your current screen" + }, + "sizes": { + "small": "small", + "medium": "medium", + "large": "large" + } +} \ No newline at end of file diff --git a/public/locales/en/layout/tools.json b/public/locales/en/layout/tools.json deleted file mode 100644 index 4224b621e..000000000 --- a/public/locales/en/layout/tools.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "fallback": { - "title": "You currently do not have any tools" - }, - "iconPicker": { - "textInputPlaceholder": "Search for icons...", - "searchLimitationTitle": "Search is limited to {{max}} icons", - "searchLimitationMessage": "To keep things snappy and fast, the search is limited to {{max}} icons. Use the search box to find more icons" - } -} \ No newline at end of file diff --git a/src/components/Dashboard/Views/EditView.tsx b/src/components/Dashboard/Views/EditView.tsx index 11b387d81..5812f0715 100644 --- a/src/components/Dashboard/Views/EditView.tsx +++ b/src/components/Dashboard/Views/EditView.tsx @@ -1,3 +1,40 @@ +import { ActionIcon, Affix, Group, Paper, Progress, Stack, Text } from '@mantine/core'; +import { IconQuestionMark } from '@tabler/icons'; +import { useTranslation } from 'next-i18next'; +import { useNamedWrapperColumnCount, useWrapperColumnCount } from '../Wrappers/gridstack/store'; import { DashboardView } from './DashboardView'; -export const DashboardEditView = () => ; +export const DashboardEditView = () => { + const wrapperColumnCount = useWrapperColumnCount(); + const namedWrapperColumnCount = useNamedWrapperColumnCount(); + const widthInTotal = ((wrapperColumnCount ?? 0) / 12) * 100; + + const { t } = useTranslation('layout/screen-sizes'); + + const translatedSize = t(`sizes.${namedWrapperColumnCount}`); + + return ( + <> + + + + + + {t('popover.title', { size: translatedSize })} + + + {t('popover.description')} + + + + + + + + + + + + + ); +}; diff --git a/src/components/Dashboard/Wrappers/gridstack/store.tsx b/src/components/Dashboard/Wrappers/gridstack/store.tsx index 881c0ee39..6df8c2f75 100644 --- a/src/components/Dashboard/Wrappers/gridstack/store.tsx +++ b/src/components/Dashboard/Wrappers/gridstack/store.tsx @@ -14,16 +14,29 @@ interface GridstackStoreType { setMainAreaWidth: (width: number) => void; } -export const useWrapperColumnCount = () => { +export const useNamedWrapperColumnCount = (): 'small' | 'medium' | 'large' | null => { const mainAreaWidth = useGridstackStore((x) => x.mainAreaWidth); const { sm, xl } = useMantineTheme().breakpoints; if (!mainAreaWidth) return null; - if (mainAreaWidth >= xl) return 12; + if (mainAreaWidth >= xl) return 'large'; - if (mainAreaWidth >= sm) return 6; + if (mainAreaWidth >= sm) return 'medium'; - return 3; + return 'small'; +}; + +export const useWrapperColumnCount = () => { + switch (useNamedWrapperColumnCount()) { + case 'large': + return 12; + case 'medium': + return 6; + case 'small': + return 3; + default: + return null; + } }; function getCurrentShapeSize(size: number) { diff --git a/src/tools/translation-namespaces.ts b/src/tools/translation-namespaces.ts index facb3cbd4..bf3e1d03e 100644 --- a/src/tools/translation-namespaces.ts +++ b/src/tools/translation-namespaces.ts @@ -7,6 +7,7 @@ export const dashboardNamespaces = [ 'layout/modals/about', 'layout/header/actions/toggle-edit-mode', 'layout/mobile/drawer', + 'layout/screen-sizes', 'settings/common', 'settings/general/theme-selector', 'settings/general/config-changer',