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

View File

@@ -13,6 +13,7 @@ type Props = {
onBack: () => void onBack: () => void
onListUpdate: (_quizz: QuizzWithId[]) => void onListUpdate: (_quizz: QuizzWithId[]) => void
onBreakToggle?: (_active: boolean) => void onBreakToggle?: (_active: boolean) => void
gameId?: string | null
} }
type EditableQuestion = QuizzWithId["questions"][number] 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]}` 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 { socket } = useSocket()
const [selectedId, setSelectedId] = useState<string | null>(null) const [selectedId, setSelectedId] = useState<string | null>(null)
const [draft, setDraft] = useState<QuizzWithId | null>(null) const [draft, setDraft] = useState<QuizzWithId | null>(null)
@@ -475,7 +482,7 @@ const QuizEditor = ({ quizzList, onBack, onListUpdate, onBreakToggle }: Props) =
Delete quiz Delete quiz
</Button> </Button>
)} )}
{onBreakToggle && ( {onBreakToggle && gameId && (
<> <>
<Button className="bg-amber-500" onClick={() => onBreakToggle(true)}> <Button className="bg-amber-500" onClick={() => onBreakToggle(true)}>
Break Break