build error

This commit is contained in:
RandyJC
2025-12-09 14:08:49 +01:00
parent ab7ddfed4b
commit 760fc93c1b
2 changed files with 13 additions and 4 deletions

View File

@@ -14,7 +14,7 @@ import { useRouter } from "next/navigation"
import { useState } from "react"
const Manager = () => {
const { setGameId, setStatus } = useManagerStore()
const { gameId, setGameId, setStatus } = useManagerStore()
const router = useRouter()
const { socket } = useSocket()
@@ -42,7 +42,8 @@ const Manager = () => {
socket?.emit("game:create", quizzId)
}
const handleBreakToggle = (active: boolean) => {
socket?.emit("manager:setBreak", { gameId: null, active })
if (!gameId) return
socket?.emit("manager:setBreak", { gameId, active })
}
if (!isAuth) {
@@ -56,6 +57,7 @@ const Manager = () => {
onBack={() => setShowEditor(false)}
onListUpdate={setQuizzList}
onBreakToggle={handleBreakToggle}
gameId={gameId}
/>
)
}

View File

@@ -13,6 +13,7 @@ type Props = {
onBack: () => void
onListUpdate: (_quizz: QuizzWithId[]) => void
onBreakToggle?: (_active: boolean) => void
gameId?: string | null
}
type EditableQuestion = QuizzWithId["questions"][number]
@@ -56,7 +57,13 @@ const formatBytes = (bytes: number) => {
return `${value.toFixed(value >= 10 || value % 1 === 0 ? 0 : 1)} ${units[i]}`
}
const QuizEditor = ({ quizzList, onBack, onListUpdate, onBreakToggle }: Props) => {
const QuizEditor = ({
quizzList,
onBack,
onListUpdate,
onBreakToggle,
gameId,
}: Props) => {
const { socket } = useSocket()
const [selectedId, setSelectedId] = useState<string | null>(null)
const [draft, setDraft] = useState<QuizzWithId | null>(null)
@@ -475,7 +482,7 @@ const QuizEditor = ({ quizzList, onBack, onListUpdate, onBreakToggle }: Props) =
Delete quiz
</Button>
)}
{onBreakToggle && (
{onBreakToggle && gameId && (
<>
<Button className="bg-amber-500" onClick={() => onBreakToggle(true)}>
Break