From 5ac291de815f4d40da36388b4d56767b03d53572 Mon Sep 17 00:00:00 2001 From: Lang <7system7@gmail.com> Date: Sun, 19 Apr 2026 18:22:28 +0200 Subject: [PATCH] new: usr: add missing buttons for overlays #7 --- assets/css/mineseeker/_overlay.scss | 70 +++++++++++++++++++ .../components/grid/GridControl.jsx | 30 +++++--- .../hooks/useServerCommunication.jsx | 23 +++++- templates/Game/play.html.twig | 1 + 4 files changed, 114 insertions(+), 10 deletions(-) diff --git a/assets/css/mineseeker/_overlay.scss b/assets/css/mineseeker/_overlay.scss index 9e3ca51..3a94974 100644 --- a/assets/css/mineseeker/_overlay.scss +++ b/assets/css/mineseeker/_overlay.scss @@ -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 { display: flex; 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; + } +} + diff --git a/assets/js/mine-seeker/components/grid/GridControl.jsx b/assets/js/mine-seeker/components/grid/GridControl.jsx index c76c5cd..039a10c 100644 --- a/assets/js/mine-seeker/components/grid/GridControl.jsx +++ b/assets/js/mine-seeker/components/grid/GridControl.jsx @@ -23,6 +23,7 @@ const GridControl = ({ gameAssoc, onClick, resign }) => { const [copied, setCopied] = useState(false); const shareUrl = gameAssoc ? `${window.location.origin}/battle/${gameAssoc}` : null; + const isAuthenticated = '1' === document.getElementById('mine-wrapper')?.dataset.isAuthenticated; const handleShare = () => { if (!shareUrl) return; @@ -64,15 +65,26 @@ const GridControl = ({ gameAssoc, onClick, resign }) => { overlaySubTitle )} {gameAssoc && endRef.current && ( - +
)} diff --git a/assets/js/mine-seeker/hooks/useServerCommunication.jsx b/assets/js/mine-seeker/hooks/useServerCommunication.jsx index e7dc0ce..4a7a13d 100644 --- a/assets/js/mine-seeker/hooks/useServerCommunication.jsx +++ b/assets/js/mine-seeker/hooks/useServerCommunication.jsx @@ -285,7 +285,28 @@ const useServerCommunication = (gameAssoc, gameInherited, opponentName, isEnvDev const wUnsubscribe = payload => { 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...', + ( +Please, restart the game!
+ + + {buttonText} + +