From 53bc71ddf663e6077cbbf4830c41d9305a686e90 Mon Sep 17 00:00:00 2001 From: Erik Vroon Date: Mon, 4 Mar 2024 14:37:46 +0100 Subject: [PATCH] Fix frontend code style --- .../components/modals/team_update_modal.tsx | 25 ++++++++++++++++--- .../components/modals/tournament_modal.tsx | 4 ++- frontend/src/components/utils/file_upload.tsx | 4 +-- .../src/pages/tournaments/[id]/settings.tsx | 17 ++++++++++--- frontend/src/services/adapter.tsx | 2 +- 5 files changed, 42 insertions(+), 10 deletions(-) diff --git a/frontend/src/components/modals/team_update_modal.tsx b/frontend/src/components/modals/team_update_modal.tsx index 05a0b8bd..82c975b0 100644 --- a/frontend/src/components/modals/team_update_modal.tsx +++ b/frontend/src/components/modals/team_update_modal.tsx @@ -1,4 +1,13 @@ -import { Button, Center, Checkbox, Fieldset, Modal, MultiSelect, TextInput, Image } from '@mantine/core'; +import { + Button, + Center, + Checkbox, + Fieldset, + Image, + Modal, + MultiSelect, + TextInput, +} from '@mantine/core'; import { useForm } from '@mantine/form'; import { BiEditAlt } from '@react-icons/all-files/bi/BiEditAlt'; import { useTranslation } from 'next-i18next'; @@ -7,7 +16,12 @@ import { SWRResponse } from 'swr'; import { Player } from '../../interfaces/player'; import { TeamInterface } from '../../interfaces/team'; -import { getBaseApiUrl, getPlayers, removeTeamLogo, requestSucceeded } from '../../services/adapter'; +import { + getBaseApiUrl, + getPlayers, + removeTeamLogo, + requestSucceeded, +} from '../../services/adapter'; import { updateTeam } from '../../services/team'; import { DropzoneButton } from '../utils/file_upload'; @@ -85,7 +99,12 @@ export default function TeamUpdateModal({ />
- +
diff --git a/frontend/src/components/modals/tournament_modal.tsx b/frontend/src/components/modals/tournament_modal.tsx index a392b67a..346b14de 100644 --- a/frontend/src/components/modals/tournament_modal.tsx +++ b/frontend/src/components/modals/tournament_modal.tsx @@ -25,7 +25,9 @@ import SaveButton from '../buttons/save'; export function TournamentLogo({ tournament }: { tournament: Tournament | null }) { if (tournament == null || tournament.logo_path == null) return null; - return ; + return ( + + ); } function GeneralTournamentForm({ diff --git a/frontend/src/components/utils/file_upload.tsx b/frontend/src/components/utils/file_upload.tsx index 0eb9654e..39c5c1c7 100644 --- a/frontend/src/components/utils/file_upload.tsx +++ b/frontend/src/components/utils/file_upload.tsx @@ -1,14 +1,14 @@ import { Group, Text } from '@mantine/core'; import { Dropzone, MIME_TYPES } from '@mantine/dropzone'; import { IconCloudUpload, IconDownload, IconX } from '@tabler/icons-react'; +import { AxiosError } from 'axios'; import { useTranslation } from 'next-i18next'; import { useMemo, useRef } from 'react'; import { SWRResponse } from 'swr'; -import { AxiosError } from 'axios'; +import { TeamInterface } from '../../interfaces/team'; import { Tournament } from '../../interfaces/tournament'; import { handleRequestError, uploadTeamLogo, uploadTournamentLogo } from '../../services/adapter'; -import { TeamInterface } from '../../interfaces/team'; export function DropzoneButton({ tournamentId, diff --git a/frontend/src/pages/tournaments/[id]/settings.tsx b/frontend/src/pages/tournaments/[id]/settings.tsx index 3ae28306..28a48db6 100644 --- a/frontend/src/pages/tournaments/[id]/settings.tsx +++ b/frontend/src/pages/tournaments/[id]/settings.tsx @@ -27,13 +27,20 @@ import { GenericSkeleton } from '../../../components/utils/skeletons'; import { capitalize, getBaseURL, getTournamentIdFromRouter } from '../../../components/utils/util'; import { Club } from '../../../interfaces/club'; import { Tournament, getTournamentEndpoint } from '../../../interfaces/tournament'; -import { getBaseApiUrl, getClubs, getTournamentById, removeTournamentLogo } from '../../../services/adapter'; +import { + getBaseApiUrl, + getClubs, + getTournamentById, + removeTournamentLogo, +} from '../../../services/adapter'; import { updateTournament } from '../../../services/tournament'; import TournamentLayout from '../_tournament_layout'; export function TournamentLogo({ tournament }: { tournament: Tournament | null }) { if (tournament == null || tournament.logo_path == null) return null; - return ; + return ( + + ); } function GeneralTournamentForm({ @@ -163,7 +170,11 @@ function GeneralTournamentForm({ {...form.getInputProps('dashboard_public', { type: 'checkbox' })} /> - +
diff --git a/frontend/src/services/adapter.tsx b/frontend/src/services/adapter.tsx index ad87f337..0bd90320 100644 --- a/frontend/src/services/adapter.tsx +++ b/frontend/src/services/adapter.tsx @@ -1,9 +1,9 @@ import { showNotification } from '@mantine/notifications'; import { AxiosError, AxiosInstance, AxiosResponse } from 'axios'; +import type Axios from 'axios'; import { useRouter } from 'next/router'; import useSWR, { SWRResponse } from 'swr'; -import type Axios from 'axios'; import { Pagination } from '../components/utils/util'; import { SchedulerSettings } from '../interfaces/match'; import { getLogin, performLogout, tokenPresent } from './local_storage';