update minor watch link copy

This commit is contained in:
Pas 2025-06-02 13:21:53 -06:00
parent 2a69d77c0b
commit 17695aefde
2 changed files with 11 additions and 5 deletions

View file

@ -200,8 +200,6 @@
"details": {
"resume": "Resume",
"play": "Play",
"director": "Director:",
"cast": "Cast:",
"runtime": "Runtime:",
"language": "Language:",
"releaseDate": "Release Date:",
@ -977,7 +975,7 @@
"aheadOfHost": "Ahead of host by {{seconds}} seconds",
"showStatusOverlay": "Show status overlay",
"leaveWatchParty": "Leave Watch Party",
"shareCode": "Share this code with friends (click to copy)",
"shareCode": "Share this code with friends (click to copy link)",
"connectedAsGuest": "Connected to watch party as guest",
"hostParty": "Host a Watch Party",
"joinParty": "Join a Watch Party",
@ -990,6 +988,7 @@
"invalidRoom": "Unable to connect to this room",
"contentMismatch": "Cannot join watch party: The content does not match the host's content.",
"episodeMismatch": "Cannot join watch party: You are watching a different episode than the host.",
"validating": "Validating watch party..."
"validating": "Validating watch party...",
"linkCopied": "Copied!"
}
}

View file

@ -27,6 +27,7 @@ export function WatchPartyView({ id }: { id: string }) {
const [backendName, setBackendName] = useState("");
const [editingCode, setEditingCode] = useState(false);
const [customCode, setCustomCode] = useState("");
const [hasCopiedShare, setHasCopiedShare] = useState(false);
const backendUrl = useBackendUrl();
const [isValidating, setIsValidating] = useState(false);
const [validationError, setValidationError] = useState<string | null>(null);
@ -162,6 +163,8 @@ export function WatchPartyView({ id }: { id: string }) {
const url = new URL(window.location.href);
url.searchParams.set("watchparty", roomCode);
navigator.clipboard.writeText(url.toString());
setHasCopiedShare(true);
setTimeout(() => setHasCopiedShare(false), 2000);
}
};
@ -268,7 +271,11 @@ export function WatchPartyView({ id }: { id: string }) {
<input
type="text"
readOnly
value={roomCode || ""}
value={
hasCopiedShare
? t("watchParty.linkCopied")
: roomCode || ""
}
className="bg-transparent border-none text-center font-mono tracking-widest w-full outline-none cursor-pointer text-type-logo text-[min(2rem,4vw)]"
onClick={(e) => {
if (e.target instanceof HTMLInputElement) {