diff --git a/frontend/src/components/brackets/brackets.tsx b/frontend/src/components/brackets/brackets.tsx index 67ee33fb..b19170bd 100644 --- a/frontend/src/components/brackets/brackets.tsx +++ b/frontend/src/components/brackets/brackets.tsx @@ -1,6 +1,7 @@ import { Alert, Button, Container, Grid, Group, Skeleton } from '@mantine/core'; import { GoPlus } from '@react-icons/all-files/go/GoPlus'; import { IconAlertCircle } from '@tabler/icons-react'; +import { TFunction } from 'i18next'; import { useTranslation } from 'next-i18next'; import React from 'react'; import { SWRResponse } from 'swr'; @@ -16,6 +17,7 @@ import { responseIsValid } from '../utils/util'; import Round from './round'; function getRoundsGridCols( + t: TFunction<'translation', undefined>, stageItem: StageItemWithRounds, tournamentData: TournamentMinimal, swrStagesResponse: SWRResponse, @@ -23,7 +25,6 @@ function getRoundsGridCols( readOnly: boolean, displaySettings: BracketDisplaySettings ) { - const { t } = useTranslation(); let rounds: React.JSX.Element[] | React.JSX.Element = stageItem.rounds .sort((r1: any, r2: any) => (r1.name > r2.name ? 1 : -1)) .map((round: RoundInterface) => ( @@ -167,6 +168,8 @@ export default function Brackets({ selectedStageId: string | null; displaySettings: BracketDisplaySettings; }) { + const { t } = useTranslation(); + if (swrStagesResponse.isLoading) { return ; } @@ -191,6 +194,7 @@ export default function Brackets({ .sort((i1: StageItemWithRounds, i2: StageItemWithRounds) => (i1.name > i2.name ? 1 : -1)) .map((stageItem: StageItemWithRounds) => getRoundsGridCols( + t, stageItem, tournamentData, swrStagesResponse, diff --git a/frontend/src/components/tables/players.tsx b/frontend/src/components/tables/players.tsx index d598e793..02f24f4f 100644 --- a/frontend/src/components/tables/players.tsx +++ b/frontend/src/components/tables/players.tsx @@ -45,9 +45,9 @@ export default function PlayersTable({ const players: Player[] = swrPlayersResponse.data != null ? swrPlayersResponse.data.data : []; const tableState = getTableState('name'); - const minELOScore = Math.min(...players.map((player) => player.elo_score)); - const maxELOScore = Math.max(...players.map((player) => player.elo_score)); - const maxSwissScore = Math.max(...players.map((player) => player.swiss_score)); + const minELOScore = Math.min(...players.map((player) => Number(player.elo_score))); + const maxELOScore = Math.max(...players.map((player) => Number(player.elo_score))); + const maxSwissScore = Math.max(...players.map((player) => Number(player.swiss_score))); if (swrPlayersResponse.error) return ; @@ -73,7 +73,7 @@ export default function PlayersTable({ - {team.swiss_score.toFixed(1)} - {team.elo_score.toFixed(0)} + {Number(team.swiss_score).toFixed(1)} + {Number(team.elo_score).toFixed(0)} ({ value: `${p.id}`, label: p.name }))} - label={t('clubs_title')} + label={capitalize(t('clubs_title'))} placeholder={t('club_select_placeholder')} searchable limit={20}