43 lines
1.3 KiB
TypeScript
43 lines
1.3 KiB
TypeScript
import { useParams } from "react-router-dom";
|
|
import { useContestStore } from "@/stores/contestStore";
|
|
import { useUserStore } from "@/stores/userStore";
|
|
import ContestDetail from "@/components/ContestDetail";
|
|
import RoundsTable from "@/components/RoundsTable";
|
|
import { Card, CardHeader, CardBody, Divider } from "@heroui/react";
|
|
import { useTranslation } from "react-i18next";
|
|
|
|
export default function ContestDetailPage() {
|
|
const { contestId } = useParams();
|
|
const id = contestId ? Number(contestId) : null;
|
|
const selectedContest = useContestStore((s) => s.selectedContest);
|
|
const user = useUserStore((s) => s.user);
|
|
const { t } = useTranslation("common");
|
|
const isAuthenticated = !!user;
|
|
const showTests = isAuthenticated;
|
|
|
|
return (
|
|
<>
|
|
<ContestDetail contest={selectedContest} />
|
|
|
|
<Card>
|
|
<CardHeader>
|
|
<span className="text-md font-semibold">
|
|
{t("contest_rounds_title") ?? "Kola závodu"}
|
|
</span>
|
|
</CardHeader>
|
|
<Divider />
|
|
<CardBody>
|
|
<RoundsTable
|
|
contestId={id}
|
|
showTests={showTests}
|
|
enableEdit={false}
|
|
showContestColumn={false}
|
|
enableRowNavigation
|
|
roundsFromStore={selectedContest ? selectedContest.rounds : null}
|
|
/>
|
|
</CardBody>
|
|
</Card>
|
|
</>
|
|
);
|
|
}
|