new: usr: add missing buttons for overlays #7
This commit is contained in:
@@ -543,6 +543,19 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#mine-wrapper .game-wrapper .game-overlay .game-overlay-window .game-overlay-actions {
|
||||||
|
display: flex;
|
||||||
|
align-items: stretch;
|
||||||
|
gap: 12px;
|
||||||
|
margin-top: 20px;
|
||||||
|
width: 100%;
|
||||||
|
|
||||||
|
> * {
|
||||||
|
flex: 1 1 0;
|
||||||
|
margin-top: 0 !important;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#mine-wrapper .game-wrapper .game-overlay .game-overlay-window .game-overlay-share {
|
#mine-wrapper .game-wrapper .game-overlay .game-overlay-window .game-overlay-share {
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
@@ -606,3 +619,60 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#mine-wrapper .game-wrapper .game-overlay .game-overlay-window .game-overlay-profile {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
gap: 9px;
|
||||||
|
background: linear-gradient(to bottom, #1a6844 0%, #135233 100%);
|
||||||
|
border: 2px solid #2a9e60;
|
||||||
|
color: #d0ffe0;
|
||||||
|
font-family: 'Rajdhani', sans-serif;
|
||||||
|
font-size: 13px;
|
||||||
|
font-weight: 800;
|
||||||
|
letter-spacing: 1px;
|
||||||
|
text-transform: uppercase;
|
||||||
|
padding: 12px 24px;
|
||||||
|
border-radius: 8px;
|
||||||
|
cursor: pointer;
|
||||||
|
transition: all 300ms cubic-bezier(0.34, 1.56, 0.64, 1);
|
||||||
|
width: 100%;
|
||||||
|
margin-top: 20px;
|
||||||
|
position: relative;
|
||||||
|
overflow: hidden;
|
||||||
|
box-shadow: 0 4px 12px rgba(42, 158, 96, 0.25);
|
||||||
|
text-decoration: none;
|
||||||
|
z-index: 10;
|
||||||
|
|
||||||
|
&::before {
|
||||||
|
content: '';
|
||||||
|
position: absolute;
|
||||||
|
top: 0;
|
||||||
|
left: -100%;
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
|
||||||
|
transition: left 0.4s ease;
|
||||||
|
}
|
||||||
|
|
||||||
|
&:hover {
|
||||||
|
background: linear-gradient(to bottom, #238f5c 0%, #1a6844 100%);
|
||||||
|
border-color: #5ee89a;
|
||||||
|
color: #fff;
|
||||||
|
box-shadow: 0 8px 24px rgba(42, 158, 96, 0.4);
|
||||||
|
transform: translateY(-2px);
|
||||||
|
|
||||||
|
&::before {
|
||||||
|
left: 100%;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
&:active {
|
||||||
|
transform: translateY(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
i {
|
||||||
|
font-size: 15px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -23,6 +23,7 @@ const GridControl = ({ gameAssoc, onClick, resign }) => {
|
|||||||
|
|
||||||
const [copied, setCopied] = useState(false);
|
const [copied, setCopied] = useState(false);
|
||||||
const shareUrl = gameAssoc ? `${window.location.origin}/battle/${gameAssoc}` : null;
|
const shareUrl = gameAssoc ? `${window.location.origin}/battle/${gameAssoc}` : null;
|
||||||
|
const isAuthenticated = '1' === document.getElementById('mine-wrapper')?.dataset.isAuthenticated;
|
||||||
|
|
||||||
const handleShare = () => {
|
const handleShare = () => {
|
||||||
if (!shareUrl) return;
|
if (!shareUrl) return;
|
||||||
@@ -64,6 +65,7 @@ const GridControl = ({ gameAssoc, onClick, resign }) => {
|
|||||||
overlaySubTitle
|
overlaySubTitle
|
||||||
)}
|
)}
|
||||||
{gameAssoc && endRef.current && (
|
{gameAssoc && endRef.current && (
|
||||||
|
<div className="game-overlay-actions">
|
||||||
<button
|
<button
|
||||||
className={`game-overlay-share${copied ? ' copied' : ''}`}
|
className={`game-overlay-share${copied ? ' copied' : ''}`}
|
||||||
onClick={handleShare}
|
onClick={handleShare}
|
||||||
@@ -73,6 +75,16 @@ const GridControl = ({ gameAssoc, onClick, resign }) => {
|
|||||||
<i className={`fa ${copied ? 'fa-check' : 'fa-share-alt'}`} />
|
<i className={`fa ${copied ? 'fa-check' : 'fa-share-alt'}`} />
|
||||||
{copied ? 'Copied!' : 'Share Battle'}
|
{copied ? 'Copied!' : 'Share Battle'}
|
||||||
</button>
|
</button>
|
||||||
|
<a
|
||||||
|
className="game-overlay-profile"
|
||||||
|
href={isAuthenticated ? '/profile' : '/'}
|
||||||
|
title={isAuthenticated ? 'Go to your profile' : 'Go to homepage'}
|
||||||
|
aria-label={isAuthenticated ? 'Go to your profile' : 'Go to homepage'}
|
||||||
|
>
|
||||||
|
<i className={`fa ${isAuthenticated ? 'fa-user' : 'fa-house'}`} />
|
||||||
|
{isAuthenticated ? 'My Profile' : 'Homepage'}
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -285,7 +285,28 @@ const useServerCommunication = (gameAssoc, gameInherited, opponentName, isEnvDev
|
|||||||
|
|
||||||
const wUnsubscribe = payload => {
|
const wUnsubscribe = payload => {
|
||||||
isEnvDev && console.info(payload.msg);
|
isEnvDev && console.info(payload.msg);
|
||||||
showOverlay('The connection has been lost w/ your friend...', 'Please, restart the game!');
|
const isAuthenticated = '1' === document.getElementById('mine-wrapper')?.dataset.isAuthenticated;
|
||||||
|
const redirectPath = isAuthenticated ? '/profile' : '/';
|
||||||
|
const buttonText = isAuthenticated ? 'My Profile' : 'Homepage';
|
||||||
|
const buttonIcon = isAuthenticated ? 'fa-user' : 'fa-house';
|
||||||
|
|
||||||
|
showOverlay(
|
||||||
|
'The connection has been lost w/ your friend...',
|
||||||
|
(
|
||||||
|
<div style={{ display: 'flex', flexDirection: 'column', alignItems: 'center', gap: '12px', width: '100%' }}>
|
||||||
|
<p style={{ margin: 0 }}>Please, restart the game!</p>
|
||||||
|
<a
|
||||||
|
className="game-overlay-profile"
|
||||||
|
href={redirectPath}
|
||||||
|
title={isAuthenticated ? 'Go to your profile' : 'Go to homepage'}
|
||||||
|
aria-label={isAuthenticated ? 'Go to your profile' : 'Go to homepage'}
|
||||||
|
>
|
||||||
|
<i className={`fa ${buttonIcon}`} />
|
||||||
|
{buttonText}
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
|
),
|
||||||
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
const wChallenge = payload => {
|
const wChallenge = payload => {
|
||||||
|
|||||||
@@ -11,6 +11,7 @@
|
|||||||
data-env="{{ env }}"
|
data-env="{{ env }}"
|
||||||
data-game-id="{{ app.request.get('gameAssoc') }}"
|
data-game-id="{{ app.request.get('gameAssoc') }}"
|
||||||
data-opponent-name="{{ opponent_name }}"
|
data-opponent-name="{{ opponent_name }}"
|
||||||
|
data-is-authenticated="{{ app.user ? '1' : '0' }}"
|
||||||
data-mercure-hub-url="{{ mercure_hub_url }}"
|
data-mercure-hub-url="{{ mercure_hub_url }}"
|
||||||
data-mercure-subscriber-jwt="{{ mercure_subscriber_jwt }}"
|
data-mercure-subscriber-jwt="{{ mercure_subscriber_jwt }}"
|
||||||
data-recaptcha-site-key="{{ recaptcha_site_key }}">
|
data-recaptcha-site-key="{{ recaptcha_site_key }}">
|
||||||
|
|||||||
Reference in New Issue
Block a user