+
+ {!session?.user?.id && (
+
Bitte einloggen um ein Spiel zu erstellen
+ )}
);
}
diff --git a/client/src/components/home/JoinGame.tsx b/client/src/components/home/JoinGame.tsx
index 1604f38..9f85e4a 100644
--- a/client/src/components/home/JoinGame.tsx
+++ b/client/src/components/home/JoinGame.tsx
@@ -25,8 +25,8 @@ export default function JoinGame() {
setButtonLoading(true);
- if (code.startsWith("ches.su")) {
- code = "http://" + code;
+ if (!code.startsWith("http") && code.includes("/")) {
+ code = "https://" + code;
}
if (code.startsWith("http")) {
code = new URL(code).pathname.split("/")[1];
diff --git a/client/src/components/user/CopyLink.tsx b/client/src/components/user/CopyLink.tsx
index 60a8456..1d50c0b 100644
--- a/client/src/components/user/CopyLink.tsx
+++ b/client/src/components/user/CopyLink.tsx
@@ -2,18 +2,14 @@
import { IconCopy } from "@tabler/icons-react";
import { useState } from "react";
+import { APP_URL } from "@/config";
export default function CopyLink({ name }: { name: string }) {
const [copiedLink, setCopiedLink] = useState(false);
+ const host = APP_URL.replace(/^https?:\/\//, "");
function copyLink() {
- const text = `https://ches.su/user/${name}`;
-
- if ("clipboard" in navigator) {
- navigator.clipboard.writeText(text);
- } else {
- document.execCommand("copy", true, text);
- }
+ navigator.clipboard.writeText(`${APP_URL}/user/${name}`).catch(() => {});
setCopiedLink(true);
setTimeout(() => {
setCopiedLink(false);
@@ -27,7 +23,7 @@ export default function CopyLink({ name }: { name: string }) {
onClick={copyLink}
>
- ches.su/user/{name}
+ {host}/user/{name}
copied to clipboard
diff --git a/client/src/config.ts b/client/src/config.ts
index 397995f..288f78a 100644
--- a/client/src/config.ts
+++ b/client/src/config.ts
@@ -1,2 +1,2 @@
-// back-end server url
export const API_URL = process.env.NEXT_PUBLIC_API_URL || "http://localhost:3001";
+export const APP_URL = process.env.NEXT_PUBLIC_APP_URL || "http://localhost:3000";