A local-first personal finance app
Add user-friendly theme option labels (#1796) (#1797)
Michael Huynh38609ee25aad
diff --git a/packages/desktop-client/src/components/settings/Themes.tsx b/packages/desktop-client/src/components/settings/Themes.tsxindex 485a54e5b5..4db980d793 100644--- a/packages/desktop-client/src/components/settings/Themes.tsx+++ b/packages/desktop-client/src/components/settings/Themes.tsx@@ -1,7 +1,7 @@import React from 'react';import { useActions } from '../../hooks/useActions';-import { themeNames, useTheme } from '../../style';+import { themeOptions, useTheme } from '../../style';import Button from '../common/Button';import Select from '../common/Select';import Text from '../common/Text';@@ -21,7 +21,7 @@ export default function ThemeSettings() {saveGlobalPrefs({ theme: value });}}value={theme}- options={themeNames.map(name => [name, name])}+ options={themeOptions}/></Button>}diff --git a/packages/desktop-client/src/style/theme.tsx b/packages/desktop-client/src/style/theme.tsxindex e1465f0a96..49d87451fe 100644--- a/packages/desktop-client/src/style/theme.tsx+++ b/packages/desktop-client/src/style/theme.tsx@@ -8,12 +8,16 @@ import * as developmentTheme from './themes/development';import * as lightTheme from './themes/light';const themes = {- light: lightTheme,- dark: darkTheme,- ...(isNonProductionEnvironment() && { development: developmentTheme }),+ light: { name: 'Light', colors: lightTheme },+ dark: { name: 'Dark', colors: darkTheme },+ ...(isNonProductionEnvironment() && {+ development: { name: 'Development', colors: developmentTheme },+ }),};-export const themeNames = Object.keys(themes) as Theme[];+export const themeOptions = Object.entries(themes).map(+ ([key, { name }]) => [key, name] as [Theme, string],+);export function useTheme() {return useSelector(state => state.prefs.global?.theme) || 'light';@@ -21,7 +25,7 @@ export function useTheme() {export function ThemeStyle() {let theme = useTheme();- let themeColors = themes[theme];+ let themeColors = themes[theme].colors;let css = Object.keys(themeColors).map(key => ` --color-${key}: ${themeColors[key]};`).join('\n');diff --git a/upcoming-release-notes/1797.md b/upcoming-release-notes/1797.mdnew file mode 100644index 0000000000..ca29b85030--- /dev/null+++ b/upcoming-release-notes/1797.md@@ -0,0 +1,6 @@+---+category: Bugfix+authors: [miqh]+---++Adjust casing of theme options for consistent presentation.