@@ -32,7 +32,6 @@ function PlayersRankingPanel({ playersCount, ranking }) {
3232 const currentUserClanId = useSelector ( currentUserClanIdSelector ) ;
3333 const currentUserId = useSelector ( currentUserIdSelector ) ;
3434 const requestedNearestPage = useRef ( false ) ;
35- const requestedFirstPage = useRef ( false ) ;
3635 const manualPageChange = useRef ( false ) ;
3736
3837 const rankingItems = useMemo ( ( ) => ranking ?. entries || [ ] , [ ranking ?. entries ] ) ;
@@ -85,12 +84,11 @@ function PlayersRankingPanel({ playersCount, ranking }) {
8584 } , [ effectivePageNumber , isServerPaged , totalPages ] ) ;
8685
8786 useEffect ( ( ) => {
88- if ( requestedFirstPage . current || manualPageChange . current ) {
87+ if ( manualPageChange . current ) {
8988 return ;
9089 }
9190
9291 if ( rankingItems . length === 0 && playersCount > 0 ) {
93- requestedFirstPage . current = true ;
9492 dispatch ( requestRankingPage ( 1 , effectivePageSize ) ) ;
9593 }
9694 } , [ dispatch , effectivePageSize , playersCount , rankingItems . length ] ) ;
@@ -136,96 +134,94 @@ function PlayersRankingPanel({ playersCount, ranking }) {
136134 { playersCount === 0 ? (
137135 < p className = "text-nowrap text-muted" > { i18next . t ( "No players yet" ) } .</ p >
138136 ) : (
139- rankingItems . length !== 0 && (
140- < div
141- className = { cn (
142- "d-flex flex-column flex-grow-1 postion-relative py-2 mh-100 rounded-left" ,
143- ) }
144- >
145- < div className = "d-flex justify-content-between border-bottom cb-border-color pb-2 px-3" >
146- < span className = "font-weight-bold" > { i18next . t ( "Ranking" ) } </ span >
147- < span className = "text-muted small" >
148- { i18next . t ( "Page" ) } { effectivePageNumber } { i18next . t ( "of" ) } { totalPages }
149- </ span >
150- </ div >
151- < div className = "d-flex cb-overflow-x-auto" >
152- < table className = "table cb-text-light table-striped cb-custom-event-table m-1" >
153- < colgroup >
154- < col style = { { width : "12%" } } />
155- < col style = { { width : "40%" } } />
156- < col style = { { width : "30%" } } />
157- < col style = { { width : "18%" } } />
158- </ colgroup >
159- < thead >
160- < tr >
161- < th className = "p-1 pl-4 font-weight-light border-0" > { i18next . t ( "Place" ) } </ th >
162- < th className = "p-1 pl-4 font-weight-light border-0" > { i18next . t ( "Player" ) } </ th >
163- < th className = "p-1 pl-4 font-weight-light border-0" > { i18next . t ( "Clan" ) } </ th >
164- < th className = "p-1 pl-4 font-weight-light border-0" > { i18next . t ( "Score" ) } </ th >
165- </ tr >
166- </ thead >
167- < tbody >
168- { pagedRankingItems . map ( ( item ) => (
169- < React . Fragment key = { item . id } >
170- < tr className = "cb-custom-event-empty-space-tr" />
171- < tr className = { getCustomEventTrClassName ( item , currentUserClanId ) } >
172- < td
137+ < div
138+ className = { cn (
139+ "d-flex flex-column flex-grow-1 postion-relative py-2 mh-100 rounded-left" ,
140+ ) }
141+ >
142+ < div className = "d-flex justify-content-between border-bottom cb-border-color pb-2 px-3" >
143+ < span className = "font-weight-bold" > { i18next . t ( "Ranking" ) } </ span >
144+ < span className = "text-muted small" >
145+ { i18next . t ( "Page" ) } { effectivePageNumber } { i18next . t ( "of" ) } { totalPages }
146+ </ span >
147+ </ div >
148+ < div className = "d-flex cb-overflow-x-auto" >
149+ < table className = "table cb-text-light table-striped cb-custom-event-table m-1" >
150+ < colgroup >
151+ < col style = { { width : "12%" } } />
152+ < col style = { { width : "40%" } } />
153+ < col style = { { width : "30%" } } />
154+ < col style = { { width : "18%" } } />
155+ </ colgroup >
156+ < thead >
157+ < tr >
158+ < th className = "p-1 pl-4 font-weight-light border-0" > { i18next . t ( "Place" ) } </ th >
159+ < th className = "p-1 pl-4 font-weight-light border-0" > { i18next . t ( "Player" ) } </ th >
160+ < th className = "p-1 pl-4 font-weight-light border-0" > { i18next . t ( "Clan" ) } </ th >
161+ < th className = "p-1 pl-4 font-weight-light border-0" > { i18next . t ( "Score" ) } </ th >
162+ </ tr >
163+ </ thead >
164+ < tbody >
165+ { pagedRankingItems . map ( ( item ) => (
166+ < React . Fragment key = { item . id } >
167+ < tr className = "cb-custom-event-empty-space-tr" />
168+ < tr className = { getCustomEventTrClassName ( item , currentUserClanId ) } >
169+ < td
170+ style = { {
171+ borderTopLeftRadius : "0.5rem" ,
172+ borderBottomLeftRadius : "0.5rem" ,
173+ } }
174+ className = { tableDataCellClassName }
175+ >
176+ { item . place }
177+ </ td >
178+ < td className = { tableDataCellClassName } >
179+ < div
180+ title = { item ?. name }
181+ className = "cb-custom-event-name"
173182 style = { {
174- borderTopLeftRadius : "0.5rem" ,
175- borderBottomLeftRadius : "0.5rem" ,
183+ textOverflow : "ellipsis" ,
184+ overflow : "hidden" ,
185+ whiteSpace : "nowrap" ,
186+ maxWidth : "20ch" ,
176187 } }
177- className = { tableDataCellClassName }
178188 >
179- { item . place }
180- </ td >
181- < td className = { tableDataCellClassName } >
182- < div
183- title = { item ?. name }
184- className = "cb-custom-event-name"
185- style = { {
186- textOverflow : "ellipsis" ,
187- overflow : "hidden" ,
188- whiteSpace : "nowrap" ,
189- maxWidth : "20ch" ,
190- } }
191- >
192- { item ?. lang && < LanguageIcon className = "mr-1" lang = { item . lang } /> }
193- { ( item ?. name ?? "" ) . slice ( 0 , 10 ) +
194- ( ( item ?. name ?. length ?? 0 ) > 10 ? ".." : "" ) }
195- </ div >
196- </ td >
197- < td className = { tableDataCellClassName } >
198- < div
199- title = { item ?. clan }
200- className = "cb-custom-event-name"
201- style = { {
202- textOverflow : "ellipsis" ,
203- overflow : "hidden" ,
204- whiteSpace : "nowrap" ,
205- maxWidth : "20ch" ,
206- } }
207- >
208- { ( item ?. clan ?? "" ) . slice ( 0 , 10 ) +
209- ( ( item ?. clan ?. length ?? 0 ) > 10 ? "..." : "" ) }
210- </ div >
211- </ td >
212- < td className = { tableDataCellClassName } > { item . score } </ td >
213- < td
189+ { item ?. lang && < LanguageIcon className = "mr-1" lang = { item . lang } /> }
190+ { ( item ?. name ?? "" ) . slice ( 0 , 10 ) +
191+ ( ( item ?. name ?. length ?? 0 ) > 10 ? ".." : "" ) }
192+ </ div >
193+ </ td >
194+ < td className = { tableDataCellClassName } >
195+ < div
196+ title = { item ?. clan }
197+ className = "cb-custom-event-name"
214198 style = { {
215- borderTopRightRadius : "0.5rem" ,
216- borderBottomRightRadius : "0.5rem" ,
199+ textOverflow : "ellipsis" ,
200+ overflow : "hidden" ,
201+ whiteSpace : "nowrap" ,
202+ maxWidth : "20ch" ,
217203 } }
218- className = { tableDataCellClassName }
219- aria-label = { i18next . t ( "Row spacer" ) }
220- />
221- </ tr >
222- </ React . Fragment >
223- ) ) }
224- </ tbody >
225- </ table >
226- </ div >
204+ >
205+ { ( item ?. clan ?? "" ) . slice ( 0 , 10 ) +
206+ ( ( item ?. clan ?. length ?? 0 ) > 10 ? "..." : "" ) }
207+ </ div >
208+ </ td >
209+ < td className = { tableDataCellClassName } > { item . score } </ td >
210+ < td
211+ style = { {
212+ borderTopRightRadius : "0.5rem" ,
213+ borderBottomRightRadius : "0.5rem" ,
214+ } }
215+ className = { tableDataCellClassName }
216+ aria-label = { i18next . t ( "Row spacer" ) }
217+ />
218+ </ tr >
219+ </ React . Fragment >
220+ ) ) }
221+ </ tbody >
222+ </ table >
227223 </ div >
228- )
224+ </ div >
229225 ) }
230226 </ div >
231227 < div className = "d-flex align-items-center flex-wrap justify-content-start" >
0 commit comments