Skip to content

Commit ffaeb87

Browse files
authored
Use hey api more (#1480)
1 parent a548ff6 commit ffaeb87

Some content is hidden

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

48 files changed

+134
-186
lines changed

frontend/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@
1010
"start": "vite start",
1111
"typecheck": "tsc",
1212
"export": "vite build && vite export",
13-
"prettier:check": "prettier --check \"**/*.{ts,tsx}\"",
14-
"prettier:write": "prettier --write \"**/*.{ts,tsx}\"",
13+
"prettier:check": "prettier --list-different --check \"**/*.{ts,tsx}\"",
14+
"prettier:write": "prettier --list-different --write \"**/*.{ts,tsx}\"",
1515
"test": "tsc && pnpm run prettier:write"
1616
},
1717
"dependencies": {

frontend/src/components/brackets/brackets.tsx

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -18,15 +18,16 @@ import { MdOutlineAutoFixHigh } from 'react-icons/md';
1818
import { SWRResponse } from 'swr';
1919

2020
import { BracketDisplaySettings } from '../../interfaces/brackets';
21-
import { RoundInterface } from '../../interfaces/round';
21+
import { Round } from '../../interfaces/round';
2222
import { StageItemWithRounds } from '../../interfaces/stage_item';
23-
import { Tournament, TournamentMinimal } from '../../interfaces/tournament';
23+
import { TournamentMinimal } from '../../interfaces/tournament';
24+
import { Tournament } from '../../openapi';
2425
import { createRound } from '../../services/round';
2526
import ActivateNextRoundModal from '../modals/activate_next_round_modal';
2627
import { NoContent } from '../no_content/empty_table_info';
2728
import { Translator } from '../utils/types';
2829
import { responseIsValid } from '../utils/util';
29-
import Round from './round';
30+
import RoundComponent from './round';
3031

3132
function AddRoundButton({
3233
t,
@@ -86,12 +87,9 @@ export function RoundsGridCols({
8687

8788
let result: React.JSX.Element[] | React.JSX.Element = stageItem.rounds
8889
.sort((r1: any, r2: any) => (r1.name > r2.name ? 1 : -1))
89-
.filter(
90-
(round: RoundInterface) =>
91-
round.matches.length > 0 || displaySettings.matchVisibility === 'all'
92-
)
93-
.map((round: RoundInterface) => (
94-
<Round
90+
.filter((round: Round) => round.matches.length > 0 || displaySettings.matchVisibility === 'all')
91+
.map((round: Round) => (
92+
<RoundComponent
9593
key={round.id}
9694
tournamentData={tournamentData}
9795
round={round}

frontend/src/components/brackets/courts.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,14 @@ import { Grid, Title } from '@mantine/core';
22
import React from 'react';
33
import { SWRResponse } from 'swr';
44

5-
import { RoundInterface } from '../../interfaces/round';
5+
import { Round } from '../../interfaces/round';
66
import { TournamentMinimal } from '../../interfaces/tournament';
77
import { getStages } from '../../services/adapter';
88
import Match from './match';
99

1010
function getRoundsGridCols(
1111
swrStagesResponse: SWRResponse,
12-
activeRound: RoundInterface,
12+
activeRound: Round,
1313
tournamentData: TournamentMinimal
1414
) {
1515
return activeRound.matches
@@ -36,7 +36,7 @@ export default function Courts({
3636
activeRound,
3737
}: {
3838
tournamentData: TournamentMinimal;
39-
activeRound: RoundInterface;
39+
activeRound: Round;
4040
}) {
4141
const swrStagesResponse = getStages(tournamentData.id);
4242
return (

frontend/src/components/brackets/match.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import {
1010
formatMatchInput2,
1111
isMatchHappening,
1212
} from '../../interfaces/match';
13-
import { RoundInterface } from '../../interfaces/round';
13+
import { Round } from '../../interfaces/round';
1414
import { TournamentMinimal } from '../../interfaces/tournament';
1515
import { getMatchLookup, getStageItemLookup } from '../../services/lookups';
1616
import MatchModal from '../modals/match_modal';
@@ -56,7 +56,7 @@ export default function Match({
5656
match: MatchInterface;
5757
readOnly: boolean;
5858

59-
round: RoundInterface;
59+
round: Round;
6060
}) {
6161
const { t } = useTranslation();
6262
const theme = useMantineTheme();

frontend/src/components/brackets/round.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,12 @@ import {
88
isMatchHappening,
99
isMatchInTheFutureOrPresent,
1010
} from '../../interfaces/match';
11-
import { RoundInterface } from '../../interfaces/round';
11+
import { Round } from '../../interfaces/round';
1212
import { TournamentMinimal } from '../../interfaces/tournament';
1313
import RoundModal from '../modals/round_modal';
1414
import Match from './match';
1515

16-
export default function Round({
16+
export default function RoundComponent({
1717
tournamentData,
1818
round,
1919
swrStagesResponse,
@@ -22,7 +22,7 @@ export default function Round({
2222
displaySettings,
2323
}: {
2424
tournamentData: TournamentMinimal;
25-
round: RoundInterface;
25+
round: Round;
2626
swrStagesResponse: SWRResponse;
2727
swrUpcomingMatchesResponse: SWRResponse | null;
2828
readOnly: boolean;

frontend/src/components/builder/builder.tsx

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ import { useTranslation } from 'react-i18next';
2222
import { BiSolidWrench } from 'react-icons/bi';
2323
import { SWRResponse } from 'swr';
2424

25-
import { Ranking } from '../../interfaces/ranking';
2625
import { StageWithStageItems } from '../../interfaces/stage';
2726
import { StageItemWithRounds } from '../../interfaces/stage_item';
2827
import {
@@ -31,7 +30,7 @@ import {
3130
StageItemInputOption,
3231
formatStageItemInputTentative,
3332
} from '../../interfaces/stage_item_input';
34-
import { Tournament } from '../../interfaces/tournament';
33+
import { Ranking, StageItemInputOptionsResponse, Tournament } from '../../openapi';
3534
import { getStageItemLookup, getTeamsLookup } from '../../services/lookups';
3635
import { deleteStage } from '../../services/stage';
3736
import { deleteStageItem } from '../../services/stage_item';
@@ -469,7 +468,7 @@ export default function Builder({
469468
}: {
470469
tournament: Tournament;
471470
swrStagesResponse: SWRResponse;
472-
swrAvailableInputsResponse: SWRResponse;
471+
swrAvailableInputsResponse: SWRResponse<StageItemInputOptionsResponse>;
473472
swrRankingsPerStageItemResponse: SWRResponse;
474473
rankings: Ranking[];
475474
}) {

frontend/src/components/buttons/create_stage.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import React from 'react';
44
import { useTranslation } from 'react-i18next';
55
import { SWRResponse } from 'swr';
66

7-
import { Tournament } from '../../interfaces/tournament';
7+
import { Tournament } from '../../openapi';
88
import { createStage } from '../../services/stage';
99

1010
export default function CreateStageButton({

frontend/src/components/card_tables/tournaments.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import React from 'react';
33
import { useTranslation } from 'react-i18next';
44
import { SWRResponse } from 'swr';
55

6-
import { Tournament } from '../../interfaces/tournament';
6+
import { Tournament } from '../../openapi';
77
import { getBaseApiUrl } from '../../services/adapter';
88
import { EmptyTableInfo } from '../no_content/empty_table_info';
99
import { DateTime } from '../utils/datetime';

frontend/src/components/dashboard/layout.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ import React from 'react';
1212
import QRCode from 'react-qr-code';
1313
import { useLocation, useNavigate } from 'react-router';
1414

15-
import { Tournament } from '../../interfaces/tournament';
15+
import { Tournament } from '../../openapi';
1616
import { getBaseApiUrl } from '../../services/adapter';
1717
import PreloadLink from '../utils/link';
1818
import { getBaseURL } from '../utils/util';
@@ -77,7 +77,7 @@ export function TournamentTitle({ tournamentDataFull }: { tournamentDataFull: To
7777

7878
export function DoubleHeader({ tournamentData }: { tournamentData: Tournament }) {
7979
const navigate = useLocation();
80-
const endpoint = tournamentData.dashboard_endpoint;
80+
const endpoint = tournamentData.dashboard_endpoint || '';
8181
const pathName = navigate.pathname.replace('[id]', endpoint).replace(/\/+$/, '');
8282

8383
const mainLinks = [

frontend/src/components/forms/user.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,12 @@ import { IconHash, IconLogout, IconUser } from '@tabler/icons-react';
55
import React from 'react';
66
import { useNavigate } from 'react-router';
77

8-
import { UserInterface } from '../../interfaces/user';
8+
import { UserPublic } from '../../openapi';
99
import { performLogoutAndRedirect } from '../../services/local_storage';
1010
import { updatePassword, updateUser } from '../../services/user';
1111
import { PasswordStrength } from '../utils/password';
1212

13-
export default function UserForm({ user, t, i18n }: { user: UserInterface; t: any; i18n: any }) {
13+
export default function UserForm({ user, t, i18n }: { user: UserPublic; t: any; i18n: any }) {
1414
const navigate = useNavigate();
1515
const details_form = useForm({
1616
initialValues: {

0 commit comments

Comments
 (0)