import type { LoaderFunctionArgs, MetaFunction } from "@remix-run/node"; import { Form, useLoaderData } from "@remix-run/react"; import { apiGetGames } from "../.server/api/client"; import { ensureUserLoggedIn } from "../.server/auth"; import BorderedContainer from "../components/BorderedContainer"; import NavigateLink from "../components/NavigateLink"; import UserIcon from "../components/UserIcon"; export const meta: MetaFunction = () => [ { title: "Dashboard | iOSDC Japan 2024 Albatross.swift" }, ]; export async function loader({ request }: LoaderFunctionArgs) { const { user, token } = await ensureUserLoggedIn(request); const { games } = await apiGetGames(token); return { user, games, }; } export default function Dashboard() { const { user, games } = useLoaderData()!; return (
{user.icon_path && ( )}

{user.display_name} @{user.username}

試合

{games.length === 0 ? (

エントリーしている試合はありません

) : (
    {games.map((game) => (
  • {game.display_name} {game.game_type === "multiplayer" ? " (マルチ)" : " (1v1)"}
    {game.state === "closed" || game.state === "finished" ? ( 入室 ) : ( 入室 )}
  • ))}
)}
{user.is_admin && ( Admin Dashboard )}
); }