Refactor game API and introduce Forest Fortune game

- Updated API types to replace `GameStub` with `GameInfo` and added `SessionSpinResult` and `SpinOutcome` types.
- Modified API requests in `api.ts` to use the new game types.
- Implemented the `ForestFortuneGame` component with game logic, including spinning mechanics and win animations.
- Created supporting components: `CoinFlight`, `ReelColumn`, `WinCounter`, and `WinLinesOverlay` for game UI.
- Added CSS styles for the Forest Fortune game layout and animations.
- Updated `GamePage` and `HomePage` to integrate the new game and reflect its status correctly.
This commit is contained in:
Redsandy
2026-08-12 15:27:27 +03:00
parent dfe445349b
commit f0733d6918
13 changed files with 1212 additions and 14 deletions

View File

@@ -2,12 +2,13 @@ import { useEffect, useState } from 'react'
import { Link, Navigate, useParams } from 'react-router-dom'
import { api } from '../api'
import { useAuth } from '../auth'
import type { GameStub } from '../types'
import { ForestFortuneGame } from '../games/forest-fortune/ForestFortuneGame'
import type { GameInfo } from '../types'
export function GamePage() {
const { slug } = useParams<{ slug: string }>()
const { user, loading } = useAuth()
const [game, setGame] = useState<GameStub | null>(null)
const [game, setGame] = useState<GameInfo | null>(null)
const [error, setError] = useState<string | null>(null)
useEffect(() => {
@@ -22,13 +23,16 @@ export function GamePage() {
return <Navigate to="/" replace />
}
const playable = game?.status === 'available' && game.slug === 'forest-fortune'
return (
<main className="game-page">
<Link to="/home" className="back-link">
Назад
</Link>
{error && <p className="error">{error}</p>}
{game && (
{game && playable && <ForestFortuneGame game={game} />}
{game && !playable && (
<section className="game-stub">
<img src="/logo.png" alt="" className="game-stub__mark" />
<h1>{game.title}</h1>