feat: add friend invite modal to all game modes

- New InviteFriendsModal component: fetches friends list, sends game
  invite via notification socket with per-friend sent confirmation
- Multiplayer (GamePage): invite button below copy link, hidden after game ends
- Correspondence: invite button in waiting-for-opponent card
- Tournament: invite button for joined players while status is waiting
- Invite links use mode-prefixed codes (correspondence/XYZ, tournament/XYZ)
  so notification "Beitreten" button navigates to the correct page

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Michess
2026-04-14 13:16:00 +02:00
parent 50ef567a1a
commit b29c467766
4 changed files with 103 additions and 1 deletions

View File

@@ -23,6 +23,7 @@ import type { ClearPremoves } from "react-chessboard";
import { Chessboard } from "react-chessboard";
import { API_URL, APP_URL } from "@/config";
import InviteFriendsModal from "@/components/InviteFriendsModal";
import { io } from "socket.io-client";
import { lobbyReducer, squareReducer } from "./reducers";
@@ -654,6 +655,11 @@ export default function GamePage({ initialLobby }: { initialLobby: Game }) {
</div>
</div>
</div>
{!lobby.endReason && (
<div className="mt-1 flex justify-end">
<InviteFriendsModal gameCode={initialLobby.code!} label="Freunde einladen" />
</div>
)}
<div className="h-32 w-full overflow-y-scroll" ref={moveListRef}>
<table className="table-compact table w-full">
<tbody>{getMoveListHtml()}</tbody>