1- import React from "@moonlight-mod/wp/react" ;
1+ import React , { useState } from "@moonlight-mod/wp/react" ;
22import spacepack from "@moonlight-mod/wp/spacepack_spacepack" ;
3- import { GuildMemberStore } from "@moonlight-mod/wp/common_stores" ;
3+ import { GuildMemberStore , UserStore } from "@moonlight-mod/wp/common_stores" ;
44import { useStateFromStores } from "@moonlight-mod/wp/discord/packages/flux" ;
55
66const useGradient = spacepack . findFunctionByStrings (
7- spacepack . findByCode ( '"--custom-gradient-color-1" :null!=' ) ?. [ 0 ] ?. exports ?? { } ,
7+ spacepack . findByCode ( ` ${ '"--custom-gradient-color-2"' } :null!=` ) ?. [ 0 ] ?. exports ?? { } ,
88 ".useMemo("
99) ;
10+ const useDisplayNameStylesFont = spacepack . findFunctionByStrings (
11+ spacepack . findByCode ( ".dnsFont" ) ?. [ 0 ] ?. exports ?? { } ,
12+ ".dnsFont"
13+ ) ;
1014
1115const classnames = spacepack . require ( "classnames" ) ;
1216
@@ -27,9 +31,14 @@ export default function ColorConsistencyWrapper({
2731 userId ,
2832 guildId
2933 ] ) ;
34+ const user = useStateFromStores ( [ UserStore ] , ( ) => UserStore . getUser ( userId ) , [ userId ] ) ;
35+
3036 const { colorString, colorStrings } = member ?? { } ;
3137 let gradientClassname , gradientStyle ;
3238
39+ const displayNameStyles = member ?. displayNameStyles ?? user ?. displayNameStyles ;
40+ const fontClass = useDisplayNameStylesFont ?.( { displayNameStyles, inProfile : false } ) ;
41+
3342 try {
3443 const gradientRole =
3544 useGradient ?.( { ...( colorStrings ?? { } ) , roleStyle : "username" , includeConvenienceGlow : false } ) ?? { } ;
@@ -39,7 +48,7 @@ export default function ColorConsistencyWrapper({
3948 // noop
4049 }
4150
42- if ( ! member || ! colorString ) return children ;
51+ if ( ( ! member || ! colorString ) && ! fontClass ) return children ;
4352
4453 return (
4554 < span
@@ -48,7 +57,7 @@ export default function ColorConsistencyWrapper({
4857 filter : speaking ? "brightness(1.75)" : null ,
4958 ...( gradientStyle ?? { } )
5059 } }
51- className = { classnames ( "" , gradientClassname ?? { } ) }
60+ className = { classnames ( "" , gradientClassname ?? { } , fontClass ?? "" ) }
5261 >
5362 { children }
5463 </ span >
0 commit comments