@@ -4,7 +4,6 @@ import getUnicodeFlagIcon from 'country-flag-icons/unicode';
44import { useCallback , useMemo } from 'react' ;
55import { useTranslation } from 'react-i18next' ;
66import { Link , useNavigate , useParams , useSearchParams } from 'react-router-dom' ;
7- import StickyBox from 'react-sticky-box' ;
87import { Container } from '@/components/Container' ;
98import { activityCodeToName } from '@/lib/activityCodes' ;
109import { acceptedRegistration , isRegisteredForEvent } from '@/lib/person' ;
@@ -67,7 +66,7 @@ export const PsychSheetEvent = () => {
6766 [ sortedPersons ] ,
6867 ) ;
6968
70- const gridCss = 'grid grid-cols-[3em_2em_1fr_min-content_7em] grid-rows-10 ' ;
69+ const gridCss = 'grid grid-cols-[3em_2em_1fr_min-content_7em]' ;
7170
7271 const handleEventChange = useCallback (
7372 ( newEventId : EventId ) => {
@@ -106,14 +105,17 @@ export const PsychSheetEvent = () => {
106105 < option value = "single" > { t ( 'common.wca.resultType.single' ) } </ option >
107106 </ select >
108107 </ div >
109- < StickyBox offsetTop = { 0 } offsetBottom = { 0 } >
110- < div className = { classNames ( 'bg-green-300 w-full' , gridCss ) } role = "rowheader" >
108+
109+ < div className = { gridCss } >
110+ < div
111+ className = { '[&>span]:bg-green-300 stickyGridHeader contents absolute' }
112+ role = "rowheader" >
111113 < span className = "px-3 py-2.5 text-right font-bold" > #</ span >
112- < span className = "px-3 py-2.5 text-left" > </ span >
114+ < span className = "px-3 py-2.5 text-left" / >
113115 < span className = "px-3 py-2.5 text-left font-bold" >
114116 { t ( 'competition.rankings.name' ) }
115117 </ span >
116- < span className = "px-3 py-2.5 text-right font-bold" >
118+ < span className = "px-3 py-2.5 text-right font-bold whitespace-nowrap " >
117119 { resultType === 'single'
118120 ? t ( 'common.wca.resultType.single' )
119121 : t ( 'common.wca.resultType.average' ) } { ' ' }
@@ -122,42 +124,41 @@ export const PsychSheetEvent = () => {
122124 { t ( 'common.wca.recordType.WR' ) }
123125 </ span >
124126 </ div >
125- </ StickyBox >
126-
127- < div className = { classNames ( gridCss , 'striped' ) } >
128- { sortedPersons ?. map ( ( person ) => {
129- const rank =
130- ( rankings ?. findIndex ( ( i ) => i === person . pr ?. worldRanking ) >= 0
131- ? rankings ?. findIndex ( ( i ) => i === person . pr ?. worldRanking )
132- : rankings . length ) + 1 ;
133-
134- const prAverage = person . personalBests ?. find (
135- ( pr ) => pr . eventId === eventId && pr . type === 'average' ,
136- ) ;
137-
138- return (
139- < Link
140- key = { person . registrantId }
141- className = "contents"
142- to = { `/competitions/${ wcif ?. id } /personal-bests/${ person . wcaId } ` } >
143- < span className = "px-3 py-2.5 text-right flex items-center [font-variant-numeric:tabular-nums]" >
144- { rank }
145- </ span >
146- < span className = "px-3 py-2.5 text-left flex items-center w-full" >
147- { getUnicodeFlagIcon ( person . countryIso2 ) }
148- </ span >
149- < span className = "px-3 py-2.5 text-left truncate" > { person . name } </ span >
150- < span className = "px-3 py-2.5 text-right [font-variant-numeric:tabular-nums]" >
151- { prAverage ? renderResultByEventId ( eventId , 'average' , prAverage . best ) : '' }
152- </ span >
153- < span className = "px-3 py-2.5 text-right [font-variant-numeric:tabular-nums]" >
154- { prAverage
155- ? `${ prAverage . worldRanking . toLocaleString ( [ ...navigator . languages ] ) } `
156- : '' }
157- </ span >
158- </ Link >
159- ) ;
160- } ) }
127+ < div className = "contents striped" >
128+ { sortedPersons ?. map ( ( person ) => {
129+ const rank =
130+ ( rankings ?. findIndex ( ( i ) => i === person . pr ?. worldRanking ) >= 0
131+ ? rankings ?. findIndex ( ( i ) => i === person . pr ?. worldRanking )
132+ : rankings . length ) + 1 ;
133+
134+ const prAverage = person . personalBests ?. find (
135+ ( pr ) => pr . eventId === eventId && pr . type === 'average' ,
136+ ) ;
137+
138+ return (
139+ < Link
140+ key = { person . registrantId }
141+ className = "contents"
142+ to = { `/competitions/${ wcif ?. id } /personal-bests/${ person . wcaId } ` } >
143+ < span className = "px-3 py-2.5 text-right [font-variant-numeric:tabular-nums]" >
144+ { rank }
145+ </ span >
146+ < span className = "px-3 py-2.5 text-left flex items-center w-full" >
147+ { getUnicodeFlagIcon ( person . countryIso2 ) }
148+ </ span >
149+ < span className = "px-3 py-2.5 text-left truncate" > { person . name } </ span >
150+ < span className = "px-3 py-2.5 text-right [font-variant-numeric:tabular-nums]" >
151+ { prAverage ? renderResultByEventId ( eventId , 'average' , prAverage . best ) : '' }
152+ </ span >
153+ < span className = "px-3 py-2.5 text-right [font-variant-numeric:tabular-nums]" >
154+ { prAverage
155+ ? `${ prAverage . worldRanking . toLocaleString ( [ ...navigator . languages ] ) } `
156+ : '' }
157+ </ span >
158+ </ Link >
159+ ) ;
160+ } ) }
161+ </ div >
161162 </ div >
162163 </ div >
163164 </ Container >
0 commit comments