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:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user