Skip to content

Commit

Permalink
Fix standings page (#1023)
Browse files Browse the repository at this point in the history
  • Loading branch information
evroon authored Nov 23, 2024
1 parent b59e52d commit d6883ca
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 11 deletions.
29 changes: 19 additions & 10 deletions frontend/src/components/tables/standings.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,13 @@ export function StandingsTableForStageItem({
stageItem,
fontSizeInPixels,
stageItemsLookup,
maxTeamsToDisplay,
}: {
teams_with_inputs: StageItemInputFinal[];
stageItem: StageItemWithRounds;
fontSizeInPixels: number;
stageItemsLookup: any;
maxTeamsToDisplay: number;
}) {
const { t } = useTranslation();
const tableState = getTableState('points', false);
Expand All @@ -33,7 +35,7 @@ export function StandingsTableForStageItem({
.sort((p1: StageItemInputFinal, p2: StageItemInputFinal) =>
sortTableEntries(p1, p2, tableState)
)
.slice(0, 14)
.slice(0, maxTeamsToDisplay)
.map((team_with_input, index) => (
<Table.Tr key={team_with_input.id}>
<Table.Td style={{ width: '2rem' }}>{index + 1}</Table.Td>
Expand Down Expand Up @@ -80,17 +82,24 @@ export function StandingsTableForStageItem({
<ThSortable state={tableState} field="name">
{t('name_table_header')}
</ThSortable>
<ThSortable visibleFrom="sm" state={tableState} field="points">
{t('points_table_header')}
</ThSortable>
{stageItem.type === 'SWISS' ? (
<ThSortable state={tableState} field="elo_score">
{t('elo_score')}
</ThSortable>
<>
<ThSortable visibleFrom="sm" state={tableState} field="points">
{t('elo_score')}
</ThSortable>
<ThSortable state={tableState} field="elo_score">
{t('elo_score')}
</ThSortable>
</>
) : (
<ThNotSortable>
<WinDistributionTitle />
</ThNotSortable>
<>
<ThSortable visibleFrom="sm" state={tableState} field="points">
{t('points_table_header')}
</ThSortable>
<ThNotSortable>
<WinDistributionTitle />
</ThNotSortable>
</>
)}
</Table.Tr>
</Table.Thead>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ export default function Standings() {
<StandingsContent
swrStagesResponse={swrStagesResponse}
fontSizeInPixels={fontSizeInPixels}
maxTeamsToDisplay={14}
/>
</Grid.Col>
</Grid>
Expand Down
9 changes: 8 additions & 1 deletion frontend/src/pages/tournaments/[id]/dashboard/standings.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,11 @@ import { getTournamentResponseByEndpointName } from '../../../../services/tourna
export function StandingsContent({
swrStagesResponse,
fontSizeInPixels,
maxTeamsToDisplay,
}: {
swrStagesResponse: SWRResponse;
fontSizeInPixels: number;
maxTeamsToDisplay: number;
}) {
const { t } = useTranslation();

Expand All @@ -46,6 +48,7 @@ export function StandingsContent({
stageItem={stageItemsLookup[stageItemId]}
stageItemsLookup={stageItemsLookup}
fontSizeInPixels={fontSizeInPixels}
maxTeamsToDisplay={maxTeamsToDisplay}
/>
</div>
));
Expand Down Expand Up @@ -92,7 +95,11 @@ export default function Standings() {
<DoubleHeader tournamentData={tournamentDataFull} />
<Container mt="1rem" px="0rem">
<Container style={{ width: '100%' }} px="sm">
<StandingsContent swrStagesResponse={swrStagesResponse} fontSizeInPixels={16} />
<StandingsContent
swrStagesResponse={swrStagesResponse}
fontSizeInPixels={16}
maxTeamsToDisplay={100}
/>
</Container>
</Container>
<DashboardFooter />
Expand Down

0 comments on commit d6883ca

Please sign in to comment.