"use client"
import { NumberBall } from "@/components/number-ball"
import { SettingsPanel } from "@/components/settings"
import { ResultPanel } from "@/components/result"
import { SingleModePanel } from "@/components/single-panel"
import { TitleBar } from "@/components/title-bar"
import { useRollCallLogic } from "@/components/logic"
import { useEffect } from "react"
export default function Page() {
const [state, actions] = useRollCallLogic()
const isSingleMode = state.mode === "single"
// 禁用右键菜单
useEffect(() => {
const handleContextMenu = (e: MouseEvent) => {
e.preventDefault()
}
document.addEventListener('contextmenu', handleContextMenu)
return () => {
document.removeEventListener('contextmenu', handleContextMenu)
}
}, [])
return (
{/* Custom title bar */}
{/* Main content */}
{/* Left sidebar — config (fixed width, full height) */}
{/* Right content — fills remaining space */}
{/* Single mode: Full height matrix with records */}
{isSingleMode ? (
<>
{/* Matrix area - full width, dynamic centering */}
MATRIX
{state.selectedRecords.length > 0 && (
{state.selectedRecords.length} SELECTED
)}
{Array.from({ length: typeof state.totalTasks === 'number' ? state.totalTasks : 0 }, (_, i) => i + 1).map((n) => (
))}
{/* Single mode records panel */}
>
) : (
<>
{/* Group mode: Matrix grid */}
MATRIX
{state.hasResult && (
{state.highlighted.size} SELECTED
)}
{Array.from({ length: typeof state.totalTasks === 'number' ? state.totalTasks : 0 }, (_, i) => i + 1).map((n) => (
))}
{/* Group mode result panel */}
OUTPUT
{state.hasResult && state.groups.length > 0 && (
CLEAR
)}
>
)}
)
}