新增競賽前台呈現、刪除競賽、修改競賽狀態

This commit is contained in:
2025-09-16 14:57:40 +08:00
parent 1f2fb14bd0
commit b4386dc481
21 changed files with 1714 additions and 127 deletions

View File

@@ -122,6 +122,23 @@ export function CompetitionProvider({ children }: { children: ReactNode }) {
const [teams, setTeams] = useState<Team[]>(mockTeams)
const [proposals, setProposals] = useState<Proposal[]>(mockProposals)
// 載入當前競賽
useEffect(() => {
const loadCurrentCompetition = async () => {
try {
const response = await fetch('/api/competitions/current')
const data = await response.json()
if (data.success && data.data) {
setCurrentCompetition(data.data)
}
} catch (error) {
console.error('載入當前競賽失敗:', error)
}
}
loadCurrentCompetition()
}, [])
// Load judge scores from localStorage
const [judgeScores, setJudgeScores] = useState<JudgeScore[]>(() => {
if (typeof window !== "undefined") {
@@ -186,6 +203,7 @@ export function CompetitionProvider({ children }: { children: ReactNode }) {
}
}, [awards])
const addJudge = (judge: Omit<Judge, "id">) => {
const newJudge: Judge = {
...judge,