From bf9eca3b5ec4be0308ee38dffd7c5c565f490a42 Mon Sep 17 00:00:00 2001 From: Boof2015 <75185879+Boof2015@users.noreply.github.com> Date: Tue, 21 Apr 2026 19:57:09 -0400 Subject: [PATCH] show theme creator name in dropdown --- src/renderer/components/BottomBar.tsx | 15 ++++++++++++++- test/renderer-helpers.test.ts | 17 ++++++++++++++++- 2 files changed, 30 insertions(+), 2 deletions(-) diff --git a/src/renderer/components/BottomBar.tsx b/src/renderer/components/BottomBar.tsx index 3aecbd1..ecb8c4d 100644 --- a/src/renderer/components/BottomBar.tsx +++ b/src/renderer/components/BottomBar.tsx @@ -50,6 +50,19 @@ type ThemeCreditSource = { description?: string } | null | undefined +type ThemeOptionLabelSource = { + name: string + credit?: string +} + +export function resolveThemeOptionLabel(theme: ThemeOptionLabelSource): string { + const credit = typeof theme.credit === 'string' && theme.credit.trim() + ? theme.credit.trim() + : null + + return credit ? `${theme.name} - ${credit}` : theme.name +} + export function resolveThemeCreditDetails(theme: ThemeCreditSource): { credit: string | null url: string | null @@ -408,7 +421,7 @@ export default function BottomBar({ onClose, onHeightChange }: BottomBarProps): > {themeEntries.map(([id, theme]) => ( ))} diff --git a/test/renderer-helpers.test.ts b/test/renderer-helpers.test.ts index b569cbb..fcfb367 100644 --- a/test/renderer-helpers.test.ts +++ b/test/renderer-helpers.test.ts @@ -37,7 +37,7 @@ import { useSettingsStore, } from '../src/renderer/stores/settingsStore' import { useThemeStore } from '../src/renderer/stores/themeStore' -import { resolveThemeCreditDetails } from '../src/renderer/components/BottomBar' +import { resolveThemeCreditDetails, resolveThemeOptionLabel } from '../src/renderer/components/BottomBar' import { scopeSettingsToOptions } from '../src/renderer/components/ScopeModule' import { scopeSummary } from '../src/renderer/components/ScopeSettingsSection' import { @@ -2189,6 +2189,21 @@ test('resolveThemeCreditDetails normalizes descriptions and enables links only f ) }) +test('resolveThemeOptionLabel appends creator credit when present', () => { + assert.equal( + resolveThemeOptionLabel({ name: 'Night Shift', credit: 'Astra' }), + 'Night Shift - Astra', + ) + assert.equal( + resolveThemeOptionLabel({ name: 'Night Shift' }), + 'Night Shift', + ) + assert.equal( + resolveThemeOptionLabel({ name: 'Night Shift', credit: ' ' }), + 'Night Shift', + ) +}) + test('BottomBar theme section renders compact credit metadata and opens valid links through Electron', async () => { const componentSource = await readFile(join(process.cwd(), 'src', 'renderer', 'components', 'BottomBar.tsx'), 'utf8') const stylesSource = await readFile(join(process.cwd(), 'src', 'renderer', 'styles', 'globals.css'), 'utf8')