import type { LoaderFunctionArgs, MetaFunction } from "react-router"; import { Form, useLoaderData } from "react-router"; import { ensureUserLoggedIn } from "../.server/auth"; import { createApiClient } from "../api/client"; import BorderedContainerWithCaption from "../components/BorderedContainerWithCaption"; import NavigateLink from "../components/NavigateLink"; import UserIcon from "../components/UserIcon"; import { BASE_PATH } from "../config"; export const meta: MetaFunction = () => [ { title: "Dashboard | iOSDC Japan 2025 Albatross" }, ]; export async function loader({ request }: LoaderFunctionArgs) { const { user, token } = await ensureUserLoggedIn(request); const apiClient = createApiClient(token); const { games } = await apiClient.getGames(); return { user, games, }; } export default function Dashboard() { const { user, games } = useLoaderData()!; return (
{user.icon_path && ( )}

{user.display_name}

{games.length === 0 ? (

エントリーできる試合はありません

) : (
    {games.map((game) => (
  • {game.display_name}
    対戦 観戦
  • ))}
)}
{user.is_admin && ( Admin Dashboard )}
); }