diff --git a/gameyfin/src/main/frontend/components/theming/ThemeSelector.tsx b/gameyfin/src/main/frontend/components/theming/ThemeSelector.tsx index 52919a7..5f46679 100644 --- a/gameyfin/src/main/frontend/components/theming/ThemeSelector.tsx +++ b/gameyfin/src/main/frontend/components/theming/ThemeSelector.tsx @@ -5,6 +5,7 @@ import {themes} from "Frontend/theming/themes"; import {Theme} from "Frontend/theming/theme"; import ThemePreview from "Frontend/components/theming/ThemePreview"; import {UserPreferencesEndpoint} from "Frontend/generated/endpoints"; +import {toTitleCase} from "Frontend/util/utils"; export function ThemeSelector() { @@ -56,7 +57,9 @@ export function ThemeSelector() { ))) } -

Preview

+

Preview for theme + "{toTitleCase(theme!.replaceAll("-", " "))}" +

diff --git a/gameyfin/src/main/frontend/util/utils.ts b/gameyfin/src/main/frontend/util/utils.ts index f96747c..83e4f39 100644 --- a/gameyfin/src/main/frontend/util/utils.ts +++ b/gameyfin/src/main/frontend/util/utils.ts @@ -24,6 +24,12 @@ export function roleToRoleName(role: string) { return role.charAt(0).toUpperCase() + role.slice(1); } +export function toTitleCase(str: string) { + return str.toLowerCase().split(' ').map((word: string) => { + return (word.charAt(0).toUpperCase() + word.slice(1)); + }).join(' '); +} + export function roleToColor(role: string) { switch (role) { case "ROLE_SUPERADMIN":