2023-01-07 20:24:15 +01:00
|
|
|
import { ScrollArea, Stack } from '@mantine/core';
|
2023-01-05 22:44:43 +09:00
|
|
|
import { useViewportSize } from '@mantine/hooks';
|
2023-01-04 22:39:58 +09:00
|
|
|
import { useTranslation } from 'next-i18next';
|
2022-12-06 21:22:37 +01:00
|
|
|
import { useConfigContext } from '../../../config/provider';
|
2022-12-24 15:43:49 +01:00
|
|
|
import { useConfigStore } from '../../../config/store';
|
|
|
|
|
import { LayoutSelector } from './Layout/LayoutSelector';
|
2022-12-06 21:22:37 +01:00
|
|
|
import { BackgroundChanger } from './Meta/BackgroundChanger';
|
|
|
|
|
import { FaviconChanger } from './Meta/FaviconChanger';
|
|
|
|
|
import { LogoImageChanger } from './Meta/LogoImageChanger';
|
|
|
|
|
import { MetaTitleChanger } from './Meta/MetaTitleChanger';
|
|
|
|
|
import { PageTitleChanger } from './Meta/PageTitleChanger';
|
2022-12-24 15:43:49 +01:00
|
|
|
import { ColorSelector } from './Theme/ColorSelector';
|
|
|
|
|
import { CustomCssChanger } from './Theme/CustomCssChanger';
|
2022-12-06 21:22:37 +01:00
|
|
|
import { OpacitySelector } from './Theme/OpacitySelector';
|
|
|
|
|
import { ShadeSelector } from './Theme/ShadeSelector';
|
2022-12-04 17:36:30 +01:00
|
|
|
|
|
|
|
|
export default function CustomizationSettings() {
|
2022-12-24 15:43:49 +01:00
|
|
|
const { config, name: configName } = useConfigContext();
|
2023-01-04 22:39:58 +09:00
|
|
|
const { t } = useTranslation('common');
|
2023-01-05 22:44:43 +09:00
|
|
|
const { height, width } = useViewportSize();
|
2022-12-24 15:43:49 +01:00
|
|
|
|
|
|
|
|
const { updateConfig } = useConfigStore();
|
|
|
|
|
|
2022-12-04 17:36:30 +01:00
|
|
|
return (
|
2023-01-05 22:44:43 +09:00
|
|
|
<ScrollArea style={{ height: height - 100 }} offsetScrollbars>
|
|
|
|
|
<Stack mt="xs" mb="md" spacing="xs">
|
2022-12-24 15:43:49 +01:00
|
|
|
<LayoutSelector defaultLayout={config?.settings.customization.layout} />
|
|
|
|
|
<PageTitleChanger defaultValue={config?.settings.customization.pageTitle} />
|
|
|
|
|
<MetaTitleChanger defaultValue={config?.settings.customization.metaTitle} />
|
|
|
|
|
<LogoImageChanger defaultValue={config?.settings.customization.logoImageUrl} />
|
|
|
|
|
<FaviconChanger defaultValue={config?.settings.customization.faviconUrl} />
|
|
|
|
|
<BackgroundChanger defaultValue={config?.settings.customization.backgroundImageUrl} />
|
|
|
|
|
<CustomCssChanger defaultValue={config?.settings.customization.customCss} />
|
|
|
|
|
<ColorSelector
|
|
|
|
|
type="primary"
|
|
|
|
|
defaultValue={config?.settings.customization.colors.primary}
|
|
|
|
|
/>
|
|
|
|
|
<ColorSelector
|
|
|
|
|
type="secondary"
|
|
|
|
|
defaultValue={config?.settings.customization.colors.secondary}
|
|
|
|
|
/>
|
|
|
|
|
<ShadeSelector defaultValue={config?.settings.customization.colors.shade} />
|
|
|
|
|
<OpacitySelector defaultValue={config?.settings.customization.appOpacity} />
|
2023-01-05 22:44:43 +09:00
|
|
|
</Stack>
|
|
|
|
|
</ScrollArea>
|
2022-12-04 17:36:30 +01:00
|
|
|
);
|
|
|
|
|
}
|