feat: redesign homepage layout and fix invite links

- Homepage: Grid-Layout mit 3 Karten (Spiel erstellen, KI, Freunde/Beitreten)
  statt vertikalem Stack mit Dividers
- CreateGame: kompakteres Styling, auf Deutsch, in Primary-Card integriert
- Einladungslink: APP_URL statt hardcoded ches.su in GamePage und CopyLink
- JoinGame: URL-Parsing für beliebige Domains (nicht nur ches.su)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Michess
2026-04-14 07:49:59 +02:00
parent 0cc5a8e99c
commit 09e5271dfb
6 changed files with 83 additions and 68 deletions

View File

@@ -22,7 +22,7 @@ import { Chess } from "chess.js";
import type { ClearPremoves } from "react-chessboard";
import { Chessboard } from "react-chessboard";
import { API_URL } from "@/config";
import { API_URL, APP_URL } from "@/config";
import { io } from "socket.io-client";
import { lobbyReducer, squareReducer } from "./reducers";
@@ -408,12 +408,8 @@ export default function GamePage({ initialLobby }: { initialLobby: Game }) {
}
function copyInvite() {
const text = `https://ches.su/${lobby.endReason ? `archive/${lobby.id}` : initialLobby.code}`;
if ("clipboard" in navigator) {
navigator.clipboard.writeText(text);
} else {
document.execCommand("copy", true, text);
}
const text = `${APP_URL}/${lobby.endReason ? `archive/${lobby.id}` : initialLobby.code}`;
navigator.clipboard.writeText(text).catch(() => {});
setCopiedLink(true);
setTimeout(() => {
setCopiedLink(false);
@@ -586,7 +582,7 @@ export default function GamePage({ initialLobby }: { initialLobby: Game }) {
onClick={copyInvite}
>
<IconCopy size={16} />
ches.su/{lobby.endReason ? `archive/${lobby.id}` : initialLobby.code}
{APP_URL.replace(/^https?:\/\//, "")}/{lobby.endReason ? `archive/${lobby.id}` : initialLobby.code}
</label>
<div tabIndex={0} className="dropdown-content badge badge-neutral text-xs shadow">
copied to clipboard