Fix frontend code style

This commit is contained in:
Erik Vroon
2024-03-04 14:37:46 +01:00
parent 388226103f
commit 53bc71ddf6
5 changed files with 42 additions and 10 deletions

View File

@@ -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({
/>
<Fieldset legend={t('logo_settings_title')} mt={12} radius="md">
<DropzoneButton tournamentId={tournament_id} teamId={team.id} swrResponse={swrTeamsResponse} variant="team" />
<DropzoneButton
tournamentId={tournament_id}
teamId={team.id}
swrResponse={swrTeamsResponse}
variant="team"
/>
<Center my="lg">
<div style={{ width: '50%' }}>
<TeamLogo team={team} />

View File

@@ -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 <Image radius="md" src={`${getBaseApiUrl()}/static/tournament-logos/${tournament.logo_path}`} />;
return (
<Image radius="md" src={`${getBaseApiUrl()}/static/tournament-logos/${tournament.logo_path}`} />
);
}
function GeneralTournamentForm({

View File

@@ -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,

View File

@@ -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 <Image radius="md" src={`${getBaseApiUrl()}/static/tournament-logos/${tournament.logo_path}`} />;
return (
<Image radius="md" src={`${getBaseApiUrl()}/static/tournament-logos/${tournament.logo_path}`} />
);
}
function GeneralTournamentForm({
@@ -163,7 +170,11 @@ function GeneralTournamentForm({
{...form.getInputProps('dashboard_public', { type: 'checkbox' })}
/>
<DropzoneButton tournamentId={tournament.id} swrResponse={swrTournamentResponse} variant="tournament" />
<DropzoneButton
tournamentId={tournament.id}
swrResponse={swrTournamentResponse}
variant="tournament"
/>
<Center my="lg">
<div style={{ width: '50%' }}>
<TournamentLogo tournament={tournament} />

View File

@@ -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';