@@ -49,9 +49,9 @@ import { userProfileHref } from "./user-profile-href";
4949const USER_PREVIEW_NAMESPACES = [ "core.global" , "core.profile" ] as const ;
5050const AVATAR_SIZE = 56 ;
5151const PRESENCE_DOT_SIZE = 12 ;
52+ const CIRCLE_EDGE_INSET_AT_45_DEG = ( 1 - Math . SQRT1_2 ) / 2 ;
5253
53- // Eased stops: a two-stop fade bands and leaves a visible edge mid-cover.
54- const COVER_FADE =
54+ const EASED_COVER_FADE =
5555 "linear-gradient(to bottom, black 0%, rgb(0 0 0 / 0.85) 30%, rgb(0 0 0 / 0.45) 60%, rgb(0 0 0 / 0.12) 85%, transparent 100%)" ;
5656
5757/** Where the preview renders: a hover card, or a bottom sheet on touch screens. */
@@ -65,7 +65,6 @@ const ELAPSED_UNITS = [
6565 [ "minute" , 60 ] ,
6666] as const ;
6767
68- /** Short elapsed time since `date`, like "7 yrs" or "14 hr". */
6968const formatElapsed = ( date : Date | string , now : Date , locale : string ) => {
7069 const seconds = Math . max (
7170 0 ,
@@ -103,8 +102,9 @@ const PresenceAvatar = ({
103102 } )
104103 : t ( "offline" ) ;
105104 }
106- // The dot's centre sits on the circle's edge at 45°, ~14.6% in from the box.
107- const offset = Math . round ( AVATAR_SIZE * 0.146 - PRESENCE_DOT_SIZE / 2 ) ;
105+ const offset = Math . round (
106+ AVATAR_SIZE * CIRCLE_EDGE_INSET_AT_45_DEG - PRESENCE_DOT_SIZE / 2 ,
107+ ) ;
108108
109109 return (
110110 < span className = "relative inline-flex size-fit shrink-0" >
@@ -169,7 +169,6 @@ const LastVisited = ({ presence }: { presence: undefined | UserPresence }) => {
169169 ) ;
170170} ;
171171
172- /** Moderators only; the API answers 403 to everyone else anyway. */
173172const ModeratorWarnings = ( { userId } : { userId : number } ) => {
174173 const t = useTranslations ( "core.profile.preview.warnings" ) ;
175174 const tPreview = useTranslations ( "core.profile.preview" ) ;
@@ -184,7 +183,6 @@ const ModeratorWarnings = ({ userId }: { userId: number }) => {
184183 }
185184
186185 if ( query . isError ) {
187- // A moderator without the warnings permission: nothing to show or retry.
188186 if (
189187 query . error instanceof ModcpRequestError &&
190188 query . error . status === 403
@@ -278,6 +276,7 @@ const PreviewProfile = ({
278276 enabled : ! isSessionPending ,
279277 } ) ;
280278 const href = userProfileHref ( user . nameCode ) ;
279+ const reputation = user . reputation ?? 0 ;
281280
282281 return (
283282 < div
@@ -294,8 +293,8 @@ const PreviewProfile = ({
294293 data-slot = "user-preview-cover"
295294 style = { {
296295 ...userCoverStyle ( user . avatarColor ) ,
297- maskImage : COVER_FADE ,
298- WebkitMaskImage : COVER_FADE ,
296+ maskImage : EASED_COVER_FADE ,
297+ WebkitMaskImage : EASED_COVER_FADE ,
299298 } }
300299 >
301300 < UserCoverImage url = { user . coverUrl } />
@@ -319,11 +318,11 @@ const PreviewProfile = ({
319318 < Stat label = { t ( "reputation" ) } >
320319 < ShortNumber
321320 className = { cn (
322- ( user . reputation ?? 0 ) > 0 && FEEDBACK_TONE_TEXT . success ,
323- ( user . reputation ?? 0 ) < 0 && FEEDBACK_TONE_TEXT . destructive ,
321+ reputation > 0 && FEEDBACK_TONE_TEXT . success ,
322+ reputation < 0 && FEEDBACK_TONE_TEXT . destructive ,
324323 ) }
325324 formatOptions = { { signDisplay : "exceptZero" } }
326- value = { user . reputation ?? 0 }
325+ value = { reputation }
327326 />
328327 </ Stat >
329328 < Stat label = { t ( "joined" ) } >
@@ -439,9 +438,7 @@ export const UserPreviewCard = ({
439438 nameCode : string ;
440439 surface ?: UserPreviewSurface ;
441440} ) => (
442- < React . Suspense fallback = { < UserPreviewSkeleton /> } >
443- < RouteMessages namespaces = { USER_PREVIEW_NAMESPACES } >
444- < PreviewBody nameCode = { nameCode } surface = { surface } />
445- </ RouteMessages >
446- </ React . Suspense >
441+ < RouteMessages namespaces = { USER_PREVIEW_NAMESPACES } >
442+ < PreviewBody nameCode = { nameCode } surface = { surface } />
443+ </ RouteMessages >
447444) ;
0 commit comments