From 1a62477528575a4a45f233520fb9db1954277fb9 Mon Sep 17 00:00:00 2001 From: Isaac Johnson Date: Sat, 5 Sep 2026 16:10:18 -0500 Subject: [PATCH] Working first version. The web UI works well, can add players manually. We can see bots on there --- .dockerignore | 13 + .gitignore | 328 ++++ Dockerfile | 49 + README.md | 112 ++ backend/app/__init__.py | 1 + backend/app/api/routes.py | 122 ++ backend/app/api/websocket.py | 38 + backend/app/config.py | 30 + backend/app/game.py | 99 ++ backend/app/main.py | 95 ++ backend/app/models.py | 58 + backend/requirements.txt | 8 + backend/tests/test_api.py | 82 + docker-compose.yml | 11 + frontend/.gitignore | 24 + frontend/.oxlintrc.json | 8 + frontend/README.md | 32 + frontend/index.html | 13 + frontend/package-lock.json | 1874 +++++++++++++++++++++ frontend/package.json | 28 + frontend/public/favicon.svg | 1 + frontend/public/icons.svg | 24 + frontend/src/App.css | 184 ++ frontend/src/App.tsx | 131 ++ frontend/src/assets/hero.png | Bin 0 -> 13057 bytes frontend/src/assets/react.svg | 1 + frontend/src/assets/vite.svg | 1 + frontend/src/components/BoardCanvas.tsx | 434 +++++ frontend/src/components/Header.tsx | 89 + frontend/src/components/PlayerList.tsx | 97 ++ frontend/src/components/RegisterModal.tsx | 206 +++ frontend/src/hooks/useGameSocket.ts | 175 ++ frontend/src/index.css | 33 + frontend/src/main.tsx | 10 + frontend/src/types.ts | 28 + frontend/tsconfig.app.json | 26 + frontend/tsconfig.json | 7 + frontend/tsconfig.node.json | 23 + frontend/vite.config.ts | 24 + 39 files changed, 4519 insertions(+) create mode 100644 .dockerignore create mode 100644 .gitignore create mode 100644 Dockerfile create mode 100644 README.md create mode 100644 backend/app/__init__.py create mode 100644 backend/app/api/routes.py create mode 100644 backend/app/api/websocket.py create mode 100644 backend/app/config.py create mode 100644 backend/app/game.py create mode 100644 backend/app/main.py create mode 100644 backend/app/models.py create mode 100644 backend/requirements.txt create mode 100644 backend/tests/test_api.py create mode 100644 docker-compose.yml create mode 100644 frontend/.gitignore create mode 100644 frontend/.oxlintrc.json create mode 100644 frontend/README.md create mode 100644 frontend/index.html create mode 100644 frontend/package-lock.json create mode 100644 frontend/package.json create mode 100644 frontend/public/favicon.svg create mode 100644 frontend/public/icons.svg create mode 100644 frontend/src/App.css create mode 100644 frontend/src/App.tsx create mode 100644 frontend/src/assets/hero.png create mode 100644 frontend/src/assets/react.svg create mode 100644 frontend/src/assets/vite.svg create mode 100644 frontend/src/components/BoardCanvas.tsx create mode 100644 frontend/src/components/Header.tsx create mode 100644 frontend/src/components/PlayerList.tsx create mode 100644 frontend/src/components/RegisterModal.tsx create mode 100644 frontend/src/hooks/useGameSocket.ts create mode 100644 frontend/src/index.css create mode 100644 frontend/src/main.tsx create mode 100644 frontend/src/types.ts create mode 100644 frontend/tsconfig.app.json create mode 100644 frontend/tsconfig.json create mode 100644 frontend/tsconfig.node.json create mode 100644 frontend/vite.config.ts diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..dad40ab --- /dev/null +++ b/.dockerignore @@ -0,0 +1,13 @@ +.git +.gitignore +.env +.venv +__pycache__ +*.pyc +*.pyo +*.pyd +.pytest_cache +node_modules +frontend/node_modules +frontend/dist +.DS_Store diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..e1249d8 --- /dev/null +++ b/.gitignore @@ -0,0 +1,328 @@ +# Created by https://www.toptal.com/developers/gitignore/api/python,node,linux +# Edit at https://www.toptal.com/developers/gitignore?templates=python,node,linux + +### Linux ### +*~ + +# temporary files which can be created if a process still has a handle open of a deleted file +.fuse_hidden* + +# KDE directory preferences +.directory + +# Linux trash folder which might appear on any partition or disk +.Trash-* + +# .nfs files are created when an open file is removed but is still being accessed +.nfs* + +### Node ### +# Logs +logs +*.log +npm-debug.log* +yarn-debug.log* +yarn-error.log* +lerna-debug.log* +.pnpm-debug.log* + +# Diagnostic reports (https://nodejs.org/api/report.html) +report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json + +# Runtime data +pids +*.pid +*.seed +*.pid.lock + +# Directory for instrumented libs generated by jscoverage/JSCover +lib-cov + +# Coverage directory used by tools like istanbul +coverage +*.lcov + +# nyc test coverage +.nyc_output + +# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files) +.grunt + +# Bower dependency directory (https://bower.io/) +bower_components + +# node-waf configuration +.lock-wscript + +# Compiled binary addons (https://nodejs.org/api/addons.html) +build/Release + +# Dependency directories +node_modules/ +jspm_packages/ + +# Snowpack dependency directory (https://snowpack.dev/) +web_modules/ + +# TypeScript cache +*.tsbuildinfo + +# Optional npm cache directory +.npm + +# Optional eslint cache +.eslintcache + +# Optional stylelint cache +.stylelintcache + +# Microbundle cache +.rpt2_cache/ +.rts2_cache_cjs/ +.rts2_cache_es/ +.rts2_cache_umd/ + +# Optional REPL history +.node_repl_history + +# Output of 'npm pack' +*.tgz + +# Yarn Integrity file +.yarn-integrity + +# dotenv environment variable files +.env +.env.development.local +.env.test.local +.env.production.local +.env.local + +# parcel-bundler cache (https://parceljs.org/) +.cache +.parcel-cache + +# Next.js build output +.next +out + +# Nuxt.js build / generate output +.nuxt +dist + +# Gatsby files +.cache/ +# Comment in the public line in if your project uses Gatsby and not Next.js +# https://nextjs.org/blog/next-9-1#public-directory-support +# public + +# vuepress build output +.vuepress/dist + +# vuepress v2.x temp and cache directory +.temp + +# Docusaurus cache and generated files +.docusaurus + +# Serverless directories +.serverless/ + +# FuseBox cache +.fusebox/ + +# DynamoDB Local files +.dynamodb/ + +# TernJS port file +.tern-port + +# Stores VSCode versions used for testing VSCode extensions +.vscode-test + +# yarn v2 +.yarn/cache +.yarn/unplugged +.yarn/build-state.yml +.yarn/install-state.gz +.pnp.* + +### Node Patch ### +# Serverless Webpack directories +.webpack/ + +# Optional stylelint cache + +# SvelteKit build / generate output +.svelte-kit + +### Python ### +# Byte-compiled / optimized / DLL files +__pycache__/ +*.py[cod] +*$py.class + +# C extensions +*.so + +# Distribution / packaging +.Python +build/ +develop-eggs/ +dist/ +downloads/ +eggs/ +.eggs/ +lib/ +lib64/ +parts/ +sdist/ +var/ +wheels/ +share/python-wheels/ +*.egg-info/ +.installed.cfg +*.egg +MANIFEST + +# PyInstaller +# Usually these files are written by a python script from a template +# before PyInstaller builds the exe, so as to inject date/other infos into it. +*.manifest +*.spec + +# Installer logs +pip-log.txt +pip-delete-this-directory.txt + +# Unit test / coverage reports +htmlcov/ +.tox/ +.nox/ +.coverage +.coverage.* +nosetests.xml +coverage.xml +*.cover +*.py,cover +.hypothesis/ +.pytest_cache/ +cover/ + +# Translations +*.mo +*.pot + +# Django stuff: +local_settings.py +db.sqlite3 +db.sqlite3-journal + +# Flask stuff: +instance/ +.webassets-cache + +# Scrapy stuff: +.scrapy + +# Sphinx documentation +docs/_build/ + +# PyBuilder +.pybuilder/ +target/ + +# Jupyter Notebook +.ipynb_checkpoints + +# IPython +profile_default/ +ipython_config.py + +# pyenv +# For a library or package, you might want to ignore these files since the code is +# intended to run in multiple environments; otherwise, check them in: +# .python-version + +# pipenv +# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control. +# However, in case of collaboration, if having platform-specific dependencies or dependencies +# having no cross-platform support, pipenv may install dependencies that don't work, or not +# install all needed dependencies. +#Pipfile.lock + +# poetry +# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control. +# This is especially recommended for binary packages to ensure reproducibility, and is more +# commonly ignored for libraries. +# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control +#poetry.lock + +# pdm +# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control. +#pdm.lock +# pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it +# in version control. +# https://pdm.fming.dev/#use-with-ide +.pdm.toml + +# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm +__pypackages__/ + +# Celery stuff +celerybeat-schedule +celerybeat.pid + +# SageMath parsed files +*.sage.py + +# Environments +.venv +env/ +venv/ +ENV/ +env.bak/ +venv.bak/ + +# Spyder project settings +.spyderproject +.spyproject + +# Rope project settings +.ropeproject + +# mkdocs documentation +/site + +# mypy +.mypy_cache/ +.dmypy.json +dmypy.json + +# Pyre type checker +.pyre/ + +# pytype static type analyzer +.pytype/ + +# Cython debug symbols +cython_debug/ + +# PyCharm +# JetBrains specific template is maintained in a separate JetBrains.gitignore that can +# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore +# and can be added to the global gitignore or merged into this file. For a more nuclear +# option (not recommended) you can uncomment the following to ignore the entire idea folder. +#.idea/ + +### Python Patch ### +# Poetry local configuration file - https://python-poetry.org/docs/configuration/#local-configuration +poetry.toml + +# ruff +.ruff_cache/ + +# LSP config files +pyrightconfig.json + +# End of https://www.toptal.com/developers/gitignore/api/python,node,linux diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..0e22592 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,49 @@ +# ========================================== +# Stage 1: Build Frontend (Vite + React + TS) +# ========================================== +FROM node:22-alpine AS frontend-builder + +WORKDIR /build/frontend + +# Install dependencies +COPY frontend/package*.json ./ +RUN npm ci || npm install + +# Build frontend production bundle +COPY frontend/ ./ +RUN npm run build + +# ========================================== +# Stage 2: Python Backend (FastAPI + Uvicorn) +# ========================================== +FROM python:3.12-slim AS production + +WORKDIR /app + +ENV PYTHONDONTWRITEBYTECODE=1 \ + PYTHONUNBUFFERED=1 \ + PYTHONPATH=/app/backend \ + PORT=8000 + +# Install curl for container healthcheck +RUN apt-get update && apt-get install -y --no-install-recommends curl && rm -rf /var/lib/apt/lists/* + +# Install backend Python dependencies +COPY backend/requirements.txt ./backend/requirements.txt +RUN pip install --no-cache-dir -r ./backend/requirements.txt + +# Copy backend source code +COPY backend ./backend + +# Copy compiled frontend from builder stage +COPY --from=frontend-builder /build/frontend/dist ./frontend/dist + +# Expose FastAPI application port +EXPOSE 8000 + +# Container healthcheck +HEALTHCHECK --interval=20s --timeout=5s --start-period=5s --retries=3 \ + CMD curl -f http://localhost:8000/api/health || exit 1 + +# Start FastAPI server via Uvicorn +CMD ["uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "8000"] diff --git a/README.md b/README.md new file mode 100644 index 0000000..21b8380 --- /dev/null +++ b/README.md @@ -0,0 +1,112 @@ +# botWebWars + +A FastAPI and React-based web arena featuring a real-time **64 × 64 grid** with coordinates ranging from `(0, 0)` to `(64, 64)`. Players register with their name and custom avatar color and are randomly placed onto the grid. + +--- + +## Features + +- **FastAPI Backend**: + - `POST /api/players` (or `/api/register`): Register a player with `name` and `color`. The game places them at a random unoccupied `(x, y)` coordinate between `(0, 0)` and `(64, 64)`. + - `GET /api/board`: Returns grid dimensions, player count, and player list. + - `GET /api/players`: Lists active players. + - `DELETE /api/players/{player_id}`: Remove a player from the arena. + - `POST /api/board/reset`: Reset the board and clear all players. + - `/ws`: Real-time WebSocket feed pushing live player spawns, departures, and board resets to all connected clients. + - Interactive OpenAPI/Swagger documentation at `/docs`. + +- **React + Vite + Tailwind CSS Frontend**: + - High-performance HTML5 Canvas rendering for the 64×64 arena with pan (click & drag), zoom (mouse wheel or zoom buttons), and grid coordinate rulers. + - Hover cursor coordinate tracker showing exact `(x, y)` coordinates. + - Glowing bot avatars rendered in the player's chosen color with nameplates and pulsing selection rings. + - Live registration modal with interactive color picker, cyberpunk color presets, and real-time avatar preview. + - Sidebar showing all active bots and coordinates; click any bot to focus the camera on them. + - 1-click **Quick Spawn Bot** button for rapid testing. + - Real-time synchronization via WebSockets with auto-reconnection. + +- **Dockerized Single-Container Deployment**: + - Multi-stage `Dockerfile` compiles the frontend with Node 22 and packages it into a lightweight Python 3.12 image. + - FastAPI serves both the API/WebSocket endpoints and the compiled SPA frontend. + +--- + +## Quick Start with Docker + +### Option 1: Docker Compose (Recommended) + +```bash +docker compose up --build +``` + +Open [http://localhost:8000](http://localhost:8000) in your browser. + +### Option 2: Docker CLI + +```bash +# Build the Docker image +docker build -t botwebwars . + +# Run the container +docker run -d -p 8000:8000 --name botwebwars botwebwars +``` + +- Webapp & Arena: [http://localhost:8000](http://localhost:8000) +- Swagger API Docs: [http://localhost:8000/docs](http://localhost:8000/docs) + +--- + +## API Usage Examples + +### Register a Player +```bash +curl -X POST http://localhost:8000/api/players \ + -H "Content-Type: application/json" \ + -d '{"name": "CyberViper", "color": "#38BDF8"}' +``` +Response: +```json +{ + "id": "bot_a1b2c3d4", + "name": "CyberViper", + "color": "#38BDF8", + "x": 42, + "y": 18, + "created_at": "2026-09-05T21:00:00.000000Z" +} +``` + +### Inspect Board State +```bash +curl http://localhost:8000/api/board +``` + +### Clear / Reset Board +```bash +curl -X POST http://localhost:8000/api/board/reset +``` + +--- + +## Local Development (Without Docker) + +### Backend +```bash +cd backend +python3 -m venv .venv +source .venv/bin/activate +pip install -r requirements.txt +uvicorn app.main:app --reload --port 8000 +``` + +### Frontend +```bash +cd frontend +npm install +npm run dev +``` +The Vite development server runs at [http://localhost:5173](http://localhost:5173) and proxies `/api` and `/ws` to FastAPI on port 8000. + +### Running Backend Tests +```bash +pytest backend/tests +``` diff --git a/backend/app/__init__.py b/backend/app/__init__.py new file mode 100644 index 0000000..348f177 --- /dev/null +++ b/backend/app/__init__.py @@ -0,0 +1 @@ +"""botWebWars backend package.""" diff --git a/backend/app/api/routes.py b/backend/app/api/routes.py new file mode 100644 index 0000000..e32824f --- /dev/null +++ b/backend/app/api/routes.py @@ -0,0 +1,122 @@ +from typing import List +from fastapi import APIRouter, HTTPException, status +from app.api.websocket import manager +from app.game import game_engine +from app.models import ApiResponse, BoardState, Player, PlayerCreate + +router = APIRouter() + + +@router.get("/health", response_model=ApiResponse, tags=["System"]) +async def health_check(): + return ApiResponse( + success=True, + message="botWebWars backend service is healthy", + data={"service": "FastAPI", "status": "running"}, + ) + + +@router.post( + "/players", + response_model=Player, + status_code=status.HTTP_201_CREATED, + summary="Register a new player on the board", + tags=["Players"], +) +@router.post( + "/register", + response_model=Player, + status_code=status.HTTP_201_CREATED, + include_in_schema=False, +) +async def register_player(player_in: PlayerCreate): + player = await game_engine.register_player(player_in) + + # Broadcast to all connected WebSocket clients + await manager.broadcast({ + "event": "player_joined", + "player": player.model_dump(), + "player_count": len(await game_engine.get_all_players()), + }) + + return player + + +@router.get( + "/players", + response_model=List[Player], + summary="List all registered players", + tags=["Players"], +) +async def list_players(): + return await game_engine.get_all_players() + + +@router.get( + "/players/{player_id}", + response_model=Player, + summary="Get details of a specific player", + tags=["Players"], +) +async def get_player(player_id: str): + player = await game_engine.get_player(player_id) + if not player: + raise HTTPException( + status_code=status.HTTP_404_NOT_FOUND, + detail=f"Player '{player_id}' not found", + ) + return player + + +@router.delete( + "/players/{player_id}", + response_model=ApiResponse, + summary="Remove a player from the board", + tags=["Players"], +) +async def remove_player(player_id: str): + removed = await game_engine.remove_player(player_id) + if not removed: + raise HTTPException( + status_code=status.HTTP_404_NOT_FOUND, + detail=f"Player '{player_id}' not found", + ) + + await manager.broadcast({ + "event": "player_left", + "player_id": player_id, + "player_count": len(await game_engine.get_all_players()), + }) + + return ApiResponse( + success=True, + message=f"Player '{player_id}' successfully removed", + ) + + +@router.get( + "/board", + response_model=BoardState, + summary="Get full board configuration and player positions", + tags=["Board"], +) +async def get_board(): + return await game_engine.get_board_state() + + +@router.post( + "/board/reset", + response_model=ApiResponse, + summary="Reset the board and clear all players", + tags=["Board"], +) +async def reset_board(): + await game_engine.reset() + await manager.broadcast({ + "event": "board_reset", + "player_count": 0, + }) + return ApiResponse( + success=True, + message="Board reset successfully. All players cleared.", + ) diff --git a/backend/app/api/websocket.py b/backend/app/api/websocket.py new file mode 100644 index 0000000..f447121 --- /dev/null +++ b/backend/app/api/websocket.py @@ -0,0 +1,38 @@ +import json +import logging +from typing import Set +from fastapi import WebSocket + +logger = logging.getLogger(__name__) + + +class ConnectionManager: + def __init__(self): + self.active_connections: Set[WebSocket] = set() + + async def connect(self, websocket: WebSocket): + await websocket.accept() + self.active_connections.add(websocket) + logger.info(f"WebSocket client connected. Total clients: {len(self.active_connections)}") + + def disconnect(self, websocket: WebSocket): + self.active_connections.discard(websocket) + logger.info(f"WebSocket client disconnected. Remaining clients: {len(self.active_connections)}") + + async def broadcast(self, message: dict): + if not self.active_connections: + return + payload = json.dumps(message, default=str) + stale_connections = set() + for connection in self.active_connections: + try: + await connection.send_text(payload) + except Exception as e: + logger.warning(f"Failed to send to WebSocket client: {e}") + stale_connections.add(connection) + + for stale in stale_connections: + self.active_connections.discard(stale) + + +manager = ConnectionManager() diff --git a/backend/app/config.py b/backend/app/config.py new file mode 100644 index 0000000..56136e1 --- /dev/null +++ b/backend/app/config.py @@ -0,0 +1,30 @@ +import os +from pathlib import Path +from pydantic_settings import BaseSettings, SettingsConfigDict + + +class Settings(BaseSettings): + model_config = SettingsConfigDict(env_prefix="BOTWEBWARS_") + + APP_NAME: str = "botWebWars" + DEBUG: bool = False + + # Board coordinates: 64x64 grid with coordinates from (0,0) to (64,64) + GRID_MIN_X: int = 0 + GRID_MAX_X: int = 64 + GRID_MIN_Y: int = 0 + GRID_MAX_Y: int = 64 + + # Max players before rejection or wrapping + MAX_PLAYERS: int = 4096 + + # Static files directory for frontend + FRONTEND_DIR: Path = Path( + os.getenv( + "BOTWEBWARS_FRONTEND_DIR", + str(Path(__file__).resolve().parent.parent.parent / "frontend" / "dist") + ) + ) + + +settings = Settings() diff --git a/backend/app/game.py b/backend/app/game.py new file mode 100644 index 0000000..3ed7397 --- /dev/null +++ b/backend/app/game.py @@ -0,0 +1,99 @@ +import asyncio +import random +import uuid +from typing import Dict, List, Optional, Tuple +from app.config import settings +from app.models import BoardConfig, BoardState, Player, PlayerCreate + + +class GameEngine: + def __init__(self): + self._lock = asyncio.Lock() + self.players: Dict[str, Player] = {} + self.config = BoardConfig( + min_x=settings.GRID_MIN_X, + max_x=settings.GRID_MAX_X, + min_y=settings.GRID_MIN_Y, + max_y=settings.GRID_MAX_Y, + grid_cells_x=settings.GRID_MAX_X - settings.GRID_MIN_X, + grid_cells_y=settings.GRID_MAX_Y - settings.GRID_MIN_Y, + ) + + def _get_occupied_coordinates(self) -> set[Tuple[int, int]]: + return {(p.x, p.y) for p in self.players.values()} + + def _find_random_free_position(self) -> Tuple[int, int]: + occupied = self._get_occupied_coordinates() + total_possible = (self.config.max_x - self.config.min_x + 1) * ( + self.config.max_y - self.config.min_y + 1 + ) + + if len(occupied) >= total_possible: + # All spots taken, fallback to random any spot + return ( + random.randint(self.config.min_x, self.config.max_x), + random.randint(self.config.min_y, self.config.max_y), + ) + + # Fast random sampling + for _ in range(100): + rx = random.randint(self.config.min_x, self.config.max_x) + ry = random.randint(self.config.min_y, self.config.max_y) + if (rx, ry) not in occupied: + return (rx, ry) + + # Fallback exhaustive search if dense + all_coords = [ + (x, y) + for x in range(self.config.min_x, self.config.max_x + 1) + for y in range(self.config.min_y, self.config.max_y + 1) + if (x, y) not in occupied + ] + return random.choice(all_coords) + + async def register_player(self, player_in: PlayerCreate) -> Player: + async with self._lock: + player_id = f"bot_{uuid.uuid4().hex[:8]}" + x, y = self._find_random_free_position() + + player = Player( + id=player_id, + name=player_in.name, + color=player_in.color, + x=x, + y=y, + ) + self.players[player_id] = player + return player + + async def get_player(self, player_id: str) -> Optional[Player]: + async with self._lock: + return self.players.get(player_id) + + async def get_all_players(self) -> List[Player]: + async with self._lock: + return list(self.players.values()) + + async def remove_player(self, player_id: str) -> bool: + async with self._lock: + if player_id in self.players: + del self.players[player_id] + return True + return False + + async def reset(self) -> None: + async with self._lock: + self.players.clear() + + async def get_board_state(self) -> BoardState: + async with self._lock: + players_list = list(self.players.values()) + return BoardState( + config=self.config, + player_count=len(players_list), + players=players_list, + ) + + +# Global game engine instance +game_engine = GameEngine() diff --git a/backend/app/main.py b/backend/app/main.py new file mode 100644 index 0000000..752569e --- /dev/null +++ b/backend/app/main.py @@ -0,0 +1,95 @@ +import json +import logging +from pathlib import Path +from fastapi import FastAPI, WebSocket, WebSocketDisconnect +from fastapi.middleware.cors import CORSMiddleware +from fastapi.responses import FileResponse +from fastapi.staticfiles import StaticFiles + +from app.api.routes import router as api_router +from app.api.websocket import manager +from app.config import settings +from app.game import game_engine + +logging.basicConfig( + level=logging.INFO, + format="%(asctime)s [%(levelname)s] %(name)s: %(message)s", +) +logger = logging.getLogger(__name__) + +app = FastAPI( + title="botWebWars API", + description="Backend service for botWebWars 64x64 grid battle arena.", + version="1.0.0", +) + +# Enable CORS for frontend development +app.add_middleware( + CORSMiddleware, + allow_origins=["*"], + allow_credentials=True, + allow_methods=["*"], + allow_headers=["*"], +) + +# Mount REST API routes +app.include_router(api_router, prefix="/api") + + +# WebSocket endpoint for real-time board updates +@app.websocket("/ws") +async def websocket_endpoint(websocket: WebSocket): + await manager.connect(websocket) + try: + # Immediately transmit current board state on connection + state = await game_engine.get_board_state() + await websocket.send_text( + json.dumps({"event": "init", "state": state.model_dump()}, default=str) + ) + + while True: + # Keep connection open, receive ping or client commands + data = await websocket.receive_text() + try: + msg = json.loads(data) + if msg.get("action") == "ping": + await websocket.send_text(json.dumps({"event": "pong"})) + except json.JSONDecodeError: + pass + except WebSocketDisconnect: + manager.disconnect(websocket) + except Exception as e: + logger.error(f"WebSocket error: {e}") + manager.disconnect(websocket) + + +# Mount static frontend files if built +frontend_dist = settings.FRONTEND_DIR +if frontend_dist.exists() and (frontend_dist / "index.html").exists(): + logger.info(f"Serving frontend static files from: {frontend_dist}") + + # Mount assets folder + assets_dir = frontend_dist / "assets" + if assets_dir.exists(): + app.mount("/assets", StaticFiles(directory=str(assets_dir)), name="assets") + + # SPA catch-all for root and unmatched GET paths (excluding /api and /ws) + @app.get("/{full_path:path}") + async def serve_spa(full_path: str): + # If the requested file directly exists inside frontend_dist, serve it + target_file = frontend_dist / full_path + if full_path and target_file.is_file(): + return FileResponse(target_file) + # Otherwise fallback to index.html for SPA routing + return FileResponse(frontend_dist / "index.html") +else: + logger.info("Frontend dist directory not found. Running in API-only mode.") + + @app.get("/") + async def root(): + return { + "message": "Welcome to botWebWars API! Frontend build not detected yet.", + "docs": "/docs", + "health": "/api/health", + "board": "/api/board", + } diff --git a/backend/app/models.py b/backend/app/models.py new file mode 100644 index 0000000..11a6550 --- /dev/null +++ b/backend/app/models.py @@ -0,0 +1,58 @@ +import re +from datetime import datetime, timezone +from typing import List, Optional +from pydantic import BaseModel, Field, field_validator + + +class PlayerCreate(BaseModel): + name: str = Field(..., min_length=1, max_length=32, description="Display name of the player") + color: str = Field(..., description="Hex color code (e.g. #FF5733) or valid CSS color name") + + @field_validator("name") + @classmethod + def validate_name(cls, v: str) -> str: + cleaned = v.strip() + if not cleaned: + raise ValueError("Player name cannot be empty or only whitespace") + return cleaned + + @field_validator("color") + @classmethod + def validate_color(cls, v: str) -> str: + cleaned = v.strip() + # Accept #RRGGBB, #RGB, or standard alphanumeric color names + if re.match(r"^#(?:[0-9a-fA-F]{3}){1,2}$", cleaned): + return cleaned.upper() + if re.match(r"^[a-zA-Z]{3,20}$", cleaned): + return cleaned.lower() + raise ValueError("Color must be a valid hex code (e.g. #FF4444) or color name (e.g. crimson)") + + +class Player(BaseModel): + id: str + name: str + color: str + x: int + y: int + created_at: datetime = Field(default_factory=lambda: datetime.now(timezone.utc)) + + +class BoardConfig(BaseModel): + min_x: int = 0 + max_x: int = 64 + min_y: int = 0 + max_y: int = 64 + grid_cells_x: int = 64 + grid_cells_y: int = 64 + + +class BoardState(BaseModel): + config: BoardConfig + player_count: int + players: List[Player] + + +class ApiResponse(BaseModel): + success: bool + message: str + data: Optional[dict] = None diff --git a/backend/requirements.txt b/backend/requirements.txt new file mode 100644 index 0000000..aef47ba --- /dev/null +++ b/backend/requirements.txt @@ -0,0 +1,8 @@ +fastapi>=0.110.0 +uvicorn[standard]>=0.28.0 +pydantic>=2.6.0 +pydantic-settings>=2.2.0 +websockets>=12.0 +httpx>=0.27.0 +pytest>=8.0.0 +pytest-asyncio>=0.23.0 diff --git a/backend/tests/test_api.py b/backend/tests/test_api.py new file mode 100644 index 0000000..33e8ce5 --- /dev/null +++ b/backend/tests/test_api.py @@ -0,0 +1,82 @@ +import pytest +from fastapi.testclient import TestClient +from app.main import app +from app.game import game_engine + + +@pytest.fixture(autouse=True) +def reset_board_state(): + import asyncio + asyncio.run(game_engine.reset()) + yield + asyncio.run(game_engine.reset()) + + +def test_health(): + client = TestClient(app) + response = client.get("/api/health") + assert response.status_code == 200 + data = response.json() + assert data["success"] is True + assert "FastAPI" in data["message"] or data["data"]["service"] == "FastAPI" + + +def test_register_player(): + client = TestClient(app) + res = client.post("/api/players", json={"name": "CyberBot", "color": "#00FFAA"}) + assert res.status_code == 201 + player = res.json() + assert player["name"] == "CyberBot" + assert player["color"] == "#00FFAA" + assert 0 <= player["x"] <= 64 + assert 0 <= player["y"] <= 64 + assert "id" in player + + +def test_register_alias_endpoint(): + client = TestClient(app) + res = client.post("/api/register", json={"name": "AliasBot", "color": "#FF00FF"}) + assert res.status_code == 201 + player = res.json() + assert player["name"] == "AliasBot" + assert 0 <= player["x"] <= 64 + assert 0 <= player["y"] <= 64 + + +def test_board_state_after_registrations(): + client = TestClient(app) + client.post("/api/players", json={"name": "Bot1", "color": "#FF0000"}) + client.post("/api/players", json={"name": "Bot2", "color": "#0000FF"}) + + res = client.get("/api/board") + assert res.status_code == 200 + board = res.json() + assert board["player_count"] == 2 + assert len(board["players"]) == 2 + assert board["config"]["min_x"] == 0 + assert board["config"]["max_x"] == 64 + assert board["config"]["min_y"] == 0 + assert board["config"]["max_y"] == 64 + + +def test_player_deletion_and_reset(): + client = TestClient(app) + reg_res = client.post("/api/players", json={"name": "TempBot", "color": "#123456"}) + player_id = reg_res.json()["id"] + + del_res = client.delete(f"/api/players/{player_id}") + assert del_res.status_code == 200 + + board_res = client.get("/api/board") + assert board_res.json()["player_count"] == 0 + + +def test_validation_errors(): + client = TestClient(app) + # Empty name + res = client.post("/api/players", json={"name": " ", "color": "#FF0000"}) + assert res.status_code == 422 + + # Invalid color + res = client.post("/api/players", json={"name": "Bot", "color": "not-a-color-123456789"}) + assert res.status_code == 422 diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..f5bfcb2 --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,11 @@ +services: + app: + build: + context: . + dockerfile: Dockerfile + container_name: botwebwars + ports: + - "8000:8000" + environment: + - BOTWEBWARS_DEBUG=false + restart: unless-stopped diff --git a/frontend/.gitignore b/frontend/.gitignore new file mode 100644 index 0000000..a547bf3 --- /dev/null +++ b/frontend/.gitignore @@ -0,0 +1,24 @@ +# Logs +logs +*.log +npm-debug.log* +yarn-debug.log* +yarn-error.log* +pnpm-debug.log* +lerna-debug.log* + +node_modules +dist +dist-ssr +*.local + +# Editor directories and files +.vscode/* +!.vscode/extensions.json +.idea +.DS_Store +*.suo +*.ntvs* +*.njsproj +*.sln +*.sw? diff --git a/frontend/.oxlintrc.json b/frontend/.oxlintrc.json new file mode 100644 index 0000000..6fa991d --- /dev/null +++ b/frontend/.oxlintrc.json @@ -0,0 +1,8 @@ +{ + "$schema": "./node_modules/oxlint/configuration_schema.json", + "plugins": ["react", "typescript", "oxc"], + "rules": { + "react/rules-of-hooks": "error", + "react/only-export-components": ["warn", { "allowConstantExport": true }] + } +} diff --git a/frontend/README.md b/frontend/README.md new file mode 100644 index 0000000..d6af7e3 --- /dev/null +++ b/frontend/README.md @@ -0,0 +1,32 @@ +# React + TypeScript + Vite + +This template provides a minimal setup to get React working in Vite with HMR and some Oxlint rules. + +Currently, two official plugins are available: + +- [@vitejs/plugin-react](https://github.com/vitejs/vite-plugin-react/blob/main/packages/plugin-react) uses [Oxc](https://oxc.rs) +- [@vitejs/plugin-react-swc](https://github.com/vitejs/vite-plugin-react/blob/main/packages/plugin-react-swc) uses [SWC](https://swc.rs/) + +## React Compiler + +The React Compiler is not enabled on this template because of its impact on dev & build performances. To add it, see [this documentation](https://react.dev/learn/react-compiler/installation). + +## Expanding the Oxlint configuration + +If you are developing a production application, we recommend enabling type-aware lint rules by installing `oxlint-tsgolint` and editing `.oxlintrc.json`: + +```json +{ + "$schema": "./node_modules/oxlint/configuration_schema.json", + "plugins": ["react", "typescript", "oxc"], + "options": { + "typeAware": true + }, + "rules": { + "react/rules-of-hooks": "error", + "react/only-export-components": ["warn", { "allowConstantExport": true }] + } +} +``` + +See the [Oxlint rules documentation](https://oxc.rs/docs/guide/usage/linter/rules) for the full list of rules and categories. diff --git a/frontend/index.html b/frontend/index.html new file mode 100644 index 0000000..f4af7b7 --- /dev/null +++ b/frontend/index.html @@ -0,0 +1,13 @@ + + + + + + + botWebWars • 64x64 Grid Arena + + +
+ + + diff --git a/frontend/package-lock.json b/frontend/package-lock.json new file mode 100644 index 0000000..dbb41e0 --- /dev/null +++ b/frontend/package-lock.json @@ -0,0 +1,1874 @@ +{ + "name": "frontend-temp", + "version": "0.0.0", + "lockfileVersion": 3, + "requires": true, + "packages": { + "": { + "name": "frontend-temp", + "version": "0.0.0", + "dependencies": { + "@tailwindcss/vite": "^4.3.3", + "lucide-react": "^1.41.0", + "react": "^19.2.8", + "react-dom": "^19.2.8", + "tailwindcss": "^4.3.3" + }, + "devDependencies": { + "@types/node": "^24.13.3", + "@types/react": "^19.2.18", + "@types/react-dom": "^19.2.4", + "@vitejs/plugin-react": "^6.1.0", + "oxlint": "^1.79.0", + "typescript": "~6.0.2", + "vite": "^8.2.2" + } + }, + "node_modules/@jridgewell/gen-mapping": { + "version": "0.3.13", + "resolved": "https://registry.npmjs.org/@jridgewell/gen-mapping/-/gen-mapping-0.3.13.tgz", + "integrity": "sha512-2kkt/7niJ6MgEPxF0bYdQ6etZaA+fQvDcLKckhy1yIQOzaoKjBBjSj63/aLVjYE3qhRt5dvM+uUyfCg6UKCBbA==", + "license": "MIT", + "dependencies": { + "@jridgewell/sourcemap-codec": "^1.5.0", + "@jridgewell/trace-mapping": "^0.3.24" + } + }, + "node_modules/@jridgewell/remapping": { + "version": "2.3.5", + "resolved": "https://registry.npmjs.org/@jridgewell/remapping/-/remapping-2.3.5.tgz", + "integrity": "sha512-LI9u/+laYG4Ds1TDKSJW2YPrIlcVYOwi2fUC6xB43lueCjgxV4lffOCZCtYFiH6TNOX+tQKXx97T4IKHbhyHEQ==", + "license": "MIT", + "dependencies": { + "@jridgewell/gen-mapping": "^0.3.5", + "@jridgewell/trace-mapping": "^0.3.24" + } + }, + "node_modules/@jridgewell/resolve-uri": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/@jridgewell/resolve-uri/-/resolve-uri-3.1.2.tgz", + "integrity": "sha512-bRISgCIjP20/tbWSPWMEi54QVPRZExkuD9lJL+UIxUKtwVJA8wW1Trb1jMs1RFXo1CBTNZ/5hpC9QvmKWdopKw==", + "license": "MIT", + "engines": { + "node": ">=6.0.0" + } + }, + "node_modules/@jridgewell/sourcemap-codec": { + "version": "1.6.0", + "resolved": "https://registry.npmjs.org/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.6.0.tgz", + "integrity": "sha512-T7jf+5zgsZHwNJ4lvQ7/aezbyk0nNX+zJVWpmHA7VYsEx7a7qr5Rg5IbtJFqkgze5Y2sruq1RUY8Q837Od7iFw==", + "license": "MIT" + }, + "node_modules/@jridgewell/trace-mapping": { + "version": "0.3.31", + "resolved": "https://registry.npmjs.org/@jridgewell/trace-mapping/-/trace-mapping-0.3.31.tgz", + "integrity": "sha512-zzNR+SdQSDJzc8joaeP8QQoCQr8NuYx2dIIytl1QeBEZHJ9uW6hebsrYgbz8hJwUQao3TWCMtmfV8Nu1twOLAw==", + "license": "MIT", + "dependencies": { + "@jridgewell/resolve-uri": "^3.1.0", + "@jridgewell/sourcemap-codec": "^1.4.14" + } + }, + "node_modules/@oxc-project/types": { + "version": "0.148.0", + "resolved": "https://registry.npmjs.org/@oxc-project/types/-/types-0.148.0.tgz", + "integrity": "sha512-Nm4s/jB+4FpFsPhWGEC4h7rzksesmtnMXomo6rCMcg/b8zLQuOziRgkCS1fxDCXOlJB/6Q8oABOZ/OP6RIPj9A==", + "license": "MIT", + "funding": { + "url": "https://github.com/sponsors/oxc-project" + } + }, + "node_modules/@oxlint/binding-android-arm-eabi": { + "version": "1.81.0", + "resolved": "https://registry.npmjs.org/@oxlint/binding-android-arm-eabi/-/binding-android-arm-eabi-1.81.0.tgz", + "integrity": "sha512-IcCRsXiedJoJopY6mpZUBEeVFsUrutmrG7dZ87zMuKJlhg70Ora9bBl1WcCxZQtyI10YpnVdEso5oCg7YcfSHw==", + "cpu": [ + "arm" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@oxlint/binding-android-arm64": { + "version": "1.81.0", + "resolved": "https://registry.npmjs.org/@oxlint/binding-android-arm64/-/binding-android-arm64-1.81.0.tgz", + "integrity": "sha512-GRrIPyTGVhx3L3h+0T5xT2A0jFAcdPv4+IfuXpGDLIdl6XeYhgg/zw72A5ILZoUgRqZuM8F1y+V/gfDriXSxzQ==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@oxlint/binding-darwin-arm64": { + "version": "1.81.0", + "resolved": "https://registry.npmjs.org/@oxlint/binding-darwin-arm64/-/binding-darwin-arm64-1.81.0.tgz", + "integrity": "sha512-qNQ9tXRgLuKbqSV1S2h9h4KPHjbovO7RRR2/enUOtHzTkFZ7B9X5zqqHJua8dRyc7dBy7Aoyq5pqTSLFVcAzGQ==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@oxlint/binding-darwin-x64": { + "version": "1.81.0", + "resolved": "https://registry.npmjs.org/@oxlint/binding-darwin-x64/-/binding-darwin-x64-1.81.0.tgz", + "integrity": "sha512-q0QTm32jWga2Gv4j7IaVZN0jYMi9UV73sWVgFtDA4iIfqwMCLLZ3ve+9KwfYtsaKZSgQhmPaogeZWqDZpcY1Pw==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@oxlint/binding-freebsd-x64": { + "version": "1.81.0", + "resolved": "https://registry.npmjs.org/@oxlint/binding-freebsd-x64/-/binding-freebsd-x64-1.81.0.tgz", + "integrity": "sha512-/+8wVWDXEC7wHVAhOc59Fw/SkMc1arLkFD8iQCaSsmzenK1X4doFqquL9H1wrtGUzaiycVqkf/sSpcILK6W1UA==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "freebsd" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@oxlint/binding-linux-arm-gnueabihf": { + "version": "1.81.0", + "resolved": "https://registry.npmjs.org/@oxlint/binding-linux-arm-gnueabihf/-/binding-linux-arm-gnueabihf-1.81.0.tgz", + "integrity": "sha512-4xt422FEgioRq9hAL4Tq7fujGUWnc8z1BJ+Oi8RN8vB8axaP+sdK6a2xdlcQCCYnJg9QMuMFS0AucuIFx/EacA==", + "cpu": [ + "arm" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@oxlint/binding-linux-arm-musleabihf": { + "version": "1.81.0", + "resolved": "https://registry.npmjs.org/@oxlint/binding-linux-arm-musleabihf/-/binding-linux-arm-musleabihf-1.81.0.tgz", + "integrity": "sha512-u3vna8KdGplH4DRCW9K54D68fcMo7IxVrkCJWwXnIhwtBdnDnYrmzOUA/XjmBlPpcLsgw9Z5BNdY4za9+Dj+MQ==", + "cpu": [ + "arm" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@oxlint/binding-linux-arm64-gnu": { + "version": "1.81.0", + "resolved": "https://registry.npmjs.org/@oxlint/binding-linux-arm64-gnu/-/binding-linux-arm64-gnu-1.81.0.tgz", + "integrity": "sha512-3j9k+gsYsE7nv71GWotXsqsa2l9/aJenD7dVHNt/CBvsb0SgRjSMnHFeP59IXUAl1wvVFhqGl2wJNMwWU3UBlA==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@oxlint/binding-linux-arm64-musl": { + "version": "1.81.0", + "resolved": "https://registry.npmjs.org/@oxlint/binding-linux-arm64-musl/-/binding-linux-arm64-musl-1.81.0.tgz", + "integrity": "sha512-k5iAp3dNxW0/uDCBY+WSm8jKB2szu7SkEQZdgRRpDXvuDd69vvDcqhB3A/pWCfCwXyenjNjFn9Td1fVoyAc+Yg==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@oxlint/binding-linux-ppc64-gnu": { + "version": "1.81.0", + "resolved": "https://registry.npmjs.org/@oxlint/binding-linux-ppc64-gnu/-/binding-linux-ppc64-gnu-1.81.0.tgz", + "integrity": "sha512-TFqLja3uYmVSte6nof9GWrex9Z8WgdZrNiLC6Te5rXGDqXB2y4j/26iFhwosXiAFqDhE9JJVuuCkDKLwptTn1g==", + "cpu": [ + "ppc64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@oxlint/binding-linux-riscv64-gnu": { + "version": "1.81.0", + "resolved": "https://registry.npmjs.org/@oxlint/binding-linux-riscv64-gnu/-/binding-linux-riscv64-gnu-1.81.0.tgz", + "integrity": "sha512-UEcySvGS0NOVo7h7n7CYyJL9+6gFAh7Zc/ToDXVScFvzHSTIxtzkMVU30rmQ6+nQ1LF+UdiRDdJajpDu+OylLg==", + "cpu": [ + "riscv64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@oxlint/binding-linux-riscv64-musl": { + "version": "1.81.0", + "resolved": "https://registry.npmjs.org/@oxlint/binding-linux-riscv64-musl/-/binding-linux-riscv64-musl-1.81.0.tgz", + "integrity": "sha512-H+diDbhD00+wI1IRP8Kz88x/lat+DgtoBJzoTthS16xkTJGNaEkfb8gzmd1rzc/2uDQQMl7GNl+JFUacVeWxIA==", + "cpu": [ + "riscv64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@oxlint/binding-linux-s390x-gnu": { + "version": "1.81.0", + "resolved": "https://registry.npmjs.org/@oxlint/binding-linux-s390x-gnu/-/binding-linux-s390x-gnu-1.81.0.tgz", + "integrity": "sha512-8znJ/5TekjOKg1j1Acho4PJMdiAHLtlcXuWEiipOhAMV6rQcXdmDdXCbheyDczN6TjBwiNfjcP81k4AthrKRzw==", + "cpu": [ + "s390x" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@oxlint/binding-linux-x64-gnu": { + "version": "1.81.0", + "resolved": "https://registry.npmjs.org/@oxlint/binding-linux-x64-gnu/-/binding-linux-x64-gnu-1.81.0.tgz", + "integrity": "sha512-Q2Wj70yFsvn5QjlmifFzbj4H+kJy53bwqc41o1fzoM7MpLV1NIbhg/LpWXRfC6KOkSAdUx1Wd8VJsdPmhp/HRA==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@oxlint/binding-linux-x64-musl": { + "version": "1.81.0", + "resolved": "https://registry.npmjs.org/@oxlint/binding-linux-x64-musl/-/binding-linux-x64-musl-1.81.0.tgz", + "integrity": "sha512-cPInHp/ddEe5qkyK2IiyQ8Q3Mp2oLLEhhsGgTK2oZx4L6+llGam1H1yBvJZ7qHfOXj8N3hxBS8sj4tO+gtFlIg==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@oxlint/binding-openharmony-arm64": { + "version": "1.81.0", + "resolved": "https://registry.npmjs.org/@oxlint/binding-openharmony-arm64/-/binding-openharmony-arm64-1.81.0.tgz", + "integrity": "sha512-0CQxSX4ajqm07AHBf5U33qQzXKdd7wtq/oTL/7vpY6RNNuxrRi8W4bqUV1Jyu/vj+9KmxQyDhxfeVX1nQL6kfg==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "openharmony" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@oxlint/binding-win32-arm64-msvc": { + "version": "1.81.0", + "resolved": "https://registry.npmjs.org/@oxlint/binding-win32-arm64-msvc/-/binding-win32-arm64-msvc-1.81.0.tgz", + "integrity": "sha512-l0hbeISm9673hVrrQU8j/p2M7YH9Ouoj7p7E/QM55NTrKVLP+P3PF8hLu+OY+x0VtGRW+ggiQKZqmdYps9H+TA==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@oxlint/binding-win32-ia32-msvc": { + "version": "1.81.0", + "resolved": "https://registry.npmjs.org/@oxlint/binding-win32-ia32-msvc/-/binding-win32-ia32-msvc-1.81.0.tgz", + "integrity": "sha512-ksqPP5jbFXcYreEQ7zdJh06rJQBymCTyGRCdaXjfcf2aG4f8KxUWY5wcgYHmaTK+FJ4bPG5sUAdOX+6trnH1JA==", + "cpu": [ + "ia32" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@oxlint/binding-win32-x64-msvc": { + "version": "1.81.0", + "resolved": "https://registry.npmjs.org/@oxlint/binding-win32-x64-msvc/-/binding-win32-x64-msvc-1.81.0.tgz", + "integrity": "sha512-IZuUCwGw9emG5JtCp+fYGB+Z4OWEoeEcM8R5BA1pYw63/ieYFVdcU2ylxTpHbVHSenZnsYE+ZZ20uHAJszQ4cA==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@rolldown/binding-android-arm-eabi": { + "version": "1.2.7", + "resolved": "https://registry.npmjs.org/@rolldown/binding-android-arm-eabi/-/binding-android-arm-eabi-1.2.7.tgz", + "integrity": "sha512-EypzgnYCwyVY4NDHKzGmNJT5b+XaQEBniHxsMdeIQLB/tcCzZnhqrzHpZFbX9iaxx+5RiB8caATBtfvZP7zVxQ==", + "cpu": [ + "arm" + ], + "license": "MIT", + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@rolldown/binding-android-arm64": { + "version": "1.2.7", + "resolved": "https://registry.npmjs.org/@rolldown/binding-android-arm64/-/binding-android-arm64-1.2.7.tgz", + "integrity": "sha512-l17HE9EweWaqJZhuUuNBN/FzM62xw+DECVnJyvMsxn8vJFAGLy5QfLDoYAcronkAN8VxKZHezDpulHDPx95vFw==", + "cpu": [ + "arm64" + ], + "license": "MIT", + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@rolldown/binding-darwin-arm64": { + "version": "1.2.7", + "resolved": "https://registry.npmjs.org/@rolldown/binding-darwin-arm64/-/binding-darwin-arm64-1.2.7.tgz", + "integrity": "sha512-8ED8ELFvHXc6OCETIn4gXObPiaR6bckM/ipXtbzlPVDRMBfEGjCKgO90F9YtfdpDatVx/ZQw7aZ1vUMf/+T3Mw==", + "cpu": [ + "arm64" + ], + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@rolldown/binding-darwin-x64": { + "version": "1.2.7", + "resolved": "https://registry.npmjs.org/@rolldown/binding-darwin-x64/-/binding-darwin-x64-1.2.7.tgz", + "integrity": "sha512-/WPripjtiAIZ2tWY7ddijORT0Ujg87wxWW/qcoFVCKAWVDPhtY0xr7Dj0M3GyNGz60jGwTElhro/mkF9dT7dDQ==", + "cpu": [ + "x64" + ], + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@rolldown/binding-freebsd-x64": { + "version": "1.2.7", + "resolved": "https://registry.npmjs.org/@rolldown/binding-freebsd-x64/-/binding-freebsd-x64-1.2.7.tgz", + "integrity": "sha512-14DI4NcqpvbICxSnGLx3PmtDaWqRP/KGSGb6C+JLLVPeZRl6dKdHba3pGsqT3vpdTqhEYIPG0MMQ8c0xYqoJxA==", + "cpu": [ + "x64" + ], + "license": "MIT", + "optional": true, + "os": [ + "freebsd" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@rolldown/binding-linux-arm-gnueabihf": { + "version": "1.2.7", + "resolved": "https://registry.npmjs.org/@rolldown/binding-linux-arm-gnueabihf/-/binding-linux-arm-gnueabihf-1.2.7.tgz", + "integrity": "sha512-bxrWIRvHWQvbJwi+VIie/kDJmQxcNE6xxWwZdqF/ExVAigtHkv54WTLQPb+QsZdnFy18fg7JPfWGL0RH6vwIlQ==", + "cpu": [ + "arm" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@rolldown/binding-linux-arm64-gnu": { + "version": "1.2.7", + "resolved": "https://registry.npmjs.org/@rolldown/binding-linux-arm64-gnu/-/binding-linux-arm64-gnu-1.2.7.tgz", + "integrity": "sha512-toOY2BChBZyuxU7OYX6Tn389di4IzAqPTycVcci0O7FSfBqzRB3RZn+K5Is6ANf4tmgRd/K1yZTsNTXbkXsnLg==", + "cpu": [ + "arm64" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@rolldown/binding-linux-arm64-musl": { + "version": "1.2.7", + "resolved": "https://registry.npmjs.org/@rolldown/binding-linux-arm64-musl/-/binding-linux-arm64-musl-1.2.7.tgz", + "integrity": "sha512-lAIXTH/aiLRLxsTgQvfhjo4K1ydWIp00+V0voOr9beb/9ZmkUFrSIb03dXNFRgMNvkE6oGsF10ioQ6UsI+vS5Q==", + "cpu": [ + "arm64" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@rolldown/binding-linux-ppc64-gnu": { + "version": "1.2.7", + "resolved": "https://registry.npmjs.org/@rolldown/binding-linux-ppc64-gnu/-/binding-linux-ppc64-gnu-1.2.7.tgz", + "integrity": "sha512-kdnwS28Pkenp/mZMRwjXXXwxQ7pIsm+bF919LUK93BOyhcLsrVKdP2p9fxpiPNPAbNuch8ypQt0pm2P2LYCAGg==", + "cpu": [ + "ppc64" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@rolldown/binding-linux-s390x-gnu": { + "version": "1.2.7", + "resolved": "https://registry.npmjs.org/@rolldown/binding-linux-s390x-gnu/-/binding-linux-s390x-gnu-1.2.7.tgz", + "integrity": "sha512-516OdsyLdr5E65paF3yBF55t8mfm9+gmtCsK3xI7XKXIT7EfRlHhxL8K/NR6Hu8BWSgF5+1w74lTL0+nxcc8Qw==", + "cpu": [ + "s390x" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@rolldown/binding-linux-x64-gnu": { + "version": "1.2.7", + "resolved": "https://registry.npmjs.org/@rolldown/binding-linux-x64-gnu/-/binding-linux-x64-gnu-1.2.7.tgz", + "integrity": "sha512-r8/z8n7GFaYRln3xmP1Cxy0HH/HLM0uBUPkEuSVEfKGDA89M0FsZRZJRSwe/tJjRx+fpH/gjorfhB8tmEbSFLA==", + "cpu": [ + "x64" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@rolldown/binding-linux-x64-musl": { + "version": "1.2.7", + "resolved": "https://registry.npmjs.org/@rolldown/binding-linux-x64-musl/-/binding-linux-x64-musl-1.2.7.tgz", + "integrity": "sha512-pAsE8iiDxUg1xBqdhrTfg45AVDVpirjz00sblEYClGNNcMnDb+e8beQgqIAw6LvauX/APvgxUnwrgun/YYGBhw==", + "cpu": [ + "x64" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@rolldown/binding-openharmony-arm64": { + "version": "1.2.7", + "resolved": "https://registry.npmjs.org/@rolldown/binding-openharmony-arm64/-/binding-openharmony-arm64-1.2.7.tgz", + "integrity": "sha512-lTcIYmmnQQA8Or/2DatS6oSqcdLHvendjS+zLu+FwgToynWMRSmQdpM65fTANJgIS4mjbMOo5KT2lnT9SAb96w==", + "cpu": [ + "arm64" + ], + "license": "MIT", + "optional": true, + "os": [ + "openharmony" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@rolldown/binding-win32-arm64-msvc": { + "version": "1.2.7", + "resolved": "https://registry.npmjs.org/@rolldown/binding-win32-arm64-msvc/-/binding-win32-arm64-msvc-1.2.7.tgz", + "integrity": "sha512-e3Gu3WxbNk/UqQhxqU7YIYO+9ZBvWNz3U+h/qRFosscMFzdRPbXYSaSWgSnklv2fz1TgzBTcti2z35c/7irsHw==", + "cpu": [ + "arm64" + ], + "license": "MIT", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@rolldown/binding-win32-x64-msvc": { + "version": "1.2.7", + "resolved": "https://registry.npmjs.org/@rolldown/binding-win32-x64-msvc/-/binding-win32-x64-msvc-1.2.7.tgz", + "integrity": "sha512-W/jg5qoRSqjsEv0+dZi4e687mcHqmVuU0P4fK6qS/xjetW2Gmc1W8j//z5nAeNcC8Ttm0hV46IjcYeuVwYhuiw==", + "cpu": [ + "x64" + ], + "license": "MIT", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@rolldown/pluginutils": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/@rolldown/pluginutils/-/pluginutils-1.0.1.tgz", + "integrity": "sha512-2j9bGt5Jh8hj+vPtgzPtl72j0yRxHAyumoo6TNfAjsLB04UtpSvPbPcDcBMxz7n+9CYB0c1GxQFxYRg2jimqGw==", + "license": "MIT" + }, + "node_modules/@tailwindcss/node": { + "version": "4.3.3", + "resolved": "https://registry.npmjs.org/@tailwindcss/node/-/node-4.3.3.tgz", + "integrity": "sha512-/T8IKEsf9VTU6tLjgC7+sv2mOPtQxzE2jMw7u4Tt40Tx+QSZxpzh95/H6cMKoja9XuW7iMdLJYBB0o9G1CaAgg==", + "license": "MIT", + "dependencies": { + "@jridgewell/remapping": "^2.3.5", + "enhanced-resolve": "^5.24.1", + "jiti": "^2.7.0", + "lightningcss": "1.32.0", + "magic-string": "^0.30.21", + "source-map-js": "^1.2.1", + "tailwindcss": "4.3.3" + } + }, + "node_modules/@tailwindcss/node/node_modules/lightningcss": { + "version": "1.32.0", + "resolved": "https://registry.npmjs.org/lightningcss/-/lightningcss-1.32.0.tgz", + "integrity": "sha512-NXYBzinNrblfraPGyrbPoD19C1h9lfI/1mzgWYvXUTe414Gz/X1FD2XBZSZM7rRTrMA8JL3OtAaGifrIKhQ5yQ==", + "license": "MPL-2.0", + "dependencies": { + "detect-libc": "^2.0.3" + }, + "engines": { + "node": ">= 12.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/parcel" + }, + "optionalDependencies": { + "lightningcss-android-arm64": "1.32.0", + "lightningcss-darwin-arm64": "1.32.0", + "lightningcss-darwin-x64": "1.32.0", + "lightningcss-freebsd-x64": "1.32.0", + "lightningcss-linux-arm-gnueabihf": "1.32.0", + "lightningcss-linux-arm64-gnu": "1.32.0", + "lightningcss-linux-arm64-musl": "1.32.0", + "lightningcss-linux-x64-gnu": "1.32.0", + "lightningcss-linux-x64-musl": "1.32.0", + "lightningcss-win32-arm64-msvc": "1.32.0", + "lightningcss-win32-x64-msvc": "1.32.0" + } + }, + "node_modules/@tailwindcss/node/node_modules/lightningcss-android-arm64": { + "version": "1.32.0", + "resolved": "https://registry.npmjs.org/lightningcss-android-arm64/-/lightningcss-android-arm64-1.32.0.tgz", + "integrity": "sha512-YK7/ClTt4kAK0vo6w3X+Pnm0D2cf2vPHbhOXdoNti1Ga0al1P4TBZhwjATvjNwLEBCnKvjJc2jQgHXH0NEwlAg==", + "cpu": [ + "arm64" + ], + "license": "MPL-2.0", + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": ">= 12.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/parcel" + } + }, + "node_modules/@tailwindcss/node/node_modules/lightningcss-darwin-arm64": { + "version": "1.32.0", + "resolved": "https://registry.npmjs.org/lightningcss-darwin-arm64/-/lightningcss-darwin-arm64-1.32.0.tgz", + "integrity": "sha512-RzeG9Ju5bag2Bv1/lwlVJvBE3q6TtXskdZLLCyfg5pt+HLz9BqlICO7LZM7VHNTTn/5PRhHFBSjk5lc4cmscPQ==", + "cpu": [ + "arm64" + ], + "license": "MPL-2.0", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">= 12.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/parcel" + } + }, + "node_modules/@tailwindcss/node/node_modules/lightningcss-darwin-x64": { + "version": "1.32.0", + "resolved": "https://registry.npmjs.org/lightningcss-darwin-x64/-/lightningcss-darwin-x64-1.32.0.tgz", + "integrity": "sha512-U+QsBp2m/s2wqpUYT/6wnlagdZbtZdndSmut/NJqlCcMLTWp5muCrID+K5UJ6jqD2BFshejCYXniPDbNh73V8w==", + "cpu": [ + "x64" + ], + "license": "MPL-2.0", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">= 12.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/parcel" + } + }, + "node_modules/@tailwindcss/node/node_modules/lightningcss-freebsd-x64": { + "version": "1.32.0", + "resolved": "https://registry.npmjs.org/lightningcss-freebsd-x64/-/lightningcss-freebsd-x64-1.32.0.tgz", + "integrity": "sha512-JCTigedEksZk3tHTTthnMdVfGf61Fky8Ji2E4YjUTEQX14xiy/lTzXnu1vwiZe3bYe0q+SpsSH/CTeDXK6WHig==", + "cpu": [ + "x64" + ], + "license": "MPL-2.0", + "optional": true, + "os": [ + "freebsd" + ], + "engines": { + "node": ">= 12.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/parcel" + } + }, + "node_modules/@tailwindcss/node/node_modules/lightningcss-linux-arm-gnueabihf": { + "version": "1.32.0", + "resolved": "https://registry.npmjs.org/lightningcss-linux-arm-gnueabihf/-/lightningcss-linux-arm-gnueabihf-1.32.0.tgz", + "integrity": "sha512-x6rnnpRa2GL0zQOkt6rts3YDPzduLpWvwAF6EMhXFVZXD4tPrBkEFqzGowzCsIWsPjqSK+tyNEODUBXeeVHSkw==", + "cpu": [ + "arm" + ], + "license": "MPL-2.0", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">= 12.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/parcel" + } + }, + "node_modules/@tailwindcss/node/node_modules/lightningcss-linux-arm64-gnu": { + "version": "1.32.0", + "resolved": "https://registry.npmjs.org/lightningcss-linux-arm64-gnu/-/lightningcss-linux-arm64-gnu-1.32.0.tgz", + "integrity": "sha512-0nnMyoyOLRJXfbMOilaSRcLH3Jw5z9HDNGfT/gwCPgaDjnx0i8w7vBzFLFR1f6CMLKF8gVbebmkUN3fa/kQJpQ==", + "cpu": [ + "arm64" + ], + "license": "MPL-2.0", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">= 12.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/parcel" + } + }, + "node_modules/@tailwindcss/node/node_modules/lightningcss-linux-arm64-musl": { + "version": "1.32.0", + "resolved": "https://registry.npmjs.org/lightningcss-linux-arm64-musl/-/lightningcss-linux-arm64-musl-1.32.0.tgz", + "integrity": "sha512-UpQkoenr4UJEzgVIYpI80lDFvRmPVg6oqboNHfoH4CQIfNA+HOrZ7Mo7KZP02dC6LjghPQJeBsvXhJod/wnIBg==", + "cpu": [ + "arm64" + ], + "license": "MPL-2.0", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">= 12.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/parcel" + } + }, + "node_modules/@tailwindcss/node/node_modules/lightningcss-linux-x64-gnu": { + "version": "1.32.0", + "resolved": "https://registry.npmjs.org/lightningcss-linux-x64-gnu/-/lightningcss-linux-x64-gnu-1.32.0.tgz", + "integrity": "sha512-V7Qr52IhZmdKPVr+Vtw8o+WLsQJYCTd8loIfpDaMRWGUZfBOYEJeyJIkqGIDMZPwPx24pUMfwSxxI8phr/MbOA==", + "cpu": [ + "x64" + ], + "license": "MPL-2.0", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">= 12.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/parcel" + } + }, + "node_modules/@tailwindcss/node/node_modules/lightningcss-linux-x64-musl": { + "version": "1.32.0", + "resolved": "https://registry.npmjs.org/lightningcss-linux-x64-musl/-/lightningcss-linux-x64-musl-1.32.0.tgz", + "integrity": "sha512-bYcLp+Vb0awsiXg/80uCRezCYHNg1/l3mt0gzHnWV9XP1W5sKa5/TCdGWaR/zBM2PeF/HbsQv/j2URNOiVuxWg==", + "cpu": [ + "x64" + ], + "license": "MPL-2.0", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">= 12.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/parcel" + } + }, + "node_modules/@tailwindcss/node/node_modules/lightningcss-win32-arm64-msvc": { + "version": "1.32.0", + "resolved": "https://registry.npmjs.org/lightningcss-win32-arm64-msvc/-/lightningcss-win32-arm64-msvc-1.32.0.tgz", + "integrity": "sha512-8SbC8BR40pS6baCM8sbtYDSwEVQd4JlFTOlaD3gWGHfThTcABnNDBda6eTZeqbofalIJhFx0qKzgHJmcPTnGdw==", + "cpu": [ + "arm64" + ], + "license": "MPL-2.0", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">= 12.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/parcel" + } + }, + "node_modules/@tailwindcss/node/node_modules/lightningcss-win32-x64-msvc": { + "version": "1.32.0", + "resolved": "https://registry.npmjs.org/lightningcss-win32-x64-msvc/-/lightningcss-win32-x64-msvc-1.32.0.tgz", + "integrity": "sha512-Amq9B/SoZYdDi1kFrojnoqPLxYhQ4Wo5XiL8EVJrVsB8ARoC1PWW6VGtT0WKCemjy8aC+louJnjS7U18x3b06Q==", + "cpu": [ + "x64" + ], + "license": "MPL-2.0", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">= 12.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/parcel" + } + }, + "node_modules/@tailwindcss/oxide": { + "version": "4.3.3", + "resolved": "https://registry.npmjs.org/@tailwindcss/oxide/-/oxide-4.3.3.tgz", + "integrity": "sha512-krXjAikiaFSPaK/FkAQT5UTx3VormQaiZ5hBFlJZ9UFQGB/rwg1MZIhHAG9smMQRTdyJxP6Qt5MwMtdyU5FWrA==", + "license": "MIT", + "engines": { + "node": ">= 20" + }, + "optionalDependencies": { + "@tailwindcss/oxide-android-arm64": "4.3.3", + "@tailwindcss/oxide-darwin-arm64": "4.3.3", + "@tailwindcss/oxide-darwin-x64": "4.3.3", + "@tailwindcss/oxide-freebsd-x64": "4.3.3", + "@tailwindcss/oxide-linux-arm-gnueabihf": "4.3.3", + "@tailwindcss/oxide-linux-arm64-gnu": "4.3.3", + "@tailwindcss/oxide-linux-arm64-musl": "4.3.3", + "@tailwindcss/oxide-linux-x64-gnu": "4.3.3", + "@tailwindcss/oxide-linux-x64-musl": "4.3.3", + "@tailwindcss/oxide-wasm32-wasi": "4.3.3", + "@tailwindcss/oxide-win32-arm64-msvc": "4.3.3", + "@tailwindcss/oxide-win32-x64-msvc": "4.3.3" + } + }, + "node_modules/@tailwindcss/oxide-android-arm64": { + "version": "4.3.3", + "resolved": "https://registry.npmjs.org/@tailwindcss/oxide-android-arm64/-/oxide-android-arm64-4.3.3.tgz", + "integrity": "sha512-Y85A2gmPSkl5Ve5qR86GL4HT509cFqQh1aes9p3sSkyTPwt0Pppf3GkwGe4JPACcRYjgJIEhQgM6dBClnr0NYw==", + "cpu": [ + "arm64" + ], + "license": "MIT", + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": ">= 20" + } + }, + "node_modules/@tailwindcss/oxide-darwin-arm64": { + "version": "4.3.3", + "resolved": "https://registry.npmjs.org/@tailwindcss/oxide-darwin-arm64/-/oxide-darwin-arm64-4.3.3.tgz", + "integrity": "sha512-BiaWatpBcERQFDlOjRDpIVXuFK5PJez5SA4JMg6VYZdBYU+qKfV/vqjcIs+IYmtitf1xYQZTwXvU/8y4lfZUGw==", + "cpu": [ + "arm64" + ], + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">= 20" + } + }, + "node_modules/@tailwindcss/oxide-darwin-x64": { + "version": "4.3.3", + "resolved": "https://registry.npmjs.org/@tailwindcss/oxide-darwin-x64/-/oxide-darwin-x64-4.3.3.tgz", + "integrity": "sha512-fAeUqfV5ndhxRwai8cXGzdLvul9utWOmeTkv69unv4ZXixjn61Z+p9lCWdwOwA3TYboG3BwdVuN/RDjhBRl0mw==", + "cpu": [ + "x64" + ], + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">= 20" + } + }, + "node_modules/@tailwindcss/oxide-freebsd-x64": { + "version": "4.3.3", + "resolved": "https://registry.npmjs.org/@tailwindcss/oxide-freebsd-x64/-/oxide-freebsd-x64-4.3.3.tgz", + "integrity": "sha512-iyf5bV6+wnAlflVeEy7R25dupxTNECZN5QMI0qNT6eT+EgaGdZcKhGkr5SdoaWiLJ3spLqIY9VCeSGrwmtg4kw==", + "cpu": [ + "x64" + ], + "license": "MIT", + "optional": true, + "os": [ + "freebsd" + ], + "engines": { + "node": ">= 20" + } + }, + "node_modules/@tailwindcss/oxide-linux-arm-gnueabihf": { + "version": "4.3.3", + "resolved": "https://registry.npmjs.org/@tailwindcss/oxide-linux-arm-gnueabihf/-/oxide-linux-arm-gnueabihf-4.3.3.tgz", + "integrity": "sha512-aAYUprJAJQWWbRrPvtjdroZ56Md+JM8pMiopS6xGEwDfLhqj+2ver2p4nU4Mb3CRqcMmNBjo8KkUgcxhkzVQGQ==", + "cpu": [ + "arm" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">= 20" + } + }, + "node_modules/@tailwindcss/oxide-linux-arm64-gnu": { + "version": "4.3.3", + "resolved": "https://registry.npmjs.org/@tailwindcss/oxide-linux-arm64-gnu/-/oxide-linux-arm64-gnu-4.3.3.tgz", + "integrity": "sha512-nDxldcEENOxZRzC2uu9jrutZdAAQtb+8WWDCSnWL1zvBk1+FN+x6MtDViPB5AJMfttVCUhehGWus3XBPgatM/w==", + "cpu": [ + "arm64" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">= 20" + } + }, + "node_modules/@tailwindcss/oxide-linux-arm64-musl": { + "version": "4.3.3", + "resolved": "https://registry.npmjs.org/@tailwindcss/oxide-linux-arm64-musl/-/oxide-linux-arm64-musl-4.3.3.tgz", + "integrity": "sha512-Md44bD6veX/PC5iyF8cDVnw4HBIANZepRZZ7a8DQOvkfo5WUBwcp6iAuCUz23u+4SUkhJlD3eL7hNdW8ezd/kA==", + "cpu": [ + "arm64" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">= 20" + } + }, + "node_modules/@tailwindcss/oxide-linux-x64-gnu": { + "version": "4.3.3", + "resolved": "https://registry.npmjs.org/@tailwindcss/oxide-linux-x64-gnu/-/oxide-linux-x64-gnu-4.3.3.tgz", + "integrity": "sha512-tx7us1muwOKAKWao2v/GaafFeQboE6aj88vC6ziN2NCGcRm8gWUhwjzg+YdVB1e4boAtdtma4L43onunI6NS4w==", + "cpu": [ + "x64" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">= 20" + } + }, + "node_modules/@tailwindcss/oxide-linux-x64-musl": { + "version": "4.3.3", + "resolved": "https://registry.npmjs.org/@tailwindcss/oxide-linux-x64-musl/-/oxide-linux-x64-musl-4.3.3.tgz", + "integrity": "sha512-SJxX60smvHgasZoBy11dX6YRjXJFovwWBoedhbQPOBzgFWBHGB+TVPWB9BxzR7TTxU8FQZAI2AyiNCMzFm8Img==", + "cpu": [ + "x64" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">= 20" + } + }, + "node_modules/@tailwindcss/oxide-wasm32-wasi": { + "version": "4.3.3", + "resolved": "https://registry.npmjs.org/@tailwindcss/oxide-wasm32-wasi/-/oxide-wasm32-wasi-4.3.3.tgz", + "integrity": "sha512-jx1+rPhY/5Ympkktd656HBWEBLxP7dH06losBLjjf5vgCODXvi9KhtftWcMIwTFIDqBr7cRnQkdLnAG+IOlGvQ==", + "bundleDependencies": [ + "@napi-rs/wasm-runtime", + "@emnapi/core", + "@emnapi/runtime", + "@tybys/wasm-util", + "@emnapi/wasi-threads", + "tslib" + ], + "cpu": [ + "wasm32" + ], + "license": "MIT", + "optional": true, + "dependencies": { + "@emnapi/core": "^1.11.1", + "@emnapi/runtime": "^1.11.1", + "@emnapi/wasi-threads": "^1.2.2", + "@napi-rs/wasm-runtime": "^1.1.4", + "@tybys/wasm-util": "^0.10.2", + "tslib": "^2.8.1" + }, + "engines": { + "node": ">=14.0.0" + } + }, + "node_modules/@tailwindcss/oxide-win32-arm64-msvc": { + "version": "4.3.3", + "resolved": "https://registry.npmjs.org/@tailwindcss/oxide-win32-arm64-msvc/-/oxide-win32-arm64-msvc-4.3.3.tgz", + "integrity": "sha512-3rc292Ca2ceK6Ulcc/bAVnTs/3nDtoPhyEKlgPv+yQJQi/JS/AMJlqzxvlDacL1nekbrcf6bTqp/jV4qgnPxNQ==", + "cpu": [ + "arm64" + ], + "license": "MIT", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">= 20" + } + }, + "node_modules/@tailwindcss/oxide-win32-x64-msvc": { + "version": "4.3.3", + "resolved": "https://registry.npmjs.org/@tailwindcss/oxide-win32-x64-msvc/-/oxide-win32-x64-msvc-4.3.3.tgz", + "integrity": "sha512-yJ0pwIVc/nYeGoV02WtsN8KYyLQv7kyI2wDnkezyJlGGjkd4QLwDGAwl47YpPJeuI0M0ObaXGSPjvWDPeTPggw==", + "cpu": [ + "x64" + ], + "license": "MIT", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">= 20" + } + }, + "node_modules/@tailwindcss/vite": { + "version": "4.3.3", + "resolved": "https://registry.npmjs.org/@tailwindcss/vite/-/vite-4.3.3.tgz", + "integrity": "sha512-yYU8cogLeSh/ms2jh8Fj7jaba/EWa7Ja6GoUqYZaraEuCI5YS6ms6ObZgjjedm+jm6XZjdNRWBpPP6Z86oOxcw==", + "license": "MIT", + "dependencies": { + "@tailwindcss/node": "4.3.3", + "@tailwindcss/oxide": "4.3.3", + "tailwindcss": "4.3.3" + }, + "peerDependencies": { + "vite": "^5.2.0 || ^6 || ^7 || ^8" + } + }, + "node_modules/@types/node": { + "version": "24.13.3", + "resolved": "https://registry.npmjs.org/@types/node/-/node-24.13.3.tgz", + "integrity": "sha512-Dh8vAsV36ig5wa9OX4pXvMc9D3Veibfw2wix0CUwYODLD8nkj9UsLjASr49nPg+2eKzxhBV+v7L8pXvT4e639Q==", + "devOptional": true, + "license": "MIT", + "dependencies": { + "undici-types": "~7.18.0" + } + }, + "node_modules/@types/react": { + "version": "19.2.18", + "resolved": "https://registry.npmjs.org/@types/react/-/react-19.2.18.tgz", + "integrity": "sha512-AnzbBERsrLKtk2XSfTbYRLjQPdy116Sty4q+T+Bp3IC4l6jNBvreVPAHmpq9qhXQM7CXZPjLVmGMw9sy+hxQ3w==", + "dev": true, + "license": "MIT", + "dependencies": { + "csstype": "^3.2.2" + } + }, + "node_modules/@types/react-dom": { + "version": "19.2.7", + "resolved": "https://registry.npmjs.org/@types/react-dom/-/react-dom-19.2.7.tgz", + "integrity": "sha512-I8bPpDLcHBv1qiIiXDCy71Rt8eQDKJP0sMSWJphDdAcdqiJ1sGpZamavoEIRZmYzjia9LuEb2HlYdDpmoENpvQ==", + "dev": true, + "license": "MIT", + "peerDependencies": { + "@types/react": "^19.2.0" + } + }, + "node_modules/@vitejs/plugin-react": { + "version": "6.1.1", + "resolved": "https://registry.npmjs.org/@vitejs/plugin-react/-/plugin-react-6.1.1.tgz", + "integrity": "sha512-yxLaQV9gkhS8ezJqCM6+ndU7mDY6gqAg75NQ+0IjwEI8IYOmQCgkRwHKVSfWXW076DsqMo0Dk+0FK1U+M5RgFw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@rolldown/pluginutils": "^1.0.1" + }, + "engines": { + "node": "^20.19.0 || >=22.12.0" + }, + "peerDependencies": { + "@rolldown/plugin-babel": "^0.1.7 || ^0.2.0", + "babel-plugin-react-compiler": "^1.0.0", + "oxc-transform-react": "^0.145.0", + "vite": "^8.0.0" + }, + "peerDependenciesMeta": { + "@rolldown/plugin-babel": { + "optional": true + }, + "babel-plugin-react-compiler": { + "optional": true + }, + "oxc-transform-react": { + "optional": true + } + } + }, + "node_modules/csstype": { + "version": "3.2.3", + "resolved": "https://registry.npmjs.org/csstype/-/csstype-3.2.3.tgz", + "integrity": "sha512-z1HGKcYy2xA8AGQfwrn0PAy+PB7X/GSj3UVJW9qKyn43xWa+gl5nXmU4qqLMRzWVLFC8KusUX8T/0kCiOYpAIQ==", + "dev": true, + "license": "MIT" + }, + "node_modules/detect-libc": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/detect-libc/-/detect-libc-2.1.2.tgz", + "integrity": "sha512-Btj2BOOO83o3WyH59e8MgXsxEQVcarkUOpEYrubB0urwnN10yQ364rsiByU11nZlqWYZm05i/of7io4mzihBtQ==", + "license": "Apache-2.0", + "engines": { + "node": ">=8" + } + }, + "node_modules/enhanced-resolve": { + "version": "5.24.5", + "resolved": "https://registry.npmjs.org/enhanced-resolve/-/enhanced-resolve-5.24.5.tgz", + "integrity": "sha512-L1l8TNvomm6UVW5B253AGxQagSQr+vGwhMlrrfRS2qmhx46AMpMVJKQYLvWYbysTMY8VoicOvzHzoHMbyzB+4A==", + "license": "MIT", + "dependencies": { + "graceful-fs": "^4.2.4", + "tapable": "^2.3.3" + }, + "engines": { + "node": ">=10.13.0" + } + }, + "node_modules/fdir": { + "version": "6.5.0", + "resolved": "https://registry.npmjs.org/fdir/-/fdir-6.5.0.tgz", + "integrity": "sha512-tIbYtZbucOs0BRGqPJkshJUYdL+SDH7dVM8gjy+ERp3WAUjLEFJE+02kanyHtwjWOnwrKYBiwAmM0p4kLJAnXg==", + "license": "MIT", + "engines": { + "node": ">=12.0.0" + }, + "peerDependencies": { + "picomatch": "^3 || ^4" + }, + "peerDependenciesMeta": { + "picomatch": { + "optional": true + } + } + }, + "node_modules/fsevents": { + "version": "2.3.3", + "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.3.tgz", + "integrity": "sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw==", + "hasInstallScript": true, + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": "^8.16.0 || ^10.6.0 || >=11.0.0" + } + }, + "node_modules/graceful-fs": { + "version": "4.2.11", + "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.11.tgz", + "integrity": "sha512-RbJ5/jmFcNNCcDV5o9eTnBLJ/HszWV0P73bc+Ff4nS/rJj+YaS6IGyiOL0VoBYX+l1Wrl3k63h/KrH+nhJ0XvQ==", + "license": "ISC" + }, + "node_modules/jiti": { + "version": "2.7.0", + "resolved": "https://registry.npmjs.org/jiti/-/jiti-2.7.0.tgz", + "integrity": "sha512-AC/7JofJvZGrrneWNaEnJeOLUx+JlGt7tNa0wZiRPT4MY1wmfKjt2+6O2p2uz2+skll8OZZmJMNqeke7kKbNgQ==", + "license": "MIT", + "bin": { + "jiti": "lib/jiti-cli.mjs" + } + }, + "node_modules/lightningcss": { + "version": "1.33.0", + "resolved": "https://registry.npmjs.org/lightningcss/-/lightningcss-1.33.0.tgz", + "integrity": "sha512-WkUDrojuJs0xkgGf2udWxa3yGBRxPtxUkB79i6aCZLRgc7PM8fZe9TosfPDcvEpQZbuFASnHYmRLBLUbmLOIIA==", + "license": "MPL-2.0", + "dependencies": { + "detect-libc": "^2.0.3" + }, + "engines": { + "node": ">= 12.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/parcel" + }, + "optionalDependencies": { + "lightningcss-android-arm64": "1.33.0", + "lightningcss-darwin-arm64": "1.33.0", + "lightningcss-darwin-x64": "1.33.0", + "lightningcss-freebsd-x64": "1.33.0", + "lightningcss-linux-arm-gnueabihf": "1.33.0", + "lightningcss-linux-arm64-gnu": "1.33.0", + "lightningcss-linux-arm64-musl": "1.33.0", + "lightningcss-linux-x64-gnu": "1.33.0", + "lightningcss-linux-x64-musl": "1.33.0", + "lightningcss-win32-arm64-msvc": "1.33.0", + "lightningcss-win32-x64-msvc": "1.33.0" + } + }, + "node_modules/lightningcss-android-arm64": { + "version": "1.33.0", + "resolved": "https://registry.npmjs.org/lightningcss-android-arm64/-/lightningcss-android-arm64-1.33.0.tgz", + "integrity": "sha512-gEpRTalKdosp4Bb8qWtc2iOgE5SeIHlpS1up9bFq2wAyYhl1UdTObYiHe98zEM9SQvSoqQZ1IQD0JNpg3Ml5pg==", + "cpu": [ + "arm64" + ], + "license": "MPL-2.0", + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": ">= 12.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/parcel" + } + }, + "node_modules/lightningcss-darwin-arm64": { + "version": "1.33.0", + "resolved": "https://registry.npmjs.org/lightningcss-darwin-arm64/-/lightningcss-darwin-arm64-1.33.0.tgz", + "integrity": "sha512-Sciaz8eenNTKn9b3t7+xr0ipTp9YxKQY4npwQ3mrRuL0BAVHBLyZxofhaKBAVtzmtRZ/zTyo0/to4B1uWG/Djg==", + "cpu": [ + "arm64" + ], + "license": "MPL-2.0", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">= 12.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/parcel" + } + }, + "node_modules/lightningcss-darwin-x64": { + "version": "1.33.0", + "resolved": "https://registry.npmjs.org/lightningcss-darwin-x64/-/lightningcss-darwin-x64-1.33.0.tgz", + "integrity": "sha512-Z5UPAxzrjlWNNyGy6i65cJzzvgJ5D3T6wMvs+gWpY9d7qRhANrxqAp6LhxIgZhWEw18RfJTGcRxjuLIBr+m8XQ==", + "cpu": [ + "x64" + ], + "license": "MPL-2.0", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">= 12.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/parcel" + } + }, + "node_modules/lightningcss-freebsd-x64": { + "version": "1.33.0", + "resolved": "https://registry.npmjs.org/lightningcss-freebsd-x64/-/lightningcss-freebsd-x64-1.33.0.tgz", + "integrity": "sha512-QQM/Ti/hQajJwCY+RiWuCZ9sdtI/XQk7nDK5vC8kkdwixezOlDgvDx7+RT+QjK6FcFT4MpsuoBnHIo/O3StRRg==", + "cpu": [ + "x64" + ], + "license": "MPL-2.0", + "optional": true, + "os": [ + "freebsd" + ], + "engines": { + "node": ">= 12.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/parcel" + } + }, + "node_modules/lightningcss-linux-arm-gnueabihf": { + "version": "1.33.0", + "resolved": "https://registry.npmjs.org/lightningcss-linux-arm-gnueabihf/-/lightningcss-linux-arm-gnueabihf-1.33.0.tgz", + "integrity": "sha512-N7FVBe6iS24MlM6R/4RBTxGhQheZGs7tiQ9U32UtF75NzP5Q7xWPRqLBCKxlRQRk3rY1jCIPLzx7WzOhuUIRLQ==", + "cpu": [ + "arm" + ], + "license": "MPL-2.0", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">= 12.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/parcel" + } + }, + "node_modules/lightningcss-linux-arm64-gnu": { + "version": "1.33.0", + "resolved": "https://registry.npmjs.org/lightningcss-linux-arm64-gnu/-/lightningcss-linux-arm64-gnu-1.33.0.tgz", + "integrity": "sha512-j2v/itmy4HlNxlc6voKXYgBqNi0Ng2LShg4z7GufpEgs05P+2suBVyi9I6YHq5uoVFx9ETin3eCEhLVyXGQnKg==", + "cpu": [ + "arm64" + ], + "license": "MPL-2.0", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">= 12.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/parcel" + } + }, + "node_modules/lightningcss-linux-arm64-musl": { + "version": "1.33.0", + "resolved": "https://registry.npmjs.org/lightningcss-linux-arm64-musl/-/lightningcss-linux-arm64-musl-1.33.0.tgz", + "integrity": "sha512-yiO5ROMuYQgXbC60yjZU5CYSFZGKXL0HFATXt9mHJn1+zW55oCtMI9NfcVhYLMFDL7gV7oBPon/EmMMGg2OvtQ==", + "cpu": [ + "arm64" + ], + "license": "MPL-2.0", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">= 12.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/parcel" + } + }, + "node_modules/lightningcss-linux-x64-gnu": { + "version": "1.33.0", + "resolved": "https://registry.npmjs.org/lightningcss-linux-x64-gnu/-/lightningcss-linux-x64-gnu-1.33.0.tgz", + "integrity": "sha512-ar+Ju7LmcN0Jo4FpL4hpFybwNG9/3A/Br5KW2n2jyODg3MEZXaDYADdemoNS+BDNfMgKvylJLj4S5tyRActuAg==", + "cpu": [ + "x64" + ], + "license": "MPL-2.0", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">= 12.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/parcel" + } + }, + "node_modules/lightningcss-linux-x64-musl": { + "version": "1.33.0", + "resolved": "https://registry.npmjs.org/lightningcss-linux-x64-musl/-/lightningcss-linux-x64-musl-1.33.0.tgz", + "integrity": "sha512-RYiYbkokw0trfKqqzfF55lginwEPrD3OJDfTuJzFs1MK6iFnDenaz1fqLLtX4ITG3OktJQXOeTaw1awrBAlZPw==", + "cpu": [ + "x64" + ], + "license": "MPL-2.0", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">= 12.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/parcel" + } + }, + "node_modules/lightningcss-win32-arm64-msvc": { + "version": "1.33.0", + "resolved": "https://registry.npmjs.org/lightningcss-win32-arm64-msvc/-/lightningcss-win32-arm64-msvc-1.33.0.tgz", + "integrity": "sha512-1K+MPfLSFVpphzpdbfkhlWk6wBrTObBzS2T6db10PNOZgR9GoVsAWzwNyuhUYYbTp23j+4RrncfujZ4uAzXvwA==", + "cpu": [ + "arm64" + ], + "license": "MPL-2.0", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">= 12.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/parcel" + } + }, + "node_modules/lightningcss-win32-x64-msvc": { + "version": "1.33.0", + "resolved": "https://registry.npmjs.org/lightningcss-win32-x64-msvc/-/lightningcss-win32-x64-msvc-1.33.0.tgz", + "integrity": "sha512-OlEICDx/Xl0FqSp4bry8zFnCvGpig3Gl4gCquvYwHuqJKEC1+n9NgDniFvqHGmMv1ZkqDJrDqKKSykTDX+ehuA==", + "cpu": [ + "x64" + ], + "license": "MPL-2.0", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">= 12.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/parcel" + } + }, + "node_modules/lucide-react": { + "version": "1.41.0", + "resolved": "https://registry.npmjs.org/lucide-react/-/lucide-react-1.41.0.tgz", + "integrity": "sha512-6lksP35l6KszDKUeRTi4LV7i6DEe0Yzl2ALJm9j4c5xEYN91GdW1xGsawGMOg2mgjF5GHBVX8pKX9kP+cWsP3Q==", + "license": "ISC", + "peerDependencies": { + "react": "^16.5.1 || ^17.0.0 || ^18.0.0 || ^19.0.0" + } + }, + "node_modules/magic-string": { + "version": "0.30.21", + "resolved": "https://registry.npmjs.org/magic-string/-/magic-string-0.30.21.tgz", + "integrity": "sha512-vd2F4YUyEXKGcLHoq+TEyCjxueSeHnFxyyjNp80yg0XV4vUhnDer/lvvlqM/arB5bXQN5K2/3oinyCRyx8T2CQ==", + "license": "MIT", + "dependencies": { + "@jridgewell/sourcemap-codec": "^1.5.5" + } + }, + "node_modules/nanoid": { + "version": "3.3.18", + "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.18.tgz", + "integrity": "sha512-DTg4MJbGMWkfi6VZFdNt2/caMbQy4Ou+Op/hJQvGEWcnVfoA1QA+xzRKAzw9jD6+GVOOeYr/mIcuDSdug6F6+w==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/ai" + } + ], + "license": "MIT", + "bin": { + "nanoid": "bin/nanoid.cjs" + }, + "engines": { + "node": "^10 || ^12 || ^13.7 || ^14 || >=15.0.1" + } + }, + "node_modules/oxlint": { + "version": "1.81.0", + "resolved": "https://registry.npmjs.org/oxlint/-/oxlint-1.81.0.tgz", + "integrity": "sha512-HyrJYqeoOCL0iqaLEzGewGT48ZX99P3hxYh8udAF9RGGIghSamkXE4ClUyBpEDNqasamThgmlPbuMOe7SAZmHg==", + "dev": true, + "license": "MIT", + "bin": { + "oxlint": "bin/oxlint" + }, + "engines": { + "node": "^20.19.0 || >=22.12.0" + }, + "funding": { + "url": "https://github.com/sponsors/oxc-project" + }, + "optionalDependencies": { + "@oxlint/binding-android-arm-eabi": "1.81.0", + "@oxlint/binding-android-arm64": "1.81.0", + "@oxlint/binding-darwin-arm64": "1.81.0", + "@oxlint/binding-darwin-x64": "1.81.0", + "@oxlint/binding-freebsd-x64": "1.81.0", + "@oxlint/binding-linux-arm-gnueabihf": "1.81.0", + "@oxlint/binding-linux-arm-musleabihf": "1.81.0", + "@oxlint/binding-linux-arm64-gnu": "1.81.0", + "@oxlint/binding-linux-arm64-musl": "1.81.0", + "@oxlint/binding-linux-ppc64-gnu": "1.81.0", + "@oxlint/binding-linux-riscv64-gnu": "1.81.0", + "@oxlint/binding-linux-riscv64-musl": "1.81.0", + "@oxlint/binding-linux-s390x-gnu": "1.81.0", + "@oxlint/binding-linux-x64-gnu": "1.81.0", + "@oxlint/binding-linux-x64-musl": "1.81.0", + "@oxlint/binding-openharmony-arm64": "1.81.0", + "@oxlint/binding-win32-arm64-msvc": "1.81.0", + "@oxlint/binding-win32-ia32-msvc": "1.81.0", + "@oxlint/binding-win32-x64-msvc": "1.81.0" + }, + "peerDependencies": { + "oxlint-tsgolint": ">=7.0.2001", + "vite-plus": "*" + }, + "peerDependenciesMeta": { + "oxlint-tsgolint": { + "optional": true + }, + "vite-plus": { + "optional": true + } + } + }, + "node_modules/picocolors": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/picocolors/-/picocolors-1.1.1.tgz", + "integrity": "sha512-xceH2snhtb5M9liqDsmEw56le376mTZkEX/jEb/RxNFyegNul7eNslCXP9FDj/Lcu0X8KEyMceP2ntpaHrDEVA==", + "license": "ISC" + }, + "node_modules/picomatch": { + "version": "4.0.7", + "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-4.0.7.tgz", + "integrity": "sha512-qcJu88Q2IWqJsDD529JKMdwGm/dvInW4HvQnRwiH9JtihJvzGOscDtHE3x1pBKeUOTysQ8kVmLnJ2kJu7yhcGA==", + "license": "MIT", + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/jonschlinkert" + } + }, + "node_modules/postcss": { + "version": "8.5.28", + "resolved": "https://registry.npmjs.org/postcss/-/postcss-8.5.28.tgz", + "integrity": "sha512-RRuzqDtt5Y9h3quz5hWhK+TPnsmVs6WwSU6LkJMeY4HstUEDuYTG8UJSdawMRzmzAtV+KEoG8N3Qg2qLy5vM/A==", + "funding": [ + { + "type": "opencollective", + "url": "https://opencollective.com/postcss/" + }, + { + "type": "tidelift", + "url": "https://tidelift.com/funding/github/npm/postcss" + }, + { + "type": "github", + "url": "https://github.com/sponsors/ai" + } + ], + "license": "MIT", + "dependencies": { + "nanoid": "^3.3.18", + "picocolors": "^1.1.1", + "source-map-js": "^1.2.1" + }, + "engines": { + "node": "^10 || ^12 || >=14" + } + }, + "node_modules/react": { + "version": "19.2.8", + "resolved": "https://registry.npmjs.org/react/-/react-19.2.8.tgz", + "integrity": "sha512-PWaYA1L/q9u2u7xYQi+Y3L3Yfnie7XyLeaJICV1MGD6LprsBxcAqGjYyr0eY3p+QdsA+x/Irkt4Qif8D63+Sbw==", + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/react-dom": { + "version": "19.2.8", + "resolved": "https://registry.npmjs.org/react-dom/-/react-dom-19.2.8.tgz", + "integrity": "sha512-rVprimfGBG3DR+Tq0IQG2DT5PxKth1WIGDmj5yPmlzr4YBe7uyE+Du4oVqTDXZSHGGGXRtTJEGSSePyQCMBglQ==", + "license": "MIT", + "dependencies": { + "scheduler": "^0.27.0" + }, + "peerDependencies": { + "react": "^19.2.8" + } + }, + "node_modules/rolldown": { + "version": "1.2.7", + "resolved": "https://registry.npmjs.org/rolldown/-/rolldown-1.2.7.tgz", + "integrity": "sha512-g0EtLvBjTUB7jhyV0S/TCup3v/XSVl45vUIGbOGU4QPiyjTenCe4mKuFvW9fEgYmS2Fo42AUssRmNuMziXdrig==", + "license": "MIT", + "dependencies": { + "@oxc-project/types": "=0.148.0", + "@rolldown/pluginutils": "^1.0.0" + }, + "bin": { + "rolldown": "bin/cli.mjs" + }, + "engines": { + "node": "^20.19.0 || >=22.12.0" + }, + "optionalDependencies": { + "@rolldown/binding-android-arm-eabi": "1.2.7", + "@rolldown/binding-android-arm64": "1.2.7", + "@rolldown/binding-darwin-arm64": "1.2.7", + "@rolldown/binding-darwin-x64": "1.2.7", + "@rolldown/binding-freebsd-x64": "1.2.7", + "@rolldown/binding-linux-arm-gnueabihf": "1.2.7", + "@rolldown/binding-linux-arm64-gnu": "1.2.7", + "@rolldown/binding-linux-arm64-musl": "1.2.7", + "@rolldown/binding-linux-ppc64-gnu": "1.2.7", + "@rolldown/binding-linux-s390x-gnu": "1.2.7", + "@rolldown/binding-linux-x64-gnu": "1.2.7", + "@rolldown/binding-linux-x64-musl": "1.2.7", + "@rolldown/binding-openharmony-arm64": "1.2.7", + "@rolldown/binding-win32-arm64-msvc": "1.2.7", + "@rolldown/binding-win32-x64-msvc": "1.2.7" + } + }, + "node_modules/scheduler": { + "version": "0.27.0", + "resolved": "https://registry.npmjs.org/scheduler/-/scheduler-0.27.0.tgz", + "integrity": "sha512-eNv+WrVbKu1f3vbYJT/xtiF5syA5HPIMtf9IgY/nKg0sWqzAUEvqY/xm7OcZc/qafLx/iO9FgOmeSAp4v5ti/Q==", + "license": "MIT" + }, + "node_modules/source-map-js": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/source-map-js/-/source-map-js-1.2.1.tgz", + "integrity": "sha512-UXWMKhLOwVKb728IUtQPXxfYU+usdybtUrK/8uGE8CQMvrhOpwvzDBwj0QhSL7MQc7vIsISBG8VQ8+IDQxpfQA==", + "license": "BSD-3-Clause", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/tailwindcss": { + "version": "4.3.3", + "resolved": "https://registry.npmjs.org/tailwindcss/-/tailwindcss-4.3.3.tgz", + "integrity": "sha512-gOhV3P7ufE62QDGg1zVaTgCR+EtPv92k2nIhVcVKcLmxT1sUBsQGhnZj175j+MqRt4zLF7ic+sCYjfhxMxj7YQ==", + "license": "MIT" + }, + "node_modules/tapable": { + "version": "2.3.3", + "resolved": "https://registry.npmjs.org/tapable/-/tapable-2.3.3.tgz", + "integrity": "sha512-uxc/zpqFg6x7C8vOE7lh6Lbda8eEL9zmVm/PLeTPBRhh1xCgdWaQ+J1CUieGpIfm2HdtsUpRv+HshiasBMcc6A==", + "license": "MIT", + "engines": { + "node": ">=6" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/webpack" + } + }, + "node_modules/tinyglobby": { + "version": "0.2.17", + "resolved": "https://registry.npmjs.org/tinyglobby/-/tinyglobby-0.2.17.tgz", + "integrity": "sha512-wXR/dYpcqKmfWpEdZjiKJOwCNFndD0DMnrW/cYjVGttEkBfVgcLFHoNrlj47mjOVic9yyNu65alsgF4NQyTa2g==", + "license": "MIT", + "dependencies": { + "fdir": "^6.5.0", + "picomatch": "^4.0.4" + }, + "engines": { + "node": ">=12.0.0" + }, + "funding": { + "url": "https://github.com/sponsors/SuperchupuDev" + } + }, + "node_modules/typescript": { + "version": "6.0.3", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-6.0.3.tgz", + "integrity": "sha512-y2TvuxSZPDyQakkFRPZHKFm+KKVqIisdg9/CZwm9ftvKXLP8NRWj38/ODjNbr43SsoXqNuAisEf1GdCxqWcdBw==", + "dev": true, + "license": "Apache-2.0", + "bin": { + "tsc": "bin/tsc", + "tsserver": "bin/tsserver" + }, + "engines": { + "node": ">=14.17" + } + }, + "node_modules/undici-types": { + "version": "7.18.2", + "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-7.18.2.tgz", + "integrity": "sha512-AsuCzffGHJybSaRrmr5eHr81mwJU3kjw6M+uprWvCXiNeN9SOGwQ3Jn8jb8m3Z6izVgknn1R0FTCEAP2QrLY/w==", + "devOptional": true, + "license": "MIT" + }, + "node_modules/vite": { + "version": "8.2.2", + "resolved": "https://registry.npmjs.org/vite/-/vite-8.2.2.tgz", + "integrity": "sha512-cFKLV/PRgAUlIRm5WjMjJ86jrftzpqcgH+Us+DS8mI3CDNiH30Whrz8uHL3+MOLPAgqbMBAqWdAHAphOAM+z/Q==", + "license": "MIT", + "dependencies": { + "lightningcss": "^1.33.0", + "picomatch": "^4.0.5", + "postcss": "^8.5.26", + "rolldown": "~1.2.4", + "tinyglobby": "^0.2.17" + }, + "bin": { + "vite": "bin/vite.js" + }, + "engines": { + "node": "^20.19.0 || >=22.12.0" + }, + "funding": { + "url": "https://github.com/vitejs/vite?sponsor=1" + }, + "optionalDependencies": { + "fsevents": "~2.3.3" + }, + "peerDependencies": { + "@types/node": "^20.19.0 || >=22.12.0", + "@vitejs/devtools": "^0.4.0 || ^0.5.0", + "esbuild": "^0.27.0 || ^0.28.0", + "jiti": ">=1.21.0", + "less": "^4.0.0", + "sass": "^1.70.0", + "sass-embedded": "^1.70.0", + "stylus": ">=0.54.8", + "sugarss": "^5.0.0", + "terser": "^5.16.0", + "tsx": "^4.8.1", + "yaml": "^2.4.2" + }, + "peerDependenciesMeta": { + "@types/node": { + "optional": true + }, + "@vitejs/devtools": { + "optional": true + }, + "esbuild": { + "optional": true + }, + "jiti": { + "optional": true + }, + "less": { + "optional": true + }, + "sass": { + "optional": true + }, + "sass-embedded": { + "optional": true + }, + "stylus": { + "optional": true + }, + "sugarss": { + "optional": true + }, + "terser": { + "optional": true + }, + "tsx": { + "optional": true + }, + "yaml": { + "optional": true + } + } + } + } +} diff --git a/frontend/package.json b/frontend/package.json new file mode 100644 index 0000000..4cf9f18 --- /dev/null +++ b/frontend/package.json @@ -0,0 +1,28 @@ +{ + "name": "botwebwars-frontend", + "private": true, + "version": "1.0.0", + "type": "module", + "scripts": { + "dev": "vite", + "build": "tsc -b && vite build", + "lint": "oxlint", + "preview": "vite preview" + }, + "dependencies": { + "lucide-react": "^1.16.0", + "react": "^19.2.8", + "react-dom": "^19.2.8" + }, + "devDependencies": { + "@tailwindcss/vite": "^4.1.18", + "@types/node": "^24.13.3", + "@types/react": "^19.2.18", + "@types/react-dom": "^19.2.4", + "@vitejs/plugin-react": "^6.1.0", + "oxlint": "^1.79.0", + "tailwindcss": "^4.1.18", + "typescript": "~6.0.2", + "vite": "^8.2.2" + } +} diff --git a/frontend/public/favicon.svg b/frontend/public/favicon.svg new file mode 100644 index 0000000..6893eb1 --- /dev/null +++ b/frontend/public/favicon.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/frontend/public/icons.svg b/frontend/public/icons.svg new file mode 100644 index 0000000..e952219 --- /dev/null +++ b/frontend/public/icons.svg @@ -0,0 +1,24 @@ + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/frontend/src/App.css b/frontend/src/App.css new file mode 100644 index 0000000..f90339d --- /dev/null +++ b/frontend/src/App.css @@ -0,0 +1,184 @@ +.counter { + font-size: 16px; + padding: 5px 10px; + border-radius: 5px; + color: var(--accent); + background: var(--accent-bg); + border: 2px solid transparent; + transition: border-color 0.3s; + margin-bottom: 24px; + + &:hover { + border-color: var(--accent-border); + } + &:focus-visible { + outline: 2px solid var(--accent); + outline-offset: 2px; + } +} + +.hero { + position: relative; + + .base, + .framework, + .vite { + inset-inline: 0; + margin: 0 auto; + } + + .base { + width: 170px; + position: relative; + z-index: 0; + } + + .framework, + .vite { + position: absolute; + } + + .framework { + z-index: 1; + top: 34px; + height: 28px; + transform: perspective(2000px) rotateZ(300deg) rotateX(44deg) rotateY(39deg) + scale(1.4); + } + + .vite { + z-index: 0; + top: 107px; + height: 26px; + width: auto; + transform: perspective(2000px) rotateZ(300deg) rotateX(40deg) rotateY(39deg) + scale(0.8); + } +} + +#center { + display: flex; + flex-direction: column; + gap: 25px; + place-content: center; + place-items: center; + flex-grow: 1; + + @media (max-width: 1024px) { + padding: 32px 20px 24px; + gap: 18px; + } +} + +#next-steps { + display: flex; + border-top: 1px solid var(--border); + text-align: left; + + & > div { + flex: 1 1 0; + padding: 32px; + @media (max-width: 1024px) { + padding: 24px 20px; + } + } + + .icon { + margin-bottom: 16px; + width: 22px; + height: 22px; + } + + @media (max-width: 1024px) { + flex-direction: column; + text-align: center; + } +} + +#docs { + border-right: 1px solid var(--border); + + @media (max-width: 1024px) { + border-right: none; + border-bottom: 1px solid var(--border); + } +} + +#next-steps ul { + list-style: none; + padding: 0; + display: flex; + gap: 8px; + margin: 32px 0 0; + + .logo { + height: 18px; + } + + a { + color: var(--text-h); + font-size: 16px; + border-radius: 6px; + background: var(--social-bg); + display: flex; + padding: 6px 12px; + align-items: center; + gap: 8px; + text-decoration: none; + transition: box-shadow 0.3s; + + &:hover { + box-shadow: var(--shadow); + } + .button-icon { + height: 18px; + width: 18px; + } + } + + @media (max-width: 1024px) { + margin-top: 20px; + flex-wrap: wrap; + justify-content: center; + + li { + flex: 1 1 calc(50% - 8px); + } + + a { + width: 100%; + justify-content: center; + box-sizing: border-box; + } + } +} + +#spacer { + height: 88px; + border-top: 1px solid var(--border); + @media (max-width: 1024px) { + height: 48px; + } +} + +.ticks { + position: relative; + width: 100%; + + &::before, + &::after { + content: ''; + position: absolute; + top: -4.5px; + border: 5px solid transparent; + } + + &::before { + left: 0; + border-left-color: var(--border); + } + &::after { + right: 0; + border-right-color: var(--border); + } +} diff --git a/frontend/src/App.tsx b/frontend/src/App.tsx new file mode 100644 index 0000000..506ecd8 --- /dev/null +++ b/frontend/src/App.tsx @@ -0,0 +1,131 @@ +import { useState } from 'react'; +import { useGameSocket } from './hooks/useGameSocket'; +import { BoardCanvas } from './components/BoardCanvas'; +import { Header } from './components/Header'; +import { PlayerList } from './components/PlayerList'; +import { RegisterModal } from './components/RegisterModal'; + +const BOT_NAMES = [ + 'ViperStrike', + 'PulseMatrix', + 'NexusGlitch', + 'AegisPrime', + 'CobaltDrift', + 'PhantomCore', + 'ZephyrByte', + 'TitanSpark', + 'ShadowGrid', + 'QuantumFang', +]; + +const BOT_COLORS = [ + '#38BDF8', // Sky + '#F43F5E', // Rose + '#10B981', // Emerald + '#F59E0B', // Amber + '#A855F7', // Purple + '#EC4899', // Pink + '#06B6D4', // Cyan + '#6366F1', // Indigo +]; + +export function App() { + const { + boardState, + isConnected, + selectedPlayer, + setSelectedPlayer, + registerPlayer, + removePlayer, + resetBoard, + } = useGameSocket(); + + const [isRegisterOpen, setIsRegisterOpen] = useState(false); + const [notification, setNotification] = useState(null); + + const showNotification = (msg: string) => { + setNotification(msg); + setTimeout(() => { + setNotification((curr) => (curr === msg ? null : curr)); + }, 3500); + }; + + const handleQuickSpawn = async () => { + const name = BOT_NAMES[Math.floor(Math.random() * BOT_NAMES.length)] + '_' + Math.floor(Math.random() * 900 + 100); + const color = BOT_COLORS[Math.floor(Math.random() * BOT_COLORS.length)]; + try { + const player = await registerPlayer(name, color); + showNotification(`Spawned ${player.name} at (${player.x}, ${player.y})`); + } catch (err: unknown) { + if (err instanceof Error) { + showNotification(`Error: ${err.message}`); + } else { + showNotification('Failed to spawn bot'); + } + } + }; + + const handleReset = async () => { + if (window.confirm('Are you sure you want to clear all bots from the board?')) { + try { + await resetBoard(); + showNotification('Board cleared'); + } catch (err: unknown) { + if (err instanceof Error) { + showNotification(`Error: ${err.message}`); + } + } + } + }; + + return ( +
+ {/* Top Navigation Bar */} +
setIsRegisterOpen(true)} + onQuickSpawn={handleQuickSpawn} + onResetBoard={handleReset} + playerCount={boardState.player_count} + /> + + {/* Main Content Area */} +
+ {/* Interactive Grid Canvas Viewport */} + + + {/* Sidebar Player Roster */} + + + {/* Toast Notification */} + {notification && ( +
+ + {notification} +
+ )} +
+ + {/* Register Player Modal */} + setIsRegisterOpen(false)} + onRegister={async (name, color) => { + const player = await registerPlayer(name, color); + showNotification(`Deployed ${player.name} at coordinate (${player.x}, ${player.y})!`); + }} + /> +
+ ); +} + +export default App; diff --git a/frontend/src/assets/hero.png b/frontend/src/assets/hero.png new file mode 100644 index 0000000000000000000000000000000000000000..02251f4b956c55af2d76fd0788124d7eee2b45eb GIT binary patch literal 13057 zcmV+cGycqpP)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u0mjft=yBf literal 0 HcmV?d00001 diff --git a/frontend/src/assets/react.svg b/frontend/src/assets/react.svg new file mode 100644 index 0000000..6c87de9 --- /dev/null +++ b/frontend/src/assets/react.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/frontend/src/assets/vite.svg b/frontend/src/assets/vite.svg new file mode 100644 index 0000000..5101b67 --- /dev/null +++ b/frontend/src/assets/vite.svg @@ -0,0 +1 @@ +Vite diff --git a/frontend/src/components/BoardCanvas.tsx b/frontend/src/components/BoardCanvas.tsx new file mode 100644 index 0000000..0811f02 --- /dev/null +++ b/frontend/src/components/BoardCanvas.tsx @@ -0,0 +1,434 @@ +import React, { useRef, useEffect, useState, useCallback } from 'react'; +import type { BoardState, Player } from '../types'; + +interface BoardCanvasProps { + boardState: BoardState; + selectedPlayer: Player | null; + onSelectPlayer: (player: Player | null) => void; + onHoverCoord?: (coord: { x: number; y: number } | null) => void; +} + +export const BoardCanvas: React.FC = ({ + boardState, + selectedPlayer, + onSelectPlayer, + onHoverCoord, +}) => { + const canvasRef = useRef(null); + const containerRef = useRef(null); + + // Viewport transforms + const [zoom, setZoom] = useState(1); + const [offset, setOffset] = useState<{ x: number; y: number }>({ x: 0, y: 0 }); + const [isDragging, setIsDragging] = useState(false); + const [dragStart, setDragStart] = useState<{ x: number; y: number }>({ x: 0, y: 0 }); + const [hoveredCoord, setHoveredCoord] = useState<{ x: number; y: number } | null>(null); + const [hoveredPlayer, setHoveredPlayer] = useState(null); + + const { min_x, max_x, min_y, max_y } = boardState.config; + const gridCellsX = max_x - min_x; + const gridCellsY = max_y - min_y; + + // Convert canvas pixel coordinates to grid coordinate (0..64) + const pixelToGrid = useCallback( + (px: number, py: number, width: number, height: number) => { + const padding = 45; + const arenaSize = Math.min(width - padding * 2, height - padding * 2); + const startX = (width - arenaSize) / 2 + offset.x; + const startY = (height - arenaSize) / 2 + offset.y; + const cellSize = (arenaSize / gridCellsX) * zoom; + + const gx = Math.round((px - startX) / cellSize); + const gy = Math.round((py - startY) / cellSize); + + if (gx >= min_x && gx <= max_x && gy >= min_y && gy <= max_y) { + return { x: gx, y: gy }; + } + return null; + }, + [offset, zoom, gridCellsX, min_x, max_x, min_y, max_y] + ); + + // Reset viewport to fit + const handleResetView = useCallback(() => { + setZoom(1); + setOffset({ x: 0, y: 0 }); + }, []); + + // Center camera on selected player + useEffect(() => { + if (selectedPlayer && containerRef.current) { + const { width, height } = containerRef.current.getBoundingClientRect(); + const padding = 45; + const arenaSize = Math.min(width - padding * 2, height - padding * 2); + const cellSize = (arenaSize / gridCellsX) * zoom; + + const targetPx = (selectedPlayer.x - min_x) * cellSize; + const targetPy = (selectedPlayer.y - min_y) * cellSize; + + setOffset({ + x: -(targetPx - arenaSize / 2), + y: -(targetPy - arenaSize / 2), + }); + } + }, [selectedPlayer?.id, min_x, min_y, gridCellsX, zoom]); + + // Main render loop + useEffect(() => { + const canvas = canvasRef.current; + if (!canvas) return; + const ctx = canvas.getContext('2d'); + if (!ctx) return; + + let animationFrameId: number; + + const render = () => { + const dpr = window.devicePixelRatio || 1; + const rect = canvas.getBoundingClientRect(); + const width = rect.width; + const height = rect.height; + + if (canvas.width !== width * dpr || canvas.height !== height * dpr) { + canvas.width = width * dpr; + canvas.height = height * dpr; + } + + ctx.save(); + ctx.scale(dpr, dpr); + + // Deep sci-fi cyberpunk background + const bgGrad = ctx.createLinearGradient(0, 0, width, height); + bgGrad.addColorStop(0, '#090d16'); + bgGrad.addColorStop(1, '#05070c'); + ctx.fillStyle = bgGrad; + ctx.fillRect(0, 0, width, height); + + // Arena boundary calculation + const padding = 45; + const arenaSize = Math.min(width - padding * 2, height - padding * 2); + const startX = (width - arenaSize) / 2 + offset.x; + const startY = (height - arenaSize) / 2 + offset.y; + const cellSize = (arenaSize / gridCellsX) * zoom; + const totalWidth = cellSize * gridCellsX; + const totalHeight = cellSize * gridCellsY; + + // Draw Arena Background + ctx.fillStyle = '#0f172a'; + ctx.fillRect(startX, startY, totalWidth, totalHeight); + + // Clip grid area for internal drawing + ctx.save(); + ctx.beginPath(); + ctx.rect(startX, startY, totalWidth, totalHeight); + ctx.clip(); + + // Subtle checkered or minor grid lines + ctx.lineWidth = 0.5; + ctx.strokeStyle = '#1e293b'; + for (let i = 0; i <= gridCellsX; i++) { + const x = startX + i * cellSize; + ctx.beginPath(); + ctx.moveTo(x, startY); + ctx.lineTo(x, startY + totalHeight); + ctx.stroke(); + } + for (let j = 0; j <= gridCellsY; j++) { + const y = startY + j * cellSize; + ctx.beginPath(); + ctx.moveTo(startX, y); + ctx.lineTo(startX + totalWidth, y); + ctx.stroke(); + } + + // Major grid lines every 8 cells + ctx.lineWidth = 1.2; + ctx.strokeStyle = '#334155'; + for (let i = 0; i <= gridCellsX; i += 8) { + const x = startX + i * cellSize; + ctx.beginPath(); + ctx.moveTo(x, startY); + ctx.lineTo(x, startY + totalHeight); + ctx.stroke(); + } + for (let j = 0; j <= gridCellsY; j += 8) { + const y = startY + j * cellSize; + ctx.beginPath(); + ctx.moveTo(startX, y); + ctx.lineTo(startX + totalWidth, y); + ctx.stroke(); + } + + // Highlight hovered cell + if (hoveredCoord) { + const hx = startX + (hoveredCoord.x - min_x) * cellSize - cellSize / 2; + const hy = startY + (hoveredCoord.y - min_y) * cellSize - cellSize / 2; + ctx.fillStyle = 'rgba(56, 189, 248, 0.15)'; + ctx.fillRect(hx, hy, cellSize, cellSize); + ctx.strokeStyle = 'rgba(56, 189, 248, 0.7)'; + ctx.lineWidth = 1; + ctx.strokeRect(hx, hy, cellSize, cellSize); + } + + // Draw active players + const now = Date.now() / 400; + const pulse = Math.sin(now) * 0.2 + 0.8; + + boardState.players.forEach((player) => { + const px = startX + (player.x - min_x) * cellSize; + const py = startY + (player.y - min_y) * cellSize; + const isSelected = selectedPlayer?.id === player.id; + const isHovered = hoveredPlayer?.id === player.id; + + const baseRadius = Math.max(4, Math.min(cellSize * 0.45, 14)); + const radius = isSelected ? baseRadius * 1.35 : isHovered ? baseRadius * 1.2 : baseRadius; + + // Glow effect + ctx.save(); + ctx.shadowColor = player.color; + ctx.shadowBlur = isSelected ? 18 : 8; + + // Outer beacon ring + ctx.beginPath(); + ctx.arc(px, py, radius * (isSelected ? 1.5 * pulse : 1.25), 0, Math.PI * 2); + ctx.strokeStyle = player.color; + ctx.globalAlpha = isSelected ? 0.9 : 0.4; + ctx.lineWidth = 1.5; + ctx.stroke(); + + // Main Player Token + ctx.globalAlpha = 1.0; + ctx.beginPath(); + ctx.arc(px, py, radius, 0, Math.PI * 2); + ctx.fillStyle = player.color; + ctx.fill(); + + // Inner Core + ctx.beginPath(); + ctx.arc(px, py, radius * 0.4, 0, Math.PI * 2); + ctx.fillStyle = '#ffffff'; + ctx.fill(); + ctx.restore(); + + // Label above player if zoomed in or selected/hovered + if (zoom > 1.8 || isSelected || isHovered) { + ctx.save(); + ctx.font = 'bold 11px monospace'; + ctx.textAlign = 'center'; + const text = player.name; + const textMetrics = ctx.measureText(text); + const bgWidth = textMetrics.width + 10; + const bgHeight = 16; + const labelY = py - radius - 8; + + ctx.fillStyle = 'rgba(15, 23, 42, 0.85)'; + ctx.strokeStyle = player.color; + ctx.lineWidth = 1; + ctx.beginPath(); + ctx.roundRect(px - bgWidth / 2, labelY - 12, bgWidth, bgHeight, 4); + ctx.fill(); + ctx.stroke(); + + ctx.fillStyle = '#f8fafc'; + ctx.fillText(text, px, labelY); + ctx.restore(); + } + }); + + ctx.restore(); // end clip + + // Draw Board Border + ctx.strokeStyle = '#38bdf8'; + ctx.lineWidth = 2; + ctx.strokeRect(startX, startY, totalWidth, totalHeight); + + // Draw Coordinate Axis Rulers (0, 8, 16, 24, 32, 40, 48, 56, 64) + ctx.font = '10px monospace'; + ctx.fillStyle = '#94a3b8'; + ctx.textAlign = 'center'; + + for (let i = 0; i <= gridCellsX; i += 8) { + const x = startX + i * cellSize; + if (x >= startX - 5 && x <= startX + totalWidth + 5) { + ctx.fillText(`${i}`, x, startY - 8); + ctx.beginPath(); + ctx.moveTo(x, startY - 4); + ctx.lineTo(x, startY); + ctx.strokeStyle = '#475569'; + ctx.stroke(); + } + } + + ctx.textAlign = 'right'; + for (let j = 0; j <= gridCellsY; j += 8) { + const y = startY + j * cellSize; + if (y >= startY - 5 && y <= startY + totalHeight + 5) { + ctx.fillText(`${j}`, startX - 8, y + 3); + ctx.beginPath(); + ctx.moveTo(startX - 4, y); + ctx.lineTo(startX, y); + ctx.strokeStyle = '#475569'; + ctx.stroke(); + } + } + + ctx.restore(); + animationFrameId = requestAnimationFrame(render); + }; + + animationFrameId = requestAnimationFrame(render); + return () => cancelAnimationFrame(animationFrameId); + }, [boardState, selectedPlayer, hoveredPlayer, hoveredCoord, offset, zoom, gridCellsX, gridCellsY, min_x, max_x, min_y, max_y]); + + // Mouse Drag to Pan + const handleMouseDown = (e: React.MouseEvent) => { + if (e.button === 0) { + setIsDragging(true); + setDragStart({ x: e.clientX - offset.x, y: e.clientY - offset.y }); + } + }; + + const handleMouseMove = (e: React.MouseEvent) => { + if (!canvasRef.current) return; + const rect = canvasRef.current.getBoundingClientRect(); + const mouseX = e.clientX - rect.left; + const mouseY = e.clientY - rect.top; + + if (isDragging) { + setOffset({ + x: e.clientX - dragStart.x, + y: e.clientY - dragStart.y, + }); + } + + const coord = pixelToGrid(mouseX, mouseY, rect.width, rect.height); + setHoveredCoord(coord); + onHoverCoord?.(coord); + + if (coord) { + const match = boardState.players.find((p) => p.x === coord.x && p.y === coord.y); + setHoveredPlayer(match || null); + } else { + setHoveredPlayer(null); + } + }; + + const handleMouseUp = () => { + setIsDragging(false); + }; + + // Wheel to Zoom + const handleWheel = (e: React.WheelEvent) => { + e.preventDefault(); + const zoomFactor = e.deltaY < 0 ? 1.15 : 0.88; + setZoom((prev) => Math.min(Math.max(prev * zoomFactor, 0.5), 8.0)); + }; + + // Click to Select Player or Coordinate + const handleClick = () => { + if (hoveredPlayer) { + onSelectPlayer(hoveredPlayer); + } else if (hoveredCoord) { + const found = boardState.players.find((p) => p.x === hoveredCoord.x && p.y === hoveredCoord.y); + onSelectPlayer(found || null); + } + }; + + return ( +
{ + setIsDragging(false); + setHoveredCoord(null); + setHoveredPlayer(null); + }} + onWheel={handleWheel} + onClick={handleClick} + > + + + {/* Floating Coordinate Display */} +
+ + + Grid: 64x64 + + | + + Cursor:{' '} + + {hoveredCoord ? `(${hoveredCoord.x}, ${hoveredCoord.y})` : '-- , --'} + + + | + + Zoom: {(zoom * 100).toFixed(0)}% + +
+ + {/* Floating Reset View Button */} +
+ + + +
+ + {/* Selected Player Overlay card */} + {selectedPlayer && ( +
+
+ {selectedPlayer.name.slice(0, 2).toUpperCase()} +
+
+
{selectedPlayer.name}
+
+ ID: {selectedPlayer.id} • Pos: ({selectedPlayer.x}, {selectedPlayer.y}) +
+
+ +
+ )} +
+ ); +}; diff --git a/frontend/src/components/Header.tsx b/frontend/src/components/Header.tsx new file mode 100644 index 0000000..21e74af --- /dev/null +++ b/frontend/src/components/Header.tsx @@ -0,0 +1,89 @@ +import React from 'react'; + +interface HeaderProps { + isConnected: boolean; + onOpenRegister: () => void; + onQuickSpawn: () => void; + onResetBoard: () => void; + playerCount: number; +} + +export const Header: React.FC = ({ + isConnected, + onOpenRegister, + onQuickSpawn, + onResetBoard, + playerCount, +}) => { + return ( +
+ {/* Brand & Stats */} +
+
+
+ W +
+
+

+ botWebWars + + v1.0 + +

+

+ 64×64 Grid Arena • Coords (0,0) to (64,64) +

+
+
+ + {/* Live status badge */} +
+ + + {isConnected ? 'LIVE SYNC' : 'CONNECTING...'} + +
+
+ + {/* Action Buttons */} +
+ + API Docs ↗ + + + {playerCount > 0 && ( + + )} + + + + +
+
+ ); +}; diff --git a/frontend/src/components/PlayerList.tsx b/frontend/src/components/PlayerList.tsx new file mode 100644 index 0000000..4751d6b --- /dev/null +++ b/frontend/src/components/PlayerList.tsx @@ -0,0 +1,97 @@ +import React from 'react'; +import type { Player } from '../types'; + +interface PlayerListProps { + players: Player[]; + selectedPlayer: Player | null; + onSelectPlayer: (player: Player) => void; + onRemovePlayer: (id: string) => void; +} + +export const PlayerList: React.FC = ({ + players, + selectedPlayer, + onSelectPlayer, + onRemovePlayer, +}) => { + return ( +
+ {/* Header */} +
+
+ +

Active Bots

+
+ + {players.length} / 4096 + +
+ + {/* Players List */} +
+ {players.length === 0 ? ( +
+
🤖
+ No players registered yet. +
+ Register a player or spawn a random bot to place them on the grid! +
+ ) : ( + players.map((player) => { + const isSelected = selectedPlayer?.id === player.id; + return ( +
onSelectPlayer(player)} + className={`group flex items-center justify-between p-2.5 rounded-xl border transition-all cursor-pointer ${ + isSelected + ? 'bg-sky-950/40 border-sky-500 shadow-md shadow-sky-500/10' + : 'bg-slate-950/60 border-slate-800 hover:border-slate-700 hover:bg-slate-800/40' + }`} + > +
+
+ {player.name.slice(0, 2).toUpperCase()} +
+
+
+ {player.name} +
+
+ pos: ({player.x}, {player.y}) +
+
+
+ +
+ +
+
+ ); + }) + )} +
+ + {/* Footer Info */} +
+ Coordinate range: + [0,0] → [64,64] +
+
+ ); +}; diff --git a/frontend/src/components/RegisterModal.tsx b/frontend/src/components/RegisterModal.tsx new file mode 100644 index 0000000..a1edfd5 --- /dev/null +++ b/frontend/src/components/RegisterModal.tsx @@ -0,0 +1,206 @@ +import React, { useState } from 'react'; + +const PRESET_COLORS = [ + '#38BDF8', // Sky Blue + '#F43F5E', // Rose / Red + '#10B981', // Emerald Green + '#F59E0B', // Amber + '#A855F7', // Purple + '#EC4899', // Pink + '#06B6D4', // Cyan + '#EAB308', // Yellow + '#6366F1', // Indigo + '#14B8A6', // Teal +]; + +const RANDOM_NAMES = [ + 'CyberViper', + 'NexusBot', + 'PulseGhost', + 'ApexVector', + 'IronShard', + 'NovaMatrix', + 'QuantumGlitch', + 'EchoZero', + 'TitanByte', + 'ShadowCircuit', +]; + +interface RegisterModalProps { + isOpen: boolean; + onClose: () => void; + onRegister: (name: string, color: string) => Promise; +} + +export const RegisterModal: React.FC = ({ + isOpen, + onClose, + onRegister, +}) => { + const [name, setName] = useState(''); + const [color, setColor] = useState('#38BDF8'); + const [isSubmitting, setIsSubmitting] = useState(false); + const [error, setError] = useState(null); + + if (!isOpen) return null; + + const handleRandomize = () => { + const randomName = RANDOM_NAMES[Math.floor(Math.random() * RANDOM_NAMES.length)] + '_' + Math.floor(Math.random() * 900 + 100); + const randomColor = PRESET_COLORS[Math.floor(Math.random() * PRESET_COLORS.length)]; + setName(randomName); + setColor(randomColor); + }; + + const handleSubmit = async (e: React.FormEvent) => { + e.preventDefault(); + if (!name.trim()) { + setError('Please provide a bot name'); + return; + } + + try { + setIsSubmitting(true); + setError(null); + await onRegister(name.trim(), color); + onClose(); + setName(''); + } catch (err: unknown) { + if (err instanceof Error) { + setError(err.message); + } else { + setError('Failed to register player'); + } + } finally { + setIsSubmitting(false); + } + }; + + return ( +
+
+
+
+

+ + Register Player Avatar +

+

+ Enter arena coordinates between (0,0) and (64,64) +

+
+ +
+ + {error && ( +
+ {error} +
+ )} + +
+ {/* Avatar Preview */} +
+
+
+
+
+
+
+ + {name.trim() ? name : 'Avatar Preview'} + +
+
+ + {/* Player Name */} +
+
+ + +
+ setName(e.target.value)} + placeholder="e.g. CyberKnight" + maxLength={32} + className="w-full bg-slate-950 border border-slate-700 focus:border-sky-500 rounded-lg px-3 py-2 text-sm text-slate-100 placeholder-slate-500 focus:outline-none transition-colors" + required + /> +
+ + {/* Color Chooser */} +
+ +
+ {PRESET_COLORS.map((preset) => ( +
+
+ setColor(e.target.value)} + className="w-9 h-9 rounded cursor-pointer bg-transparent border-0 p-0" + /> + setColor(e.target.value)} + className="flex-1 bg-slate-950 border border-slate-700 focus:border-sky-500 rounded-lg px-3 py-1.5 text-xs font-mono text-slate-100 uppercase focus:outline-none" + /> +
+
+ + {/* Actions */} +
+ + +
+ +
+
+ ); +}; diff --git a/frontend/src/hooks/useGameSocket.ts b/frontend/src/hooks/useGameSocket.ts new file mode 100644 index 0000000..10ac211 --- /dev/null +++ b/frontend/src/hooks/useGameSocket.ts @@ -0,0 +1,175 @@ +import { useEffect, useRef, useState, useCallback } from 'react'; +import type { BoardState, Player } from '../types'; + +const INITIAL_BOARD: BoardState = { + config: { + min_x: 0, + max_x: 64, + min_y: 0, + max_y: 64, + grid_cells_x: 64, + grid_cells_y: 64, + }, + player_count: 0, + players: [], +}; + +export function useGameSocket() { + const [boardState, setBoardState] = useState(INITIAL_BOARD); + const [isConnected, setIsConnected] = useState(false); + const [selectedPlayer, setSelectedPlayer] = useState(null); + const wsRef = useRef(null); + const reconnectTimeoutRef = useRef(null); + + const fetchBoard = useCallback(async () => { + try { + const res = await fetch('/api/board'); + if (res.ok) { + const data: BoardState = await res.json(); + setBoardState(data); + } + } catch (err) { + console.error('Failed to fetch board state:', err); + } + }, []); + + const connectWebSocket = useCallback(() => { + if (wsRef.current && (wsRef.current.readyState === WebSocket.OPEN || wsRef.current.readyState === WebSocket.CONNECTING)) { + return; + } + + const protocol = window.location.protocol === 'https:' ? 'wss:' : 'ws:'; + const host = window.location.host; + const wsUrl = `${protocol}//${host}/ws`; + + const ws = new WebSocket(wsUrl); + wsRef.current = ws; + + ws.onopen = () => { + setIsConnected(true); + console.log('Connected to botWebWars WebSocket'); + }; + + ws.onmessage = (event) => { + try { + const data = JSON.parse(event.data); + if (data.event === 'init') { + setBoardState(data.state); + } else if (data.event === 'player_joined') { + setBoardState((prev) => { + const exists = prev.players.some((p) => p.id === data.player.id); + const nextPlayers = exists + ? prev.players.map((p) => (p.id === data.player.id ? data.player : p)) + : [...prev.players, data.player]; + return { + ...prev, + player_count: data.player_count ?? nextPlayers.length, + players: nextPlayers, + }; + }); + } else if (data.event === 'player_left') { + setBoardState((prev) => { + const nextPlayers = prev.players.filter((p) => p.id !== data.player_id); + return { + ...prev, + player_count: data.player_count ?? nextPlayers.length, + players: nextPlayers, + }; + }); + setSelectedPlayer((prev) => (prev?.id === data.player_id ? null : prev)); + } else if (data.event === 'board_reset') { + setBoardState((prev) => ({ + ...prev, + player_count: 0, + players: [], + })); + setSelectedPlayer(null); + } + } catch (err) { + console.error('Error parsing WebSocket message:', err); + } + }; + + ws.onclose = () => { + setIsConnected(false); + reconnectTimeoutRef.current = window.setTimeout(() => { + connectWebSocket(); + }, 2500); + }; + + ws.onerror = (err) => { + console.error('WebSocket encountered an error:', err); + ws.close(); + }; + }, []); + + useEffect(() => { + fetchBoard(); + connectWebSocket(); + + return () => { + if (reconnectTimeoutRef.current) { + clearTimeout(reconnectTimeoutRef.current); + } + if (wsRef.current) { + wsRef.current.close(); + } + }; + }, [fetchBoard, connectWebSocket]); + + // Keep player selection in sync if player updates + useEffect(() => { + if (selectedPlayer) { + const updated = boardState.players.find((p) => p.id === selectedPlayer.id); + if (updated) { + setSelectedPlayer(updated); + } else { + setSelectedPlayer(null); + } + } + }, [boardState.players, selectedPlayer]); + + const registerPlayer = async (name: string, color: string): Promise => { + const res = await fetch('/api/players', { + method: 'POST', + headers: { 'Content-Type': 'application/json' }, + body: JSON.stringify({ name, color }), + }); + if (!res.ok) { + const errorData = await res.json().catch(() => ({})); + throw new Error(errorData.detail || 'Failed to register player'); + } + const newPlayer: Player = await res.json(); + setSelectedPlayer(newPlayer); + return newPlayer; + }; + + const removePlayer = async (id: string) => { + const res = await fetch(`/api/players/${id}`, { + method: 'DELETE', + }); + if (!res.ok) { + throw new Error('Failed to remove player'); + } + }; + + const resetBoard = async () => { + const res = await fetch('/api/board/reset', { + method: 'POST', + }); + if (!res.ok) { + throw new Error('Failed to reset board'); + } + }; + + return { + boardState, + isConnected, + selectedPlayer, + setSelectedPlayer, + registerPlayer, + removePlayer, + resetBoard, + refresh: fetchBoard, + }; +} diff --git a/frontend/src/index.css b/frontend/src/index.css new file mode 100644 index 0000000..f3c600c --- /dev/null +++ b/frontend/src/index.css @@ -0,0 +1,33 @@ +@import "tailwindcss"; + +html, +body, +#root { + height: 100%; + width: 100%; + margin: 0; + padding: 0; + background-color: #020617; + color: #f8fafc; + overflow: hidden; + font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif; +} + +/* Custom scrollbars */ +::-webkit-scrollbar { + width: 6px; + height: 6px; +} + +::-webkit-scrollbar-track { + background: #0f172a; +} + +::-webkit-scrollbar-thumb { + background: #334155; + border-radius: 3px; +} + +::-webkit-scrollbar-thumb:hover { + background: #475569; +} diff --git a/frontend/src/main.tsx b/frontend/src/main.tsx new file mode 100644 index 0000000..bef5202 --- /dev/null +++ b/frontend/src/main.tsx @@ -0,0 +1,10 @@ +import { StrictMode } from 'react' +import { createRoot } from 'react-dom/client' +import './index.css' +import App from './App.tsx' + +createRoot(document.getElementById('root')!).render( + + + , +) diff --git a/frontend/src/types.ts b/frontend/src/types.ts new file mode 100644 index 0000000..dcb3379 --- /dev/null +++ b/frontend/src/types.ts @@ -0,0 +1,28 @@ +export interface Player { + id: string; + name: string; + color: string; + x: number; + y: number; + created_at: string; +} + +export interface BoardConfig { + min_x: number; + max_x: number; + min_y: number; + max_y: number; + grid_cells_x: number; + grid_cells_y: number; +} + +export interface BoardState { + config: BoardConfig; + player_count: number; + players: Player[]; +} + +export interface PlayerCreateRequest { + name: string; + color: string; +} diff --git a/frontend/tsconfig.app.json b/frontend/tsconfig.app.json new file mode 100644 index 0000000..6830b6f --- /dev/null +++ b/frontend/tsconfig.app.json @@ -0,0 +1,26 @@ +{ + "compilerOptions": { + "tsBuildInfoFile": "./node_modules/.tmp/tsconfig.app.tsbuildinfo", + "target": "es2023", + "lib": ["ES2023", "DOM"], + "module": "esnext", + "types": ["vite/client"], + "allowArbitraryExtensions": true, + "skipLibCheck": true, + + /* Bundler mode */ + "moduleResolution": "bundler", + "allowImportingTsExtensions": true, + "verbatimModuleSyntax": true, + "moduleDetection": "force", + "noEmit": true, + "jsx": "react-jsx", + + /* Linting */ + "noUnusedLocals": true, + "noUnusedParameters": true, + "erasableSyntaxOnly": true, + "noFallthroughCasesInSwitch": true + }, + "include": ["src"] +} diff --git a/frontend/tsconfig.json b/frontend/tsconfig.json new file mode 100644 index 0000000..1ffef60 --- /dev/null +++ b/frontend/tsconfig.json @@ -0,0 +1,7 @@ +{ + "files": [], + "references": [ + { "path": "./tsconfig.app.json" }, + { "path": "./tsconfig.node.json" } + ] +} diff --git a/frontend/tsconfig.node.json b/frontend/tsconfig.node.json new file mode 100644 index 0000000..8455dcb --- /dev/null +++ b/frontend/tsconfig.node.json @@ -0,0 +1,23 @@ +{ + "compilerOptions": { + "tsBuildInfoFile": "./node_modules/.tmp/tsconfig.node.tsbuildinfo", + "target": "es2023", + "lib": ["ES2023"], + "types": ["node"], + "skipLibCheck": true, + + /* Bundler mode */ + "module": "nodenext", + "allowImportingTsExtensions": true, + "verbatimModuleSyntax": true, + "moduleDetection": "force", + "noEmit": true, + + /* Linting */ + "noUnusedLocals": true, + "noUnusedParameters": true, + "erasableSyntaxOnly": true, + "noFallthroughCasesInSwitch": true + }, + "include": ["vite.config.ts"] +} diff --git a/frontend/vite.config.ts b/frontend/vite.config.ts new file mode 100644 index 0000000..834e149 --- /dev/null +++ b/frontend/vite.config.ts @@ -0,0 +1,24 @@ +import { defineConfig } from 'vite' +import react from '@vitejs/plugin-react' +import tailwindcss from '@tailwindcss/vite' + +// https://vite.dev/config/ +export default defineConfig({ + plugins: [ + react(), + tailwindcss(), + ], + server: { + port: 5173, + proxy: { + '/api': { + target: 'http://127.0.0.1:8000', + changeOrigin: true, + }, + '/ws': { + target: 'ws://127.0.0.1:8000', + ws: true, + } + } + } +})