feat: added reject image and migrated to tailwindcss

feat: made it smartphone friendly
This commit is contained in:
2026-04-14 00:16:59 +09:00
parent 3582fca2d9
commit abf350aa6b
35 changed files with 788 additions and 1107 deletions

View File

@@ -1,19 +1,43 @@
import { notFound } from 'next/navigation';
import { notFound, redirect } from 'next/navigation';
import { PlayersList } from '@/components/PlayersList';
import { getPlayersForTournament } from '@/lib/data';
import { getPlayersForTournamentPaged, PLAYERS_PAGE_SIZE } from '@/lib/data';
export const dynamic = 'force-dynamic';
type PageProps = {
params: Promise<{ tournament_key: string }>;
searchParams: Promise<{ page?: string }>;
};
export default async function TournamentPlayersPage({ params }: PageProps) {
export default async function TournamentPlayersPage({ params, searchParams }: PageProps) {
const { tournament_key } = await params;
const players = await getPlayersForTournament(tournament_key);
if (players === null) {
const { page: pageRaw } = await searchParams;
const parsed = parseInt(pageRaw ?? '1', 10);
const page = Number.isFinite(parsed) && parsed >= 1 ? Math.floor(parsed) : 1;
const result = await getPlayersForTournamentPaged(tournament_key, page);
if (result === null) {
notFound();
}
return <PlayersList players={players} />;
const { players, total } = result;
const totalPages = Math.max(1, Math.ceil(total / PLAYERS_PAGE_SIZE));
const basePath = `/tournaments/${encodeURIComponent(tournament_key)}/players`;
if (page > totalPages) {
redirect(totalPages <= 1 ? basePath : `${basePath}?page=${totalPages}`);
}
return (
<PlayersList
players={players}
pagination={{
page,
total,
pageSize: PLAYERS_PAGE_SIZE,
basePath,
}}
/>
);
}