clarify game end reason in user profile history
This commit is contained in:
@@ -64,7 +64,15 @@ export default async function Profile({ params }: { params: { name: string } })
|
|||||||
<div>
|
<div>
|
||||||
<h2 className="mb-1 text-lg font-bold">Recent games</h2>
|
<h2 className="mb-1 text-lg font-bold">Recent games</h2>
|
||||||
<ul className="bg-base-300 flex h-[60vh] flex-col gap-1 overflow-y-scroll rounded-lg">
|
<ul className="bg-base-300 flex h-[60vh] flex-col gap-1 overflow-y-scroll rounded-lg">
|
||||||
{data.recentGames.map((game) => (
|
{data.recentGames.map((game) => {
|
||||||
|
let endReason = game.endReason as string;
|
||||||
|
if (endReason === "repetition") {
|
||||||
|
endReason = "threefold repetition";
|
||||||
|
} else if (endReason === "insufficient") {
|
||||||
|
endReason = "insufficient material";
|
||||||
|
}
|
||||||
|
|
||||||
|
return (
|
||||||
<li
|
<li
|
||||||
key={game.id}
|
key={game.id}
|
||||||
className="border-base-100 flex flex-wrap items-center justify-between gap-8 border-b-2 p-3"
|
className="border-base-100 flex flex-wrap items-center justify-between gap-8 border-b-2 p-3"
|
||||||
@@ -122,7 +130,7 @@ export default async function Profile({ params }: { params: { name: string } })
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div className="flex-grow text-end text-xs">{game.endReason}</div>
|
<div className="flex-grow text-end text-xs">{endReason}</div>
|
||||||
|
|
||||||
<div className="flex flex-grow flex-col text-end">
|
<div className="flex flex-grow flex-col text-end">
|
||||||
<span className="text-xs">
|
<span className="text-xs">
|
||||||
@@ -150,7 +158,8 @@ export default async function Profile({ params }: { params: { name: string } })
|
|||||||
Review game
|
Review game
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
))}
|
);
|
||||||
|
})}
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
Reference in New Issue
Block a user