+ {game.endReason === "abandoned"
+ ? game.winner === "draw"
+ ? "The game ended in a draw due to abandonment."
+ : `The game was won by ${game.winner} due to abandonment.`
+ : game.winner === "draw"
+ ? "The game ended in a draw."
+ : `The game was won by checkmate (${game.winner}).`}
+
+
+
+
+
+
+
+
+
+
+
+ );
+}
diff --git a/client/src/components/game/GamePage.tsx b/client/src/components/game/GamePage.tsx
index 095ca72..fb3cb40 100644
--- a/client/src/components/game/GamePage.tsx
+++ b/client/src/components/game/GamePage.tsx
@@ -10,6 +10,7 @@ import {
} from "@tabler/icons-react";
import type { FormEvent, KeyboardEvent } from "react";
+import Link from "next/link";
import { SessionContext } from "@/context/session";
import { useContext, useEffect, useReducer, useRef, useState } from "react";
@@ -392,7 +393,7 @@ export default function GamePage({ initialLobby }: { initialLobby: Game }) {
}
function copyInvite() {
- const text = `https://ches.su/${initialLobby.code}`;
+ const text = `https://ches.su/${lobby.endReason ? `archive/${lobby.id}` : initialLobby.code}`;
if ("clipboard" in navigator) {
navigator.clipboard.writeText(text);
} else {
@@ -558,7 +559,7 @@ export default function GamePage({ initialLobby }: { initialLobby: Game }) {
copied to clipboard
@@ -635,17 +636,21 @@ export default function GamePage({ initialLobby }: { initialLobby: Game }) {
!lobby.white?.connected)) && (
{lobby.endReason ? (
- lobby.endReason === "abandoned" ? (
- lobby.winner === "draw" ? (
- "The game ended in a draw due to abandonment."
- ) : (
- `The game was won by ${lobby.winner} due to abandonment.`
- )
- ) : lobby.winner === "draw" ? (
- "The game ended in a draw."
- ) : (
- `The game was won by checkmate (${lobby.winner}).`
- )
+
+ {lobby.endReason === "abandoned"
+ ? lobby.winner === "draw"
+ ? `The game ended in a draw due to abandonment.`
+ : `The game was won by ${lobby.winner} due to abandonment.`
+ : lobby.winner === "draw"
+ ? "The game ended in a draw."
+ : `The game was won by checkmate (${lobby.winner}).`}{" "}
+
+ You can review the archived game at{" "}
+
+ ches.su/archive/{lobby.id}
+
+ .
+
) : abandonSeconds > 0 ? (
`Your opponent has disconnected. You can claim the win or draw in ${abandonSeconds} second${
abandonSeconds > 1 ? "s" : ""