From e02f12736de63ae4d2e87ed148693d9cde9ebd55 Mon Sep 17 00:00:00 2001 From: Shea Duma Date: Sat, 23 May 2026 12:19:37 +0300 Subject: [PATCH] small profile-card fix Signed-off-by: Shea Duma --- .changeset/fix_unset_usercards.md | 5 +++++ src/app/hooks/useUserProfile.ts | 9 +++++++-- src/app/state/settings.ts | 5 +++-- 3 files changed, 15 insertions(+), 4 deletions(-) create mode 100644 .changeset/fix_unset_usercards.md diff --git a/.changeset/fix_unset_usercards.md b/.changeset/fix_unset_usercards.md new file mode 100644 index 000000000..f8450de1f --- /dev/null +++ b/.changeset/fix_unset_usercards.md @@ -0,0 +1,5 @@ +--- +default: patch +--- + +Fix unset User Profile cards having incorectly colored text. diff --git a/src/app/hooks/useUserProfile.ts b/src/app/hooks/useUserProfile.ts index 153f3444c..35bf794f5 100644 --- a/src/app/hooks/useUserProfile.ts +++ b/src/app/hooks/useUserProfile.ts @@ -283,8 +283,13 @@ export const useUserProfile = ( const resolvedPronouns = localPronouns || spacePronouns || data?.pronouns; const rawHeroBrightness = data?.heroColorScheme?.brightness; - const heroCardsAllowed = shouldApplyUserHeroCards(renderUserCardsMode, rawHeroBrightness); - const validHeroColor = heroCardsAllowed ? isValidHex(data?.heroColorScheme?.color) : undefined; + const rawHeroColor = data?.heroColorScheme?.color; + const heroCardsAllowed = shouldApplyUserHeroCards( + renderUserCardsMode, + rawHeroBrightness, + rawHeroColor + ); + const validHeroColor = heroCardsAllowed ? isValidHex(rawHeroColor) : undefined; const heroBrightness = heroCardsAllowed ? rawHeroBrightness : undefined; const testUserHeroColor = shadeColor(validHeroColor, heroBrightness === 'dark' ? -80 : 80); diff --git a/src/app/state/settings.ts b/src/app/state/settings.ts index 5d1231d89..1a7bf1d9e 100644 --- a/src/app/state/settings.ts +++ b/src/app/state/settings.ts @@ -68,11 +68,12 @@ export function isPixelatedViewerRendering(mode: PixelatedImageRenderingMode): b export function shouldApplyUserHeroCards( mode: RenderUserCardsMode, - brightness: string | undefined + brightness?: string, + color?: string ): boolean { + if (!color || (brightness !== 'light' && brightness !== 'dark')) return false; if (mode === 'none') return false; if (mode === 'both') return true; - if (brightness !== 'light' && brightness !== 'dark') return false; return brightness === mode; }