feat: add auto/system color scheme option
- Extend ColorScheme type to include 'auto' alongside 'light' and 'dark' - Allow 'auto' to persist to DB and cookie (remove the explicit guard) - Server default and new-user default both changed to 'auto' - layout.tsx: omit inline backgroundColor when scheme is 'auto' - Avatar menu: replace toggle item with a Combobox (Auto/Light/Dark) mirroring the existing language selector pattern - Appearance settings form and color scheme comboboxes updated with IconDeviceDesktop for the new auto option - Spotlight command handles 'auto' state via useComputedColorScheme - Old import: map legacy 'environment' value to 'auto' - Add translation keys for 'auto' in all three relevant scopes
This commit is contained in:
1 parent
327611dfc6
commit
0d2675e1bb
12 files changed
+124
-67
No files matched your search
@@ -1,7 +1,8 @@
|
||||
import { Group, Text, useMantineColorScheme } from "@mantine/core";
|
||||
import { Group, Text, useComputedColorScheme, useMantineColorScheme } from "@mantine/core";
|
||||
import {
|
||||
IconBox,
|
||||
IconCategoryPlus,
|
||||
IconDeviceDesktop,
|
||||
IconFileImport,
|
||||
IconLanguage,
|
||||
IconMailForward,
|
||||
@@ -52,13 +53,17 @@ export const globalCommandGroup = createGroup<Command>({
|
||||
useOptions() {
|
||||
const tOption = useScopedI18n("search.mode.command.group.globalCommand.option");
|
||||
const { colorScheme } = useMantineColorScheme();
|
||||
const computedColorScheme = useComputedColorScheme("light");
|
||||
const { data: session } = useSession();
|
||||
|
||||
const commands: (Command & { hidden?: boolean })[] = [
|
||||
{
|
||||
commandKey: "colorScheme",
|
||||
icon: colorScheme === "dark" ? IconSun : IconMoon,
|
||||
name: tOption(`colorScheme.${colorScheme === "dark" ? "light" : "dark"}`),
|
||||
icon: colorScheme === "auto" ? IconDeviceDesktop : computedColorScheme === "dark" ? IconSun : IconMoon,
|
||||
name:
|
||||
colorScheme === "auto"
|
||||
? tOption("colorScheme.auto")
|
||||
: tOption(`colorScheme.${computedColorScheme === "dark" ? "light" : "dark"}`),
|
||||
useInteraction: () => {
|
||||
const { toggleColorScheme } = useMantineColorScheme();
|
||||
|
||||
|
||||
Reference in new issue
Block a user