File tree Expand file tree Collapse file tree 4 files changed +49
-17
lines changed
Expand file tree Collapse file tree 4 files changed +49
-17
lines changed Original file line number Diff line number Diff line change 33import Link from 'next/link' ;
44import { FC , ReactNode } from 'react' ;
55
6+ import { cn } from '@/lib/utils' ;
7+
68type LinkWithStopPropagationProps = {
79 children : ReactNode ;
810 href : string ;
11+ className ?: string ;
912} ;
1013
11- export const LinkWithStopPropagation : FC < LinkWithStopPropagationProps > = ( { children, href } ) => {
14+ export const LinkWithStopPropagation : FC < LinkWithStopPropagationProps > = ( { children, href, className } ) => {
1215 return (
13- < Link href = { href } onClick = { ( event ) => event . stopPropagation ( ) } prefetch = { false } >
16+ < Link
17+ href = { href }
18+ onClick = { ( event ) => event . stopPropagation ( ) }
19+ prefetch = { false }
20+ className = { cn ( 'flex items-center gap-2' , className ) }
21+ >
1422 { children }
1523 </ Link >
1624 ) ;
Original file line number Diff line number Diff line change 1+ 'use client' ;
2+ import { AvatarFallback } from '@radix-ui/react-avatar' ;
3+ import { useLinkStatus } from 'next/link' ;
4+ import { FC } from 'react' ;
5+
6+ import { Avatar , AvatarImage } from '@/components/ui/avatar' ;
7+ import { cn } from '@/lib/utils' ;
8+
9+ type ProfileAvatarProps = {
10+ url ?: string | null ;
11+ initials ?: string | null ;
12+ } ;
13+
14+ export const ProfileAvatar : FC < ProfileAvatarProps > = ( { url, initials } ) => {
15+ const { pending } = useLinkStatus ( ) ;
16+
17+ if ( ! url ) {
18+ return null ;
19+ }
20+
21+ return (
22+ < Avatar >
23+ < AvatarImage src = { url } className = { cn ( 'rounded-full' , { 'animate-spin' : pending } ) } width = { 36 } height = { 36 } />
24+ < AvatarFallback > { initials } </ AvatarFallback >
25+ </ Avatar >
26+ ) ;
27+ } ;
Original file line number Diff line number Diff line change 11import { Page } from '@/components/page/page' ;
22import { RankDelta } from '@/components/rank-delta/rank-delta' ;
3- import { Avatar , AvatarFallback , AvatarImage } from '@/components/ui/avatar' ;
43import {
54 Pagination ,
65 PaginationContent ,
@@ -15,6 +14,7 @@ import { getInitials } from '@/utils/get-initials';
1514
1615import { ClickableRow } from './components/clickale-row' ;
1716import { LinkWithStopPropagation } from './components/link-with-stop-propagation' ;
17+ import { ProfileAvatar } from './components/profile-avatar' ;
1818
1919const ITEMS_PER_PAGE = 100 ;
2020
@@ -93,14 +93,11 @@ export default async function GlobalRanking({
9393 < RankDelta current = { item [ rankPropName ] } previous = { item [ `${ rankPropName } M` ] } />
9494 </ div >
9595 </ TableCell >
96- < TableCell className = "flex items-center gap-2" >
97- { ! ! user ?. avatarUrl && (
98- < Avatar >
99- < AvatarImage src = { user . avatarUrl } className = "rounded-full" width = { 36 } height = { 36 } />
100- < AvatarFallback > { getInitials ( user ?. login ) } </ AvatarFallback >
101- </ Avatar >
102- ) }
103- < LinkWithStopPropagation href = { `/profile/${ user ?. login } ` } > { user ?. login } </ LinkWithStopPropagation >
96+ < TableCell >
97+ < LinkWithStopPropagation href = { `/profile/${ user ?. login } ` } >
98+ < ProfileAvatar url = { user ?. avatarUrl } initials = { getInitials ( user ?. login ) } />
99+ { user ?. login }
100+ </ LinkWithStopPropagation >
104101 </ TableCell >
105102 < TableCell className = "hidden sm:table-cell break-all whitespace-normal" > { user ?. location } </ TableCell >
106103 < TableCell className = "text-right" > { user ?. [ rankPropName ] ?. toLocaleString ( 'en-US' ) } </ TableCell >
Original file line number Diff line number Diff line change @@ -13,16 +13,16 @@ const nextConfig: NextConfig = {
1313 async rewrites ( ) {
1414 return [
1515 {
16- source : " /ingest/static/:path*" ,
17- destination : " https://eu-assets.i.posthog.com/static/:path*" ,
16+ source : ' /ingest/static/:path*' ,
17+ destination : ' https://eu-assets.i.posthog.com/static/:path*' ,
1818 } ,
1919 {
20- source : " /ingest/:path*" ,
21- destination : " https://eu.i.posthog.com/:path*" ,
20+ source : ' /ingest/:path*' ,
21+ destination : ' https://eu.i.posthog.com/:path*' ,
2222 } ,
2323 {
24- source : " /ingest/decide" ,
25- destination : " https://eu.i.posthog.com/decide" ,
24+ source : ' /ingest/decide' ,
25+ destination : ' https://eu.i.posthog.com/decide' ,
2626 } ,
2727 ] ;
2828 } ,
You can’t perform that action at this time.
0 commit comments