import type { Metadata } from "next"; import Link from "next/link"; import { notFound } from "next/navigation"; import { canReadPage } from "@/lib/auth/permissions"; import { logPageAccess } from "@/lib/auth/log-page-access"; import { requireSession } from "@/lib/auth/require-session"; import { MatchLogColoredBody } from "@/components/match-log-colored-body"; import { parseMatchIdParam, readMatchLogFile, } from "@/lib/match-logs-server"; import { redirect } from "next/navigation"; export async function generateMetadata({ params, }: { params: Promise<{ matchId: string }>; }): Promise { const { matchId } = await params; return { title: `Match ${matchId} log · Kick Kings Admin`, }; } export default async function MatchLogPage({ params, }: { params: Promise<{ matchId: string }>; }) { const account = await requireSession(); if ( !canReadPage(account, "matches") && !canReadPage(account, "analysis") ) { redirect("/"); } const { matchId: raw } = await params; const matchId = parseMatchIdParam(raw); if (matchId == null) { notFound(); } await logPageAccess(account, "match-log", { matchId }); const result = await readMatchLogFile(matchId); return (

soccar match_{matchId}.txt

Back to matches
{!result.ok ? (

error: {result.message}

) : result.content === "" ? (

(empty file)

) : ( )}
); }