in app/components/share-link-panel.tsx [22:44]
export default function ShareLinkPanel({gameId}: { gameId: string }) {
const gameShareLink = `${location.protocol}//${location.host}/game/${gameId}`;
const [isCopied, setIsCopied] = useState<boolean>(false);
const copyShareLink = () => {
navigator.clipboard.writeText(gameShareLink);
setIsCopied(true);
};
return (
<div>
<div>
Scan this QR code to join the game:
<QRCode value={gameShareLink} />
</div>
<button onClick={copyShareLink} className={`border m-2 p-2`}>Click to Copy Share Link</button>
<br />
<p>
{isCopied ? 'Link copied to clipboard' : ''}
</p>
</div>
);
}