Skip to content

Commit c520075

Browse files
authored
Use last hey api response types and stop using relative imports (#1482)
1 parent 016ce4d commit c520075

File tree

93 files changed

+628
-683
lines changed

Some content is hidden

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

93 files changed

+628
-683
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: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,17 +34,18 @@
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",
4041
"react-icons": "5.5.0",
4142
"react-qr-code": "2.0.12",
4243
"react-router": "7.11.0",
43-
"swr": "2.3.0"
44+
"swr": "2.3.0",
45+
"vite-tsconfig-paths": "^6.0.3"
4446
},
4547
"devDependencies": {
4648
"@hey-api/openapi-ts": "0.89.2",
47-
"@trivago/prettier-plugin-sort-imports": "6.0.0",
4849
"@types/node": "25.0.0",
4950
"@types/react": "19.2.4",
5051
"@types/react-dom": "19.2.3",

frontend/pnpm-lock.yaml

Lines changed: 59 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 (

0 commit comments

Comments
 (0)