Private
Public Access
1
0

new: usr: a new feature came up - the abandoned plays can be restored, if both users are registered users #7

This commit is contained in:
2026-04-19 18:04:01 +02:00
parent c79584c7d2
commit 991b114a3c
23 changed files with 910 additions and 251 deletions

View File

@@ -9,46 +9,55 @@
import { Fragment, useState } from 'react';
import { OnlinePlayersDialog } from '@mine-components';
const WaitingOverlayContent = ({ shareUrl, currentGameAssoc }) => {
const WaitingOverlayContent = ({ shareUrl, currentGameAssoc, opponentName = '', inviteOnly = false }) => {
const [dialogOpen, setDialogOpen] = useState(false);
const inviteHeader = inviteOnly && opponentName
? `Invite ${opponentName}`
: 'Invite a Friend';
return (
<Fragment>
<div className="waiting-options">
<div className={`waiting-options${inviteOnly ? ' waiting-options--invite-only' : ''}`}>
<div className="waiting-option">
<div className="waiting-option-header">
<i className="fa fa-link" />
<span>Invite a Friend</span>
<span>{inviteHeader}</span>
</div>
<p className="waiting-option-desc">Share this link with your opponent</p>
<ShareLinkBox
url={shareUrl}
/>
</div>
<div className="waiting-divider">
<span>OR</span>
</div>
<div className="waiting-option">
<div className="waiting-option-header">
<i className="fa fa-users" />
<span>Challenge a Player</span>
</div>
<p className="waiting-option-desc">Browse online players and challenge them</p>
<button
className="browse-players-btn"
onClick={() => setDialogOpen(true)}
>
<i className="fa fa-search" />
Browse Players
</button>
</div>
{!inviteOnly && (
<Fragment>
<div className="waiting-divider">
<span>OR</span>
</div>
<div className="waiting-option">
<div className="waiting-option-header">
<i className="fa fa-users" />
<span>Challenge a Player</span>
</div>
<p className="waiting-option-desc">Browse online players and challenge them</p>
<button
className="browse-players-btn"
onClick={() => setDialogOpen(true)}
>
<i className="fa fa-search" />
Browse Players
</button>
</div>
</Fragment>
)}
</div>
<OnlinePlayersDialog
open={dialogOpen}
onClose={() => setDialogOpen(false)}
currentGameAssoc={currentGameAssoc}
/>
{!inviteOnly && (
<OnlinePlayersDialog
open={dialogOpen}
onClose={() => setDialogOpen(false)}
currentGameAssoc={currentGameAssoc}
/>
)}
</Fragment>
);
};
@@ -57,10 +66,12 @@ const ShareLinkBox = ({ url }) => {
const [copied, setCopied] = useState(false);
const handleCopy = () => {
navigator.clipboard.writeText(url).then(() => {
setCopied(true);
setTimeout(() => setCopied(false), 2500);
}).catch(() => {});
navigator.clipboard.writeText(url)
.then(() => {
setCopied(true);
setTimeout(() => setCopied(false), 2500);
})
.catch(() => null);
};
return (