All files / web/src/components FullscreenGameLayout.tsx

0% Statements 0/58
0% Branches 0/1
0% Functions 0/1
0% Lines 0/58

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59                                                                                                                     
'use client'

import { useRouter } from 'next/navigation'
import type { ReactNode } from 'react'
import { css } from '../../styled-system/css'
import { FullscreenProvider, useFullscreen } from '../contexts/FullscreenContext'

interface FullscreenGameLayoutProps {
  children: ReactNode
  title: string
}

function FullscreenGameContent({ children, title }: FullscreenGameLayoutProps) {
  const router = useRouter()
  const { isFullscreen, enterFullscreen, exitFullscreen } = useFullscreen()

  // Note: Automatic fullscreen entry removed - users must manually enter fullscreen
  // Client-side navigation now preserves fullscreen state without needing auto-entry

  const _handleExitGame = () => {
    console.log(
      '🔄 FullscreenGameLayout: Navigating to arcade with Next.js router (no page reload)'
    )
    // Navigate back to arcade using client-side routing
    router.push('/arcade')
  }

  return (
    <div
      className={css({
        minH: 'screen',
        background: isFullscreen
          ? 'linear-gradient(135deg, #0f0f23 0%, #1a1a3a 50%, #2d1b69 100%)'
          : 'white',
      })}
    >
      {/* Note: Fullscreen navigation is now handled by the enhanced AppNavBar */}

      {/* Game content */}
      <div
        className={css({
          pt: isFullscreen ? '16' : '0', // Account for fixed nav in fullscreen
          minH: 'screen',
        })}
      >
        {children}
      </div>
    </div>
  )
}

export function FullscreenGameLayout({ children, title }: FullscreenGameLayoutProps) {
  return (
    <FullscreenProvider>
      <FullscreenGameContent title={title}>{children}</FullscreenGameContent>
    </FullscreenProvider>
  )
}