feat: added reject image and migrated to tailwindcss
feat: made it smartphone friendly
This commit is contained in:
@@ -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,
|
||||
}}
|
||||
/>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
import style from '@/styles/web.module.scss';
|
||||
import { mainBody } from '@/lib/siteContentClasses';
|
||||
|
||||
export default function ScoreboardPage() {
|
||||
return (
|
||||
<div className={style.mainBody}>
|
||||
<div className={style.scoreboardImage} />
|
||||
<div className={mainBody}>
|
||||
<div className="aspect-[567/485] w-full max-w-[567px] bg-[url(https://static.catherine-fc.com/media/scoreboard.png)] bg-contain bg-center [background-repeat:no-repeat]" />
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user