Add color scheme setting to Settings -> Preferences

This commit is contained in:
Tom Moor
2024-04-16 20:19:07 -04:00
parent f6786945a0
commit c259c9617b
2 changed files with 22 additions and 1 deletions

View File

@@ -5,6 +5,7 @@ import { Trans, useTranslation } from "react-i18next";
import { toast } from "sonner";
import { languageOptions } from "@shared/i18n";
import { TeamPreference, UserPreference } from "@shared/types";
import { Theme } from "~/stores/UiStore";
import Button from "~/components/Button";
import Heading from "~/components/Heading";
import InputSelect from "~/components/InputSelect";
@@ -19,7 +20,7 @@ import SettingRow from "./components/SettingRow";
function Preferences() {
const { t } = useTranslation();
const { dialogs } = useStores();
const { ui, dialogs } = useStores();
const user = useCurrentUser();
const team = useCurrentTeam();
@@ -82,6 +83,25 @@ function Preferences() {
ariaLabel={t("Language")}
/>
</SettingRow>
<SettingRow
name="theme"
label={t("Appearance")}
description={t("Choose your preferred interface color scheme.")}
>
<InputSelect
ariaLabel={t("Appearance")}
options={[
{ label: t("Light"), value: Theme.Light },
{ label: t("Dark"), value: Theme.Dark },
{ label: t("System"), value: Theme.System },
]}
value={ui.resolvedTheme}
onChange={(theme) => {
ui.setTheme(theme as Theme);
toast.success(t("Preferences saved"));
}}
/>
</SettingRow>
<SettingRow
name={UserPreference.UseCursorPointer}
label={t("Use pointer cursor")}