2022-06-28 11:06:45 +02:00
|
|
|
import { ActionIcon, Title, Tooltip, Drawer, Tabs, ScrollArea } from '@mantine/core';
|
2022-06-07 08:21:03 +02:00
|
|
|
import { useHotkeys } from '@mantine/hooks';
|
2022-05-18 22:08:09 +02:00
|
|
|
import { useState } from 'react';
|
2022-06-07 08:21:03 +02:00
|
|
|
import { IconSettings } from '@tabler/icons';
|
2022-08-22 09:50:54 +02:00
|
|
|
import { useTranslation } from 'next-i18next';
|
2022-08-18 21:46:46 +02:00
|
|
|
|
2022-12-04 17:36:30 +01:00
|
|
|
import CustomizationSettings from './CustomizationSettings';
|
2022-06-07 08:21:03 +02:00
|
|
|
import CommonSettings from './CommonSettings';
|
2022-06-28 11:06:45 +02:00
|
|
|
import Credits from './Credits';
|
2022-04-27 03:12:17 +02:00
|
|
|
|
2022-12-04 17:36:30 +01:00
|
|
|
function SettingsMenu() {
|
2022-08-22 09:50:54 +02:00
|
|
|
const { t } = useTranslation('settings/common');
|
|
|
|
|
|
2022-04-27 03:12:17 +02:00
|
|
|
return (
|
2022-12-04 17:36:30 +01:00
|
|
|
<Tabs defaultValue="common">
|
2022-07-26 00:51:55 +02:00
|
|
|
<Tabs.List grow>
|
2022-12-04 17:36:30 +01:00
|
|
|
<Tabs.Tab value="common">{t('tabs.common')}</Tabs.Tab>
|
|
|
|
|
<Tabs.Tab value="customization">{t('tabs.customizations')}</Tabs.Tab>
|
2022-07-26 00:51:55 +02:00
|
|
|
</Tabs.List>
|
2022-12-04 17:36:30 +01:00
|
|
|
<Tabs.Panel data-autofocus value="common">
|
2022-06-28 11:06:45 +02:00
|
|
|
<ScrollArea style={{ height: '78vh' }} offsetScrollbars>
|
|
|
|
|
<CommonSettings />
|
|
|
|
|
</ScrollArea>
|
2022-07-26 00:51:55 +02:00
|
|
|
</Tabs.Panel>
|
2022-12-04 17:36:30 +01:00
|
|
|
<Tabs.Panel value="customization">
|
2022-06-28 11:06:45 +02:00
|
|
|
<ScrollArea style={{ height: '78vh' }} offsetScrollbars>
|
2022-12-04 17:36:30 +01:00
|
|
|
<CustomizationSettings />
|
2022-06-28 11:06:45 +02:00
|
|
|
</ScrollArea>
|
2022-07-26 00:51:55 +02:00
|
|
|
</Tabs.Panel>
|
2022-06-07 00:07:56 +00:00
|
|
|
</Tabs>
|
2022-04-27 03:12:17 +02:00
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export function SettingsMenuButton(props: any) {
|
2022-05-24 23:02:27 +02:00
|
|
|
useHotkeys([['ctrl+L', () => setOpened(!opened)]]);
|
2022-08-22 09:50:54 +02:00
|
|
|
const { t } = useTranslation('settings/common');
|
2022-05-24 23:02:27 +02:00
|
|
|
|
2022-04-27 03:12:17 +02:00
|
|
|
const [opened, setOpened] = useState(false);
|
2022-08-22 09:50:54 +02:00
|
|
|
|
2022-04-27 03:12:17 +02:00
|
|
|
return (
|
|
|
|
|
<>
|
2022-05-24 22:55:10 +02:00
|
|
|
<Drawer
|
2022-06-07 08:20:19 +02:00
|
|
|
size="xl"
|
2022-06-28 11:06:45 +02:00
|
|
|
padding="lg"
|
2022-05-24 22:55:10 +02:00
|
|
|
position="right"
|
2022-08-22 09:50:54 +02:00
|
|
|
title={<Title order={5}>{t('title')}</Title>}
|
2022-04-27 03:12:17 +02:00
|
|
|
opened={props.opened || opened}
|
|
|
|
|
onClose={() => setOpened(false)}
|
|
|
|
|
>
|
2022-05-18 22:08:09 +02:00
|
|
|
<SettingsMenu />
|
2022-06-28 11:06:45 +02:00
|
|
|
<Credits />
|
2022-05-24 22:55:10 +02:00
|
|
|
</Drawer>
|
2022-08-22 09:50:54 +02:00
|
|
|
<Tooltip label={t('tooltip')}>
|
2022-07-26 01:21:04 +02:00
|
|
|
<ActionIcon
|
|
|
|
|
variant="default"
|
|
|
|
|
radius="md"
|
|
|
|
|
size="xl"
|
|
|
|
|
color="blue"
|
|
|
|
|
style={props.style}
|
|
|
|
|
onClick={() => setOpened(true)}
|
|
|
|
|
>
|
2022-05-29 18:42:58 +02:00
|
|
|
<IconSettings />
|
2022-07-26 01:21:04 +02:00
|
|
|
</ActionIcon>
|
|
|
|
|
</Tooltip>
|
2022-04-27 03:12:17 +02:00
|
|
|
</>
|
|
|
|
|
);
|
|
|
|
|
}
|