diff --git a/src/components/ColorSchemeToggle/ColorSchemeSwitch.tsx b/src/components/ColorSchemeToggle/ColorSchemeSwitch.tsx deleted file mode 100644 index a167d0b94..000000000 --- a/src/components/ColorSchemeToggle/ColorSchemeSwitch.tsx +++ /dev/null @@ -1,60 +0,0 @@ -import React from 'react'; -import { - createStyles, - Switch, - Group, - useMantineColorScheme, - Kbd, - useMantineTheme, -} from '@mantine/core'; -import { IconMoonStars, IconSun } from '@tabler/icons'; -import { useTranslation } from 'next-i18next'; - -const useStyles = createStyles((theme) => ({ - root: { - position: 'relative', - '& *': { - cursor: 'pointer', - }, - }, - - icon: { - pointerEvents: 'none', - position: 'absolute', - zIndex: 1, - top: 3, - }, - - iconLight: { - left: 4, - color: theme.white, - }, - - iconDark: { - right: 4, - color: theme.colors.gray[6], - }, -})); - -export function ColorSchemeSwitch() { - const { colorScheme, toggleColorScheme } = useMantineColorScheme(); - const { t } = useTranslation('settings/general/theme-selector'); - const theme = useMantineTheme(); - return ( - - toggleColorScheme()} - size="md" - onLabel={} - offLabel={} - /> - {t('label', { - theme: colorScheme === 'dark' ? 'light' : 'dark', - })} - - Ctrl+J - - - ); -} diff --git a/src/components/Config/ConfigChanger.tsx b/src/components/Config/ConfigChanger.tsx index 666e1e487..9a0947d9b 100644 --- a/src/components/Config/ConfigChanger.tsx +++ b/src/components/Config/ConfigChanger.tsx @@ -15,7 +15,7 @@ export default function ConfigChanger() { const onConfigChange = (value: string) => { // TODO: check what should happen here with @manuel-rw // Wheter it should check for the current url and then load the new config only on index - // Or it should always load the selected config and open index or ? + // Or it should always load the selected config and open index or ? --> change url to page setActiveConfig(value); /* loadConfig(e ?? 'default'); diff --git a/src/components/Settings/Customization/MetaTitleChanger.tsx b/src/components/Settings/Customization/MetaTitleChanger.tsx index f06b8b35f..79ef71f68 100644 --- a/src/components/Settings/Customization/MetaTitleChanger.tsx +++ b/src/components/Settings/Customization/MetaTitleChanger.tsx @@ -8,6 +8,7 @@ interface MetaTitleChangerProps { defaultValue: string | undefined; } +// TODO: change to pageTitle export const MetaTitleChanger = ({ defaultValue }: MetaTitleChangerProps) => { const { t } = useTranslation('settings/customization/page-appearance'); const updateConfig = useConfigStore((x) => x.updateConfig); diff --git a/src/components/Settings/Customization/PageTitleChanger.tsx b/src/components/Settings/Customization/PageTitleChanger.tsx index d383f1d44..d4145e645 100644 --- a/src/components/Settings/Customization/PageTitleChanger.tsx +++ b/src/components/Settings/Customization/PageTitleChanger.tsx @@ -8,6 +8,7 @@ interface PageTitleChangerProps { defaultValue: string | undefined; } +// TODO: change to dashboard title export const PageTitleChanger = ({ defaultValue }: PageTitleChangerProps) => { const { t } = useTranslation('settings/customization/page-appearance'); const updateConfig = useConfigStore((x) => x.updateConfig); diff --git a/src/components/Settings/SettingsMenu.tsx b/src/components/Settings/SettingsDrawer.tsx similarity index 61% rename from src/components/Settings/SettingsMenu.tsx rename to src/components/Settings/SettingsDrawer.tsx index e51883dd3..b21c98da5 100644 --- a/src/components/Settings/SettingsMenu.tsx +++ b/src/components/Settings/SettingsDrawer.tsx @@ -31,37 +31,25 @@ function SettingsMenu() { ); } -export function SettingsMenuButton(props: any) { - useHotkeys([['ctrl+L', () => setOpened(!opened)]]); +interface SettingsDrawerProps { + opened: boolean; + closeDrawer: () => void; +} + +export function SettingsDrawer({ opened, closeDrawer }: SettingsDrawerProps) { const { t } = useTranslation('settings/common'); - const [opened, setOpened] = useState(false); - return ( - <> - {t('title')}} - opened={props.opened || opened} - onClose={() => setOpened(false)} - > - - - - - setOpened(true)} - > - - - - + {t('title')}} + opened={opened} + onClose={closeDrawer} + > + + + ); } diff --git a/src/components/layout/header/Header.tsx b/src/components/layout/header/Header.tsx index 936f051c3..7130d7378 100644 --- a/src/components/layout/header/Header.tsx +++ b/src/components/layout/header/Header.tsx @@ -4,9 +4,9 @@ import { AddItemShelfButton } from '../../AppShelf/AddAppShelfItem'; import DockerMenuButton from '../../../modules/docker/DockerModule'; import { Search } from './Search'; -import { SettingsMenuButton } from '../../Settings/SettingsMenu'; import { Logo } from '../Logo'; import { useCardStyles } from '../useCardStyles'; +import { SettingsMenu } from './SettingsMenu'; export const HeaderHeight = 64; @@ -23,7 +23,7 @@ export function Header(props: any) { - + diff --git a/src/components/layout/header/SettingsMenu.tsx b/src/components/layout/header/SettingsMenu.tsx new file mode 100644 index 000000000..95e58c85c --- /dev/null +++ b/src/components/layout/header/SettingsMenu.tsx @@ -0,0 +1,34 @@ +import { ActionIcon, Menu, Tooltip } from '@mantine/core'; +import { useDisclosure } from '@mantine/hooks'; +import { IconInfoCircle, IconMenu2, IconSettings } from '@tabler/icons'; +import { SettingsDrawer } from '../../Settings/SettingsDrawer'; +import { ColorSchemeSwitch } from './SettingsMenu/ColorSchemeSwitch'; + +export const SettingsMenu = () => { + const [drawerOpened, drawer] = useDisclosure(false); + + return ( + <> + + + + + + + + + + + } onClick={drawer.open}> + Homarr Settings + + } onClick={() => {}}> + About + + + + + + + ); +}; diff --git a/src/components/layout/header/SettingsMenu/ColorSchemeSwitch.tsx b/src/components/layout/header/SettingsMenu/ColorSchemeSwitch.tsx new file mode 100644 index 000000000..be027cdf4 --- /dev/null +++ b/src/components/layout/header/SettingsMenu/ColorSchemeSwitch.tsx @@ -0,0 +1,22 @@ +import { Menu, useMantineColorScheme, useMantineTheme } from '@mantine/core'; +import { IconMoonStars, IconSun } from '@tabler/icons'; +import { useTranslation } from 'next-i18next'; + +export const ColorSchemeSwitch = () => { + const { colorScheme, toggleColorScheme } = useMantineColorScheme(); + const { t } = useTranslation('settings/general/theme-selector'); + + const Icon = colorScheme === 'dark' ? IconSun : IconMoonStars; + + return ( + } + onClick={() => toggleColorScheme()} + > + {t('label', { + theme: colorScheme === 'dark' ? 'light' : 'dark', + })} + + ); +};