various improvements, edit tournament, etc
This commit is contained in:
@@ -13,7 +13,7 @@ import { DefaultCatchBoundary } from '@/components/DefaultCatchBoundary'
|
||||
import { type QueryClient } from '@tanstack/react-query'
|
||||
import { ensureSuperTokensFrontend } from '@/lib/supertokens/client'
|
||||
import { AuthContextType, authQueryConfig } from '@/contexts/auth-context'
|
||||
import Providers from '@/components/providers'
|
||||
import Providers from '@/features/core/components/providers'
|
||||
import { ColorSchemeScript, mantineHtmlProps } from '@mantine/core';
|
||||
import { HeaderConfig } from '@/features/core/types/header-config';
|
||||
|
||||
|
||||
33
src/app/routes/_authed/admin/tournaments/$id.tsx
Normal file
33
src/app/routes/_authed/admin/tournaments/$id.tsx
Normal file
@@ -0,0 +1,33 @@
|
||||
import { createFileRoute } from '@tanstack/react-router'
|
||||
import { tournamentQueries } from '@/features/tournaments/queries'
|
||||
import { useQuery } from '@tanstack/react-query'
|
||||
import { useAuth } from '@/contexts/auth-context'
|
||||
import EditTournament from '@/features/admin/components/edit-tournament'
|
||||
import Page from '@/components/page'
|
||||
import { Loader } from '@mantine/core'
|
||||
|
||||
export const Route = createFileRoute('/_authed/admin/tournaments/$id')({
|
||||
beforeLoad: async ({ context, params }) => {
|
||||
const { queryClient } = context;
|
||||
await queryClient.ensureQueryData(tournamentQueries.details(params.id))
|
||||
},
|
||||
loader: () => ({
|
||||
header: {
|
||||
withBackButton: true,
|
||||
title: 'Edit Tournament',
|
||||
},
|
||||
}),
|
||||
component: RouteComponent,
|
||||
})
|
||||
|
||||
function RouteComponent() {
|
||||
const { id } = Route.useParams()
|
||||
const { data: tournament } = useQuery(tournamentQueries.details(id))
|
||||
if (!tournament) throw new Error("Tournament not found.")
|
||||
|
||||
return (
|
||||
<Page>
|
||||
<EditTournament tournament={tournament} />
|
||||
</Page>
|
||||
)
|
||||
}
|
||||
@@ -2,11 +2,14 @@ import { createFileRoute } from '@tanstack/react-router'
|
||||
import { tournamentQueries } from '@/features/tournaments/queries';
|
||||
import Page from '@/components/page'
|
||||
import { useQuery } from '@tanstack/react-query';
|
||||
import { Box, Button } from '@mantine/core';
|
||||
import { Box, Group, Title } from '@mantine/core';
|
||||
import { useSheet } from '@/hooks/use-sheet';
|
||||
import Sheet from '@/components/sheet/sheet';
|
||||
import { Tournament } from '@/features/tournaments/types';
|
||||
import TeamList from '@/features/teams/components/team-list';
|
||||
import Button from '@/components/button';
|
||||
import Avatar from '@/components/avatar';
|
||||
import Profile from '@/features/tournaments/components/profile';
|
||||
|
||||
export const Route = createFileRoute('/_authed/tournaments/$tournamentId')({
|
||||
beforeLoad: async ({ context, params }) => {
|
||||
@@ -28,28 +31,8 @@ export const Route = createFileRoute('/_authed/tournaments/$tournamentId')({
|
||||
|
||||
function RouteComponent() {
|
||||
const { data: tournament } = useQuery(tournamentQueries.details(Route.useParams().tournamentId));
|
||||
|
||||
const sheet = useSheet()
|
||||
|
||||
return <Page noPadding>
|
||||
<Box mt='xl' p='md'>
|
||||
|
||||
<h3 style={{ marginTop: 0 }}>
|
||||
{tournament?.name}
|
||||
</h3>
|
||||
|
||||
<Button onClick={() => sheet.open()}>
|
||||
View Teams
|
||||
</Button>
|
||||
|
||||
</Box>
|
||||
|
||||
<Sheet
|
||||
{...sheet.props}
|
||||
title='Teams'
|
||||
>
|
||||
<TeamDrawer tournament={tournament!} />
|
||||
</Sheet>
|
||||
<Profile tournament={tournament!} />
|
||||
</Page>
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import Page from '@/components/page'
|
||||
import { Button, Stack } from '@mantine/core'
|
||||
import { Stack } from '@mantine/core'
|
||||
import { createFileRoute } from '@tanstack/react-router'
|
||||
import { TournamentCard } from '@/features/tournaments/components/tournament-card'
|
||||
import { tournamentQueries } from '@/features/tournaments/queries'
|
||||
@@ -9,6 +9,7 @@ import { useSheet } from '@/hooks/use-sheet'
|
||||
import Sheet from '@/components/sheet/sheet'
|
||||
import CreateTournament from '@/features/admin/components/create-tournament'
|
||||
import { PlusIcon } from '@phosphor-icons/react'
|
||||
import Button from '@/components/button'
|
||||
|
||||
export const Route = createFileRoute('/_authed/tournaments/')({
|
||||
beforeLoad: async ({ context }) => {
|
||||
|
||||
Reference in New Issue
Block a user