diff --git a/packages/client/src/components/jury-host.tsx b/packages/client/src/components/jury-host.tsx new file mode 100644 index 0000000..15f3b5a --- /dev/null +++ b/packages/client/src/components/jury-host.tsx @@ -0,0 +1,91 @@ +import { useState } from "react" +import type { Entry, JuryRound, JuryResult } from "@celebrate-esc/shared" +import { Button } from "@/components/ui/button" +import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card" + +interface JuryHostProps { + entries: Entry[] + currentRound: JuryRound | null + results: JuryResult[] + onOpenVote: (countryCode: string) => void + onCloseVote: () => void +} + +export function JuryHost({ entries, currentRound, results, onOpenVote, onCloseVote }: JuryHostProps) { + const [selectedCountry, setSelectedCountry] = useState(null) + const votedCountries = new Set(results.map((r) => r.countryCode)) + + if (currentRound) { + return ( + + + + Voting: {currentRound.countryFlag} {currentRound.countryName} + + + + + + + ) + } + + return ( + + + Jury Voting + + + {results.length > 0 && ( +
+

+ Completed ({results.length}) +

+ {results.map((r) => ( +
+ {r.countryFlag} {r.countryName} + avg {r.averageRating} ({r.totalVotes} votes) +
+ ))} +
+ )} +
+ {entries.map((entry) => { + const voted = votedCountries.has(entry.country.code) + const isSelected = selectedCountry === entry.country.code + return ( + + ) + })} +
+ {selectedCountry && ( + + )} +
+
+ ) +}