2023-01-11 20:37:46 +01:00
|
|
|
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';
|
2022-12-04 19:10:07 +01:00
|
|
|
import { DashboardView } from './DashboardView';
|
2022-12-04 17:36:30 +01:00
|
|
|
|
2023-01-11 20:37:46 +01:00
|
|
|
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 (
|
|
|
|
|
<>
|
|
|
|
|
<Affix position={{ bottom: 20, right: 20 }} style={{ width: 250 }} withinPortal>
|
|
|
|
|
<Paper p="sm" withBorder>
|
|
|
|
|
<Group position="apart" align="start">
|
|
|
|
|
<Stack spacing={0} mb="sm" style={{ maxWidth: 175 }}>
|
|
|
|
|
<Text size="xs" weight="bold">
|
|
|
|
|
{t('popover.title', { size: translatedSize })}
|
|
|
|
|
</Text>
|
|
|
|
|
<Text size="xs" color="dimmed">
|
|
|
|
|
{t('popover.description')}
|
|
|
|
|
</Text>
|
|
|
|
|
</Stack>
|
|
|
|
|
|
2023-01-13 00:04:13 +01:00
|
|
|
<ActionIcon
|
|
|
|
|
size="sm"
|
|
|
|
|
component="a"
|
|
|
|
|
href="https://homarr.dev/docs/customizations/layout"
|
|
|
|
|
target="_blank"
|
|
|
|
|
>
|
2023-01-11 20:37:46 +01:00
|
|
|
<IconQuestionMark size={16} />
|
|
|
|
|
</ActionIcon>
|
|
|
|
|
</Group>
|
|
|
|
|
<Progress size="xl" value={widthInTotal} label={translatedSize} />
|
|
|
|
|
</Paper>
|
|
|
|
|
</Affix>
|
|
|
|
|
<DashboardView />
|
|
|
|
|
</>
|
|
|
|
|
);
|
|
|
|
|
};
|