mirror of
https://github.com/randyjc/Rahoot.git
synced 2026-03-13 20:15:35 +01:00
build error
This commit is contained in:
@@ -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}
|
||||
/>
|
||||
)
|
||||
}
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user