diff --git a/CHANGELOG.md b/CHANGELOG.md index 59c28c8..070364f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,7 @@ What changed in each release of SCN Chat, for the people who use it, run it, or ### Added - `pnpm setup-env` creates `.env` from `.env.example` and fills in fresh `OAUTH_PRIVATE_KEYS` and `SECRET_KEY`, so local setup no longer means copying secrets by hand. Secrets already set are left alone. +- The account menu in the sidebar has a Theme row for switching between System, Light, and Dark without opening Settings. It is the same choice as in Preferences, kept on your device. ### Changed diff --git a/apps/web/src/features/auth/components/AccountMenu.tsx b/apps/web/src/features/auth/components/AccountMenu.tsx index fd7e7a6..1624c12 100644 --- a/apps/web/src/features/auth/components/AccountMenu.tsx +++ b/apps/web/src/features/auth/components/AccountMenu.tsx @@ -3,10 +3,12 @@ import { type ReactNode, use, useRef, useState } from 'react' import { cn } from '../../../shared/cn.ts' import { MoreVerticalIcon, SettingsIcon, ShieldIcon, SignOutIcon } from '../../../shared/icons.tsx' import { floating } from '../../../shared/ui/menu.ts' +import { Separator } from '../../../shared/ui/Separator.tsx' import { sidebarRow } from '../../../shared/ui/sidebar.ts' import { useDismiss } from '../../../shared/useDismiss.ts' import { MeContext } from '../session.ts' import { AccountCard } from './AccountCard.tsx' +import { ThemeSwitch } from './ThemeSwitch.tsx' interface Props { /** A small mark on the avatar's corner, such as a status dot. */ @@ -19,8 +21,9 @@ interface Props { /** * Who is signed in, as a button that opens a menu of the caller's status, Settings, Admin for - * admins, and Sign out. The menu is a piece of the sidebar lifted over it, rising from the account, - * and reaches past the button by its padding and edge, so its rows line up with the sidebar's. + * admins, the theme between two separators, and Sign out. The menu is a piece of the sidebar lifted + * over it, rising from the account, and reaches past the button by its padding and edge, so its + * rows line up with the sidebar's. */ export function AccountMenu(props: Props) { const me = use(MeContext) @@ -57,6 +60,9 @@ export function AccountMenu(props: Props) { Admin )} + + + + ))} + + + ) +} diff --git a/apps/web/src/features/settings/pages/PreferencesSettings.tsx b/apps/web/src/features/settings/pages/PreferencesSettings.tsx index 47b3225..1b68586 100644 --- a/apps/web/src/features/settings/pages/PreferencesSettings.tsx +++ b/apps/web/src/features/settings/pages/PreferencesSettings.tsx @@ -4,7 +4,12 @@ import { ClientOnly } from '@tanstack/react-router' import { ErrorAlert } from '../../../shared/ErrorAlert.tsx' import { formKey, useAppForm } from '../../../shared/form.tsx' import { ChevronDownIcon } from '../../../shared/icons.tsx' -import { chooseTheme, type ThemeChoice, useThemeChoice } from '../../../shared/theme.ts' +import { + chooseTheme, + type ThemeChoice, + themeChoices, + useThemeChoice, +} from '../../../shared/theme.ts' import { Select } from '../../../shared/ui/Select.tsx' import { type Save, @@ -52,12 +57,6 @@ export function PreferencesSettings() { ) } -const themes: { value: ThemeChoice; label: string }[] = [ - { value: 'system', label: 'System' }, - { value: 'light', label: 'Light' }, - { value: 'dark', label: 'Dark' }, -] - /** Light or dark for this device, applied at once and kept here, apart from the saved preferences. */ function Appearance() { return ( @@ -82,7 +81,7 @@ function ThemeSelect() { return (