diff --git a/external/lang b/external/lang index 5af7326c..58408da6 160000 --- a/external/lang +++ b/external/lang @@ -1 +1 @@ -Subproject commit 5af7326c286f729ac6dd4cabff9dfdf7c480b631 +Subproject commit 58408da6c4090dd3a7808a663eaa95b8b1da7603 diff --git a/src/components/common/user/UserShort.tsx b/src/components/common/user/UserShort.tsx index bbe3670a..3f480b89 100644 --- a/src/components/common/user/UserShort.tsx +++ b/src/components/common/user/UserShort.tsx @@ -26,7 +26,10 @@ const BotBadge = styled.div` border-radius: calc(var(--border-radius) / 2); `; -type UsernameProps = JSX.HTMLAttributes & { +type UsernameProps = Omit< + JSX.HTMLAttributes, + "children" | "as" +> & { user?: User; prefixAt?: boolean; masquerade?: API.Masquerade; @@ -35,6 +38,13 @@ type UsernameProps = JSX.HTMLAttributes & { innerRef?: Ref; }; +const Name = styled.span<{ colour?: string | null }>` + background: ${(props) => props.colour ?? "var(--foreground)"}; + background-clip: text; + -webkit-background-clip: text; + -webkit-text-fill-color: transparent; +`; + export const Username = observer( ({ user, @@ -65,6 +75,11 @@ export const Username = observer( } } + const role = member.hoistedRole; + if (role) { + color = role[1].colour; + } + if (member.roles && member.roles.length > 0) { const srv = client.servers.get(member._id.server); if (srv?.roles) { @@ -81,14 +96,19 @@ export const Username = observer( } } + const el = ( + + {prefixAt ? "@" : undefined} + {masquerade?.name ?? username ?? ( + + )} + + ); + if (user?.bot) { return ( <> - - {masquerade?.name ?? username ?? ( - - )} - + {el} {masquerade ? ( @@ -100,14 +120,7 @@ export const Username = observer( ); } - return ( - - {prefixAt ? "@" : undefined} - {masquerade?.name ?? username ?? ( - - )} - - ); + return el; }, );