diff --git a/src/app/components/user-profile/UserHero.tsx b/src/app/components/user-profile/UserHero.tsx index 2fabad92a..224a98d59 100644 --- a/src/app/components/user-profile/UserHero.tsx +++ b/src/app/components/user-profile/UserHero.tsx @@ -70,7 +70,7 @@ export function UserHero({ userId, avatarUrl, bannerUrl, presence, autoplayGifs const status = presence?.status; const isExpandable = (status?.length ?? 0) > 70; - const fetchedProfile = useUserProfile(userId, undefined, undefined, true); + const fetchedProfile = useUserProfile(userId); return ( 0 ? fetchedProfile @@ -459,6 +458,7 @@ export function UserRoomProfile({ userId, initialProfile }: Readonly f.replaceAll(/[;{}<>]/g, '').slice(0, 32); export const useUserProfile = ( userId: string, room?: Room, - initialProfile?: Partial, - isInUserHero?: boolean + initialProfile?: Partial ): UserProfile & { resolvedColor?: string; resolvedFont?: string; resolvedPronouns?: any[]; + heroColor?: string; + heroBrightness?: string; } => { const mx = useMatrixClient(); const [legacyUsernameColor] = useSetting(settingsAtom, 'legacyUsernameColor'); @@ -212,15 +213,12 @@ export const useUserProfile = ( } } } + const validHeroColor = isValidHex(data?.heroColorScheme?.color); + const heroBrightness = data?.heroColorScheme?.brightness; + const validGlobalVal = isValidHex(data?.nameColor); const validGlobalValDark = isValidHex(data?.nameColorDark); const validGlobalValLight = isValidHex(data?.nameColorLight); - console.log( - 'Hero Color Scheme: ', - data?.heroColorScheme?.color, - 'Is User Hero: ', - isInUserHero === true - ); const validGlobalGeneral = (renderGlobalColors || userId === mx.getUserId()) && !!validGlobalVal @@ -265,6 +263,8 @@ export const useUserProfile = ( resolvedFont, resolvedPronouns, pronouns: resolvedPronouns, + heroColor: validHeroColor, + heroBrightness, }; }, [ cached, @@ -274,7 +274,6 @@ export const useUserProfile = ( room, renderRoomColors, renderRoomFonts, - isInUserHero, renderGlobalColors, themeKind, legacyUsernameColor,