Pedro de Carvalho commited on
Commit
5973957
·
1 Parent(s): 9d441c2

Loading screen

Browse files
Files changed (2) hide show
  1. client/src/index.css +4 -0
  2. client/src/pages/Game.tsx +22 -0
client/src/index.css CHANGED
@@ -200,3 +200,7 @@ button, input {
200
  filter: drop-shadow(0 0 16px rgba(var(--bot-glow-color, 88, 166, 255), 0.75));
201
  }
202
  }
 
 
 
 
 
200
  filter: drop-shadow(0 0 16px rgba(var(--bot-glow-color, 88, 166, 255), 0.75));
201
  }
202
  }
203
+
204
+ @keyframes caro5-spin {
205
+ to { transform: rotate(360deg); }
206
+ }
client/src/pages/Game.tsx CHANGED
@@ -576,6 +576,7 @@ export default function Game() {
576
  const location = useLocation()
577
  const navigate = useNavigate()
578
  const [engine, setEngine] = useState<GameEngine | null>(null)
 
579
  const [error, setError] = useState<string | null>(null)
580
  const [tick, setTick] = useState(0)
581
  const [connectionStatus] = useState<'connecting' | 'connected' | 'disconnected'>('connected')
@@ -943,6 +944,7 @@ export default function Game() {
943
  e.onStateChanged?.()
944
  }
945
  setEngine(e)
 
946
  }, [rerender, scheduleLocalBotTurn, isLocal, p1Name, p2Name, p1Symbol, p2Symbol, p1ColorState, p2ColorState, gameRules, p1DrawTower, p2DrawTower, localPlayerTypes])
947
 
948
  const status = engine?.status ?? 'waiting'
@@ -1007,6 +1009,26 @@ export default function Game() {
1007
 
1008
  return (
1009
  <div style={{ width: '100vw', height: '100dvh', overflow: 'hidden', position: 'relative' }}>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1010
  <GameCanvas onEngineReady={handleEngineReady} />
1011
  {isLocal && engine && (
1012
  <>
 
576
  const location = useLocation()
577
  const navigate = useNavigate()
578
  const [engine, setEngine] = useState<GameEngine | null>(null)
579
+ const [loading, setLoading] = useState(true)
580
  const [error, setError] = useState<string | null>(null)
581
  const [tick, setTick] = useState(0)
582
  const [connectionStatus] = useState<'connecting' | 'connected' | 'disconnected'>('connected')
 
944
  e.onStateChanged?.()
945
  }
946
  setEngine(e)
947
+ setLoading(false)
948
  }, [rerender, scheduleLocalBotTurn, isLocal, p1Name, p2Name, p1Symbol, p2Symbol, p1ColorState, p2ColorState, gameRules, p1DrawTower, p2DrawTower, localPlayerTypes])
949
 
950
  const status = engine?.status ?? 'waiting'
 
1009
 
1010
  return (
1011
  <div style={{ width: '100vw', height: '100dvh', overflow: 'hidden', position: 'relative' }}>
1012
+ {loading && (
1013
+ <div style={{
1014
+ position: 'absolute', inset: 0, zIndex: 1000,
1015
+ display: 'flex', flexDirection: 'column', alignItems: 'center', justifyContent: 'center',
1016
+ gap: '1.5rem',
1017
+ background: `linear-gradient(rgba(13, 17, 23, 0.68), rgba(13, 17, 23, 0.78)), url('${binAssetUrl('bg/start-menu-bg.jpg')}') center / cover no-repeat fixed, ${theme.bgStr}`,
1018
+ color: theme.text,
1019
+ }}>
1020
+ <h1 style={{ fontSize: 'clamp(1.8rem, 5vw, 2.5rem)', fontWeight: 800, letterSpacing: '-0.03em' }}>
1021
+ CARO 5
1022
+ </h1>
1023
+ <div style={{
1024
+ width: 32, height: 32, borderRadius: '50%',
1025
+ border: `3px solid ${theme.border}`,
1026
+ borderTopColor: theme.player1Str,
1027
+ animation: 'caro5-spin 0.8s linear infinite',
1028
+ }} />
1029
+ <p style={{ color: theme.textMuted, fontSize: '0.95rem' }}>Setting up the board…</p>
1030
+ </div>
1031
+ )}
1032
  <GameCanvas onEngineReady={handleEngineReady} />
1033
  {isLocal && engine && (
1034
  <>