Skip to content

Commit 208e281

Browse files
committed
Use last hey api response types
1 parent 016ce4d commit 208e281

File tree

92 files changed

+577
-679
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

92 files changed

+577
-679
lines changed

frontend/.prettierrc.js

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,5 @@ module.exports = {
33
singleQuote: true,
44
trailingComma: "es5",
55
tabWidth: 2,
6-
importOrder: ["^@core/(.*)$", "^@server/(.*)$", "^@ui/(.*)$", "^[./]"],
7-
importOrderSeparation: true,
8-
importOrderSortSpecifiers: true,
9-
plugins: [require.resolve("@trivago/prettier-plugin-sort-imports")]
6+
plugins: ["prettier-plugin-organize-imports"]
107
};

frontend/openapi-ts.config.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { defineConfig } from '@hey-api/openapi-ts';
1+
import {defineConfig} from '@hey-api/openapi-ts';
22

33
export default defineConfig({
44
input: '../backend/openapi/openapi.json',

frontend/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@
3434
"dayjs": "1.11.10",
3535
"i18next": "25.7.1",
3636
"nuqs": "2.8.0",
37+
"prettier-plugin-organize-imports": "^4.3.0",
3738
"react": "19.2.0",
3839
"react-dom": "19.2.0",
3940
"react-i18next": "16.5.0",
@@ -44,7 +45,6 @@
4445
},
4546
"devDependencies": {
4647
"@hey-api/openapi-ts": "0.89.2",
47-
"@trivago/prettier-plugin-sort-imports": "6.0.0",
4848
"@types/node": "25.0.0",
4949
"@types/react": "19.2.4",
5050
"@types/react-dom": "19.2.3",

frontend/pnpm-lock.yaml

Lines changed: 18 additions & 58 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

frontend/src/components/brackets/brackets.tsx

Lines changed: 23 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -17,16 +17,20 @@ import { useTranslation } from 'react-i18next';
1717
import { MdOutlineAutoFixHigh } from 'react-icons/md';
1818
import { SWRResponse } from 'swr';
1919

20-
import { BracketDisplaySettings } from '../../interfaces/brackets';
21-
import { Round } from '../../interfaces/round';
22-
import { StageItemWithRounds } from '../../interfaces/stage_item';
23-
import { TournamentMinimal } from '../../interfaces/tournament';
24-
import { Tournament } from '../../openapi';
25-
import { createRound } from '../../services/round';
26-
import ActivateNextRoundModal from '../modals/activate_next_round_modal';
27-
import { NoContent } from '../no_content/empty_table_info';
28-
import { Translator } from '../utils/types';
29-
import { responseIsValid } from '../utils/util';
20+
import ActivateNextRoundModal from '@components/modals/activate_next_round_modal';
21+
import { NoContent } from '@components/no_content/empty_table_info';
22+
import { BracketDisplaySettings } from '@components/utils/brackets';
23+
import { TournamentMinimal } from '@components/utils/tournament';
24+
import { Translator } from '@components/utils/types';
25+
import { responseIsValid } from '@components/utils/util';
26+
import {
27+
RoundWithMatches,
28+
StageItemWithRounds,
29+
StagesWithStageItemsResponse,
30+
Tournament,
31+
UpcomingMatchesResponse,
32+
} from '@openapi';
33+
import { createRound } from '@services/round';
3034
import RoundComponent from './round';
3135

3236
function AddRoundButton({
@@ -40,8 +44,8 @@ function AddRoundButton({
4044
t: Translator;
4145
tournamentData: TournamentMinimal;
4246
stageItem: StageItemWithRounds;
43-
swrStagesResponse: SWRResponse;
44-
swrUpcomingMatchesResponse: SWRResponse;
47+
swrStagesResponse: SWRResponse<StagesWithStageItemsResponse>;
48+
swrUpcomingMatchesResponse: SWRResponse<UpcomingMatchesResponse>;
4549
size: 'md' | 'lg';
4650
}) {
4751
return (
@@ -71,8 +75,8 @@ export function RoundsGridCols({
7175
}: {
7276
stageItem: StageItemWithRounds;
7377
tournamentData: Tournament;
74-
swrStagesResponse: SWRResponse;
75-
swrUpcomingMatchesResponse: SWRResponse;
78+
swrStagesResponse: SWRResponse<StagesWithStageItemsResponse>;
79+
swrUpcomingMatchesResponse: SWRResponse<UpcomingMatchesResponse>;
7680
readOnly: boolean;
7781
displaySettings: BracketDisplaySettings;
7882
}) {
@@ -87,8 +91,11 @@ export function RoundsGridCols({
8791

8892
let result: React.JSX.Element[] | React.JSX.Element = stageItem.rounds
8993
.sort((r1: any, r2: any) => (r1.name > r2.name ? 1 : -1))
90-
.filter((round: Round) => round.matches.length > 0 || displaySettings.matchVisibility === 'all')
91-
.map((round: Round) => (
94+
.filter(
95+
(round: RoundWithMatches) =>
96+
round.matches.length > 0 || displaySettings.matchVisibility === 'all'
97+
)
98+
.map((round: RoundWithMatches) => (
9299
<RoundComponent
93100
key={round.id}
94101
tournamentData={tournamentData}

frontend/src/components/brackets/courts.tsx

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,14 @@
11
import { Grid, Title } from '@mantine/core';
2-
import React from 'react';
32
import { SWRResponse } from 'swr';
43

5-
import { Round } from '../../interfaces/round';
6-
import { TournamentMinimal } from '../../interfaces/tournament';
7-
import { getStages } from '../../services/adapter';
4+
import { TournamentMinimal } from '@components/utils/tournament';
5+
import { RoundWithMatches } from '@openapi';
6+
import { getStages } from '@services/adapter';
87
import Match from './match';
98

109
function getRoundsGridCols(
1110
swrStagesResponse: SWRResponse,
12-
activeRound: Round,
11+
activeRound: RoundWithMatches,
1312
tournamentData: TournamentMinimal
1413
) {
1514
return activeRound.matches
@@ -36,7 +35,7 @@ export default function Courts({
3635
activeRound,
3736
}: {
3837
tournamentData: TournamentMinimal;
39-
activeRound: Round;
38+
activeRound: RoundWithMatches;
4039
}) {
4140
const swrStagesResponse = getStages(tournamentData.id);
4241
return (

frontend/src/components/brackets/courts_large.tsx

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
import { Center, Grid, MantineColor, useMantineTheme } from '@mantine/core';
2-
import React from 'react';
32

4-
import { MatchInterface } from '../../interfaces/match';
5-
import { Court } from '../../openapi';
3+
import { Court, MatchWithDetails } from '@openapi';
64
import MatchLarge from './match_large';
75

86
export function CourtBadge({ name, color }: { name: string; color: MantineColor }) {
@@ -30,8 +28,8 @@ export default function CourtsLarge({
3028
stageItemsLookup,
3129
}: {
3230
court: Court;
33-
activeMatch: MatchInterface | null;
34-
nextMatch: MatchInterface | null;
31+
activeMatch: MatchWithDetails | null;
32+
nextMatch: MatchWithDetails | null;
3533
stageItemsLookup: any;
3634
}) {
3735
return (

frontend/src/components/brackets/match.tsx

Lines changed: 12 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,19 @@
11
import { Center, Grid, UnstyledButton, useMantineTheme } from '@mantine/core';
22
import { useColorScheme } from '@mantine/hooks';
3-
import React, { useState } from 'react';
3+
import { useState } from 'react';
44
import { useTranslation } from 'react-i18next';
55
import { SWRResponse } from 'swr';
66

7-
import {
8-
MatchInterface,
9-
formatMatchInput1,
10-
formatMatchInput2,
11-
isMatchHappening,
12-
} from '../../interfaces/match';
13-
import { Round } from '../../interfaces/round';
14-
import { TournamentMinimal } from '../../interfaces/tournament';
15-
import { getMatchLookup, getStageItemLookup } from '../../services/lookups';
16-
import MatchModal from '../modals/match_modal';
17-
import { assert_not_none } from '../utils/assert';
18-
import { Time } from '../utils/datetime';
7+
import MatchModal from '@components/modals/match_modal';
8+
import { assert_not_none } from '@components/utils/assert';
9+
import { Time } from '@components/utils/datetime';
10+
import { formatMatchInput1, formatMatchInput2, isMatchHappening } from '@components/utils/match';
11+
import { TournamentMinimal } from '@components/utils/tournament';
12+
import { MatchWithDetails, RoundWithMatches, StagesWithStageItemsResponse } from '@openapi';
13+
import { getMatchLookup, getStageItemLookup } from '@services/lookups';
1914
import classes from './match.module.css';
2015

21-
export function MatchBadge({ match, theme }: { match: MatchInterface; theme: any }) {
16+
export function MatchBadge({ match, theme }: { match: MatchWithDetails; theme: any }) {
2217
const visibility = match.court ? 'visible' : 'hidden';
2318
const badgeColor = useColorScheme() ? theme.colors.blue[7] : theme.colors.blue[7];
2419
return (
@@ -50,13 +45,13 @@ export default function Match({
5045
readOnly,
5146
round,
5247
}: {
53-
swrStagesResponse: SWRResponse;
48+
swrStagesResponse: SWRResponse<StagesWithStageItemsResponse>;
5449
swrUpcomingMatchesResponse: SWRResponse | null;
5550
tournamentData: TournamentMinimal;
56-
match: MatchInterface;
51+
match: MatchWithDetails;
5752
readOnly: boolean;
5853

59-
round: Round;
54+
round: RoundWithMatches;
6055
}) {
6156
const { t } = useTranslation();
6257
const theme = useMantineTheme();

frontend/src/components/brackets/match_large.tsx

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,14 @@
11
import { Card, Center, Grid, Text } from '@mantine/core';
2-
import React from 'react';
32

4-
import { MatchInterface } from '../../interfaces/match';
5-
import { formatStageItemInput } from '../../interfaces/stage_item_input';
6-
import { Time } from '../utils/datetime';
3+
import { Time } from '@components/utils/datetime';
4+
import { formatStageItemInput } from '@components/utils/stage_item_input';
5+
import { MatchWithDetails } from '@openapi';
76

87
export default function MatchLarge({
98
match,
109
stageItemsLookup,
1110
}: {
12-
match: MatchInterface;
11+
match: MatchWithDetails;
1312
stageItemsLookup: any;
1413
}) {
1514
const bracket = (

0 commit comments

Comments
 (0)