fix(multi): restrict search and game settings to room host only

This commit is contained in:
jessy-david-dev
2026-04-11 22:02:06 +02:00
parent 0401cdffe6
commit ede083f881
12 changed files with 126 additions and 34 deletions
+2
View File
@@ -4,6 +4,7 @@ import { useEffect, useRef } from "react";
import { ArticleView } from "./ArticleView";
import { Breadcrumbs } from "./Breadcrumbs";
import type { Room } from "../api/rooms/route";
import { useCtrlFBlock } from "../../lib/useSearchAllowed";
type GameScreenProps = {
room: Room;
@@ -28,6 +29,7 @@ export function GameScreen({
countdown, onNavigate, onRetry, onNextRound, onResetGame, onSurrender,
}: GameScreenProps) {
const breadcrumbEndRef = useRef<HTMLDivElement>(null);
useCtrlFBlock(room.searchAllowed);
const myPlayer = room.players.find((p) => p.id === playerId);
const isHost = myPlayer?.isHost ?? false;
const myFinished = myPlayer?.hasWon || myPlayer?.hasSurrendered;