Prod hardening: one-game-per-player, selectable music, bargevasat.ir config
- One running game per player: server rejects a 2nd matchmake while in a live room (re-syncs the existing game); client guards Home vs-computer + Lobby random/create — resumes the running match + notifies instead of starting another (game-store hasActiveMatch()). - Background music is now selectable: santoor (سنتی, calm Persian loop) and playful (bouncy UNO-like) — sound.ts TRACKS + setMusicTrack (persisted), sound-store musicTrack, picker in Profile → Audio. i18n added. - Production config for bargevasat.ir (prepare-only; no live deploy): appsettings.Production.example (CORS + ZarinPal + IAB to the domain), docker-compose.caddy.yml + Caddyfile (auto-HTTPS reverse proxy bargevasat.ir→web, api.bargevasat.ir→server), ENV_FILE PRODUCTION block, PRODUCTION.md go-live + Cafe Bazaar publish/IAB checklist. Fixed IAB package name to match Capacitor appId (com.bargevasat.app). Verified: tsc + next build + dotnet build all pass. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -16,7 +16,8 @@ import {
|
||||
} from "lucide-react";
|
||||
import { useEffect, useState } from "react";
|
||||
import { Zap } from "lucide-react";
|
||||
import { useGameStore } from "@/lib/game-store";
|
||||
import { useGameStore, hasActiveMatch } from "@/lib/game-store";
|
||||
import { pushNotification } from "@/lib/notification-store";
|
||||
import { useSessionStore } from "@/lib/session-store";
|
||||
import { useUIStore, type Screen } from "@/lib/ui-store";
|
||||
import { useI18n } from "@/lib/i18n";
|
||||
@@ -45,6 +46,20 @@ export function HomeScreen() {
|
||||
const [speed, setSpeed] = useState(false);
|
||||
|
||||
const playVsComputer = () => {
|
||||
// One game at a time: resume the running match instead of starting a new one.
|
||||
if (hasActiveMatch()) {
|
||||
useGameStore.getState().resume();
|
||||
goGame("home");
|
||||
pushNotification({
|
||||
kind: "system",
|
||||
titleFa: "بازی در جریان",
|
||||
titleEn: "Game in progress",
|
||||
bodyFa: "ابتدا بازی فعلی را تمام کنید یا تسلیم شوید.",
|
||||
bodyEn: "Finish or forfeit your current game first.",
|
||||
icon: "🎮",
|
||||
});
|
||||
return;
|
||||
}
|
||||
const you = profile?.displayName || t("seat.you");
|
||||
newMatch({
|
||||
names: [you, "آرش", "کیان", "نیلوفر"],
|
||||
|
||||
Reference in New Issue
Block a user