diff --git a/frontend/components/dashboard.tsx b/frontend/components/dashboard.tsx index f80d9e5..838cd62 100644 --- a/frontend/components/dashboard.tsx +++ b/frontend/components/dashboard.tsx @@ -241,6 +241,7 @@ export function Dashboard() { loadingTournaments={loadingTournaments} onSelectOrg={setActiveOrgId} onCreateTournament={handleCreateTournament} + onCreateOrg={handleCreateOrg} /> ) : ( @@ -393,6 +394,7 @@ function OrganizationView({ loadingTournaments, onSelectOrg, onCreateTournament, + onCreateOrg, }: { org: MyOrg orgs: MyOrg[] @@ -400,6 +402,7 @@ function OrganizationView({ loadingTournaments: boolean onSelectOrg: (id: string) => void onCreateTournament: (name: string) => void + onCreateOrg: (name: string) => void }) { return (
@@ -422,7 +425,7 @@ function OrganizationView({
)} -
+
Medlemmer +
@@ -497,6 +501,75 @@ function OrganizationSwitcher({ ) } +// Ingen vei fantes tidligere til å opprette en ANDRE organisasjon når man +// allerede har én -- CreateOrganizationState (under) vises kun ved null +// org-er. Backend (POST /orgs) har ingen begrensning på antall org-er én +// bruker kan eie (ADR-021), så dette var en ren UI-mangel. +function NewOrganizationControl({ onCreate }: { onCreate: (name: string) => void }) { + const [open, setOpen] = useState(false) + const [name, setName] = useState("") + const valid = name.trim().length >= 2 + + function handleSubmit(e: React.FormEvent) { + e.preventDefault() + if (!valid) return + onCreate(name.trim()) + setName("") + setOpen(false) + } + + if (!open) { + return ( + + ) + } + + return ( +
+ setName(e.target.value)} + onKeyDown={(e) => { + if (e.key === "Escape") setOpen(false) + }} + className="h-10 min-w-0 flex-1 rounded-xl text-base sm:w-56" + /> + + +
+ ) +} + function NewTournamentControl({ onCreate }: { onCreate: (name: string) => void }) { const [open, setOpen] = useState(false) const [name, setName] = useState("") diff --git a/frontend/components/tournament-program.tsx b/frontend/components/tournament-program.tsx index b8ce1bc..e745e10 100644 --- a/frontend/components/tournament-program.tsx +++ b/frontend/components/tournament-program.tsx @@ -321,22 +321,28 @@ export function TournamentProgram({ {sorted.length === 0 ? ( ) : ( -
    - {sorted.map((session, index) => ( - setCourses((prev) => [...prev, course])} - onSave={(patch) => updateSession(session.id, patch)} - onDelete={() => deleteSession(session.id)} - /> - ))} -
+ <> + s.scheduled_at !== null).length} + /> +
    + {sorted.map((session, index) => ( + setCourses((prev) => [...prev, course])} + onSave={(patch) => updateSession(session.id, patch)} + onDelete={() => deleteSession(session.id)} + /> + ))} +
+ )}
@@ -844,6 +850,35 @@ function MetaBadge({ children }: { children: React.ReactNode }) { ) } +// --- Date coverage summary --------------------------------------------------- +// Ingen sammendrag fantes tidligere for "har alle runder fått dato" -- måtte +// leses manuelt per øktkort. All nødvendig data finnes allerede i sessions. + +function DateCoverageSummary({ total, withDate }: { total: number; withDate: number }) { + const allSet = withDate === total + return ( +
+ {allSet ? ( +
+ ) +} + // --- Empty state ----------------------------------------------------------- function EmptyState() {