router config changes
This commit is contained in:
@@ -21,7 +21,8 @@ export const Route = createRootRouteWithContext<{
|
||||
queryClient: QueryClient,
|
||||
auth: AuthContextType,
|
||||
header: HeaderConfig,
|
||||
refresh: { toRefresh: string[] }
|
||||
refresh: string[]
|
||||
withPadding: boolean
|
||||
}>()({
|
||||
head: () => ({
|
||||
meta: [
|
||||
|
||||
@@ -13,15 +13,12 @@ export const Route = createFileRoute("/_authed/admin/tournaments/")({
|
||||
withBackButton: true,
|
||||
title: "Manage Tournaments",
|
||||
},
|
||||
refresh: {
|
||||
toRefresh: tournamentQueries.list().queryKey,
|
||||
},
|
||||
refresh: tournamentQueries.list().queryKey,
|
||||
withPadding: false
|
||||
}),
|
||||
component: RouteComponent,
|
||||
});
|
||||
|
||||
function RouteComponent() {
|
||||
return <Page noPadding>
|
||||
<ManageTournaments />
|
||||
</Page>
|
||||
return <ManageTournaments />
|
||||
}
|
||||
|
||||
@@ -10,11 +10,14 @@ export const Route = createFileRoute("/_authed/")({
|
||||
beforeLoad: async ({ context }) => {
|
||||
await context.queryClient.ensureQueryData(tournamentQueries.list());
|
||||
},
|
||||
loader: () => ({
|
||||
withPadding: false
|
||||
})
|
||||
});
|
||||
|
||||
function Home() {
|
||||
return (
|
||||
<Page noPadding>
|
||||
<>
|
||||
<Box h='60vh' p="md">
|
||||
<Text m='16vh' fw={500}>Some Content Here</Text>
|
||||
</Box>
|
||||
@@ -24,6 +27,6 @@ function Home() {
|
||||
<Divider />
|
||||
<ListLink label="All Tournaments" to="/tournaments" Icon={TrophyIcon} />
|
||||
</Box>
|
||||
</Page>
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -24,12 +24,10 @@ export const Route = createFileRoute("/_authed/profile/$playerId")({
|
||||
withBackButton: true,
|
||||
settingsLink: context?.auth.user.id === params.playerId ? 'settings' : undefined
|
||||
},
|
||||
refresh: {
|
||||
toRefresh: [playerQueries.details(params.playerId).queryKey],
|
||||
}
|
||||
refresh: [playerQueries.details(params.playerId).queryKey]
|
||||
}),
|
||||
component: () => {
|
||||
const { player } = Route.useRouteContext();
|
||||
return <Page><Profile player={player} /></Page>
|
||||
return <Profile player={player} />
|
||||
},
|
||||
})
|
||||
|
||||
@@ -4,7 +4,6 @@ import { ColorSchemePicker } from "@/features/settings/components/color-scheme-p
|
||||
import AccentColorPicker from "@/features/settings/components/accent-color-picker"
|
||||
import { SignOutIcon } from "@phosphor-icons/react"
|
||||
import ListLink from "@/components/list-link"
|
||||
import Page from "@/components/page"
|
||||
|
||||
export const Route = createFileRoute("/_authed/settings")({
|
||||
loader: () => ({
|
||||
@@ -12,12 +11,13 @@ export const Route = createFileRoute("/_authed/settings")({
|
||||
title: 'Settings',
|
||||
withBackButton: true,
|
||||
},
|
||||
withPadding: false
|
||||
}),
|
||||
component: RouteComponent,
|
||||
})
|
||||
|
||||
function RouteComponent() {
|
||||
return <Page noPadding>
|
||||
return <>
|
||||
<Box px='md' py='sm' style={{ borderBottom: '1px solid var(--mantine-color-default-border)' }}>
|
||||
<Title order={3}>Appearance</Title>
|
||||
<Stack>
|
||||
@@ -30,5 +30,5 @@ function RouteComponent() {
|
||||
to='/logout'
|
||||
Icon={SignOutIcon}
|
||||
/>
|
||||
</Page>
|
||||
</>
|
||||
}
|
||||
|
||||
@@ -21,12 +21,10 @@ export const Route = createFileRoute("/_authed/teams/$teamId")({
|
||||
collapsed: true,
|
||||
withBackButton: true
|
||||
},
|
||||
refresh: {
|
||||
toRefresh: [teamQueries.details(params.teamId).queryKey],
|
||||
}
|
||||
refresh: [teamQueries.details(params.teamId).queryKey]
|
||||
}),
|
||||
component: () => {
|
||||
const { team } = Route.useRouteContext();
|
||||
return <Page><TeamProfile team={team} /></Page>
|
||||
return <TeamProfile team={team} />
|
||||
},
|
||||
})
|
||||
|
||||
@@ -28,16 +28,13 @@ export const Route = createFileRoute('/_authed/tournaments/$tournamentId')({
|
||||
withBackButton: true,
|
||||
settingsLink: context.auth.roles.includes("Admin") ? `/admin/tournaments/${params.tournamentId}` : undefined
|
||||
},
|
||||
refresh: {
|
||||
toRefresh: tournamentQueries.details(params.tournamentId).queryKey,
|
||||
}
|
||||
refresh: tournamentQueries.details(params.tournamentId).queryKey,
|
||||
withPadding: false
|
||||
}),
|
||||
component: RouteComponent,
|
||||
})
|
||||
|
||||
function RouteComponent() {
|
||||
const { data: tournament } = useQuery(tournamentQueries.details(Route.useParams().tournamentId));
|
||||
return <Page noPadding>
|
||||
<Profile tournament={tournament!} />
|
||||
</Page>
|
||||
return <Profile tournament={tournament!} />
|
||||
}
|
||||
|
||||
@@ -21,9 +21,7 @@ export const Route = createFileRoute('/_authed/tournaments/')({
|
||||
withBackButton: true,
|
||||
title: 'Tournaments',
|
||||
},
|
||||
refresh: {
|
||||
toRefresh: tournamentQueries.list().queryKey,
|
||||
}
|
||||
refresh: tournamentQueries.list().queryKey
|
||||
}),
|
||||
component: RouteComponent,
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user