feat: Add detailed logging for user profile components and image metadata extraction; enhance color handling utilities
This commit is contained in:
@@ -37,6 +37,13 @@ export function UserHero({ userId, avatarUrl, avatarMxc, presence }: UserHeroPro
|
||||
const bannerUrl = useOtherUserBanner(userId, avatarMxc); // Now returns blob URL directly
|
||||
const profileStyle = useOtherUserProfileStyle(userId, avatarMxc);
|
||||
|
||||
console.log('[UserHero]', {
|
||||
userId,
|
||||
avatarMxc,
|
||||
bannerUrl,
|
||||
profileStyle,
|
||||
});
|
||||
|
||||
return (
|
||||
<Box
|
||||
direction="Column"
|
||||
@@ -125,6 +132,13 @@ export function UserHeroName({ displayName, userId, avatarMxc }: UserHeroNamePro
|
||||
const username = getMxIdLocalPart(userId);
|
||||
const userColor = useOtherUserColor(userId, avatarMxc);
|
||||
|
||||
console.log('[UserHeroName]', {
|
||||
userId,
|
||||
avatarMxc,
|
||||
userColor,
|
||||
fallbackColor: colorMXID(userId),
|
||||
});
|
||||
|
||||
return (
|
||||
<Box grow="Yes" direction="Column" gap="100">
|
||||
<Box alignItems="Baseline" gap="200" wrap="Wrap">
|
||||
|
||||
@@ -26,7 +26,8 @@ import { DirectCreateSearchParams } from '../../pages/paths';
|
||||
import { getContrastingTextColor, stripAlphaFromColor, getTextShadowColor } from '../../utils/common';
|
||||
import classNames from 'classnames';
|
||||
import { BreakWord, LineClamp3 } from '../../styles/Text.css';
|
||||
import colorMXID from '../../../util/colorMXID';
|
||||
import colorMXID, { getColorMXIDValue } from '../../../util/colorMXID';
|
||||
import { useOtherUserColor } from '../../hooks/useUserColor';
|
||||
|
||||
type UserRoomProfileProps = {
|
||||
userId: string;
|
||||
@@ -64,6 +65,7 @@ export function UserRoomProfile({ userId }: UserRoomProfileProps) {
|
||||
|
||||
const presence = useUserPresence(userId);
|
||||
const profileStyle = useOtherUserProfileStyle(userId, avatarMxc);
|
||||
const userColor = useOtherUserColor(userId, avatarMxc);
|
||||
|
||||
// Build gradient CSS if configured
|
||||
const gradientStyle = profileStyle.gradient
|
||||
@@ -87,9 +89,25 @@ export function UserRoomProfile({ userId }: UserRoomProfileProps) {
|
||||
(canKickUser && membership === Membership.Join) ||
|
||||
(canBanUser && membership !== Membership.Ban);
|
||||
|
||||
const profileColor = profileStyle.avatarBorderColor ? stripAlphaFromColor(profileStyle.avatarBorderColor) : colorMXID(userId);
|
||||
// Use userColor for text, or fall back to colorMXID
|
||||
const profileColor = userColor ? userColor : getColorMXIDValue(userId);
|
||||
const profileTextShadow = `0 1px 4px ${getTextShadowColor(profileColor)}`;
|
||||
const pillBgColor = profileStyle.avatarBorderColor ? stripAlphaFromColor(profileStyle.avatarBorderColor) : undefined;
|
||||
|
||||
// Use avatarBorderColor for pill background only if it has visible alpha (not fully transparent)
|
||||
const hasVisibleBorder = profileStyle.avatarBorderColor && !profileStyle.avatarBorderColor.endsWith('00');
|
||||
const pillBgColor = hasVisibleBorder ? stripAlphaFromColor(profileStyle.avatarBorderColor!) : undefined;
|
||||
|
||||
console.log('[UserRoomProfile]', {
|
||||
userId,
|
||||
avatarMxc,
|
||||
userColor,
|
||||
profileStyle,
|
||||
profileColor,
|
||||
profileTextShadow,
|
||||
hasVisibleBorder,
|
||||
pillBgColor,
|
||||
fallbackColorMXID: getColorMXIDValue(userId),
|
||||
});
|
||||
|
||||
return (
|
||||
<Box direction="Column">
|
||||
|
||||
Reference in New Issue
Block a user