@burdenoff/microfe-atheletebridge 2026.1110.1 → 2026.1110.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/atheletebridge/AthleteBridgeRoutes.js +22 -6
- package/dist/atheletebridge/AthleteBridgeRoutes.js.map +1 -1
- package/dist/atheletebridge/components/StatusBadge.js +8 -0
- package/dist/atheletebridge/components/StatusBadge.js.map +1 -1
- package/dist/atheletebridge/hooks/useAuditApi.d.ts +14 -0
- package/dist/atheletebridge/hooks/useAuditApi.js +38 -0
- package/dist/atheletebridge/hooks/useAuditApi.js.map +1 -0
- package/dist/atheletebridge/hooks/useRegistrationApi.d.ts +15 -0
- package/dist/atheletebridge/hooks/useRegistrationApi.js +38 -19
- package/dist/atheletebridge/hooks/useRegistrationApi.js.map +1 -1
- package/dist/atheletebridge/pages/audit/AuditLogPage.d.ts +11 -0
- package/dist/atheletebridge/pages/audit/AuditLogPage.js +277 -0
- package/dist/atheletebridge/pages/audit/AuditLogPage.js.map +1 -0
- package/dist/atheletebridge/pages/control/ClubControlPage.d.ts +11 -0
- package/dist/atheletebridge/pages/control/ClubControlPage.js +208 -0
- package/dist/atheletebridge/pages/control/ClubControlPage.js.map +1 -0
- package/dist/atheletebridge/pages/fixtures/FixtureDetailPage.js +126 -65
- package/dist/atheletebridge/pages/fixtures/FixtureDetailPage.js.map +1 -1
- package/dist/atheletebridge/pages/registrations/RegistrationFormBuilderPage.js +243 -217
- package/dist/atheletebridge/pages/registrations/RegistrationFormBuilderPage.js.map +1 -1
- package/dist/atheletebridge/pages/registrations/RegistrationFormDetailPage.js +136 -83
- package/dist/atheletebridge/pages/registrations/RegistrationFormDetailPage.js.map +1 -1
- package/dist/atheletebridge/pages/registrations/RegistrationSubmissionPage.js +173 -146
- package/dist/atheletebridge/pages/registrations/RegistrationSubmissionPage.js.map +1 -1
- package/dist/atheletebridge/types/audit.d.ts +47 -0
- package/dist/atheletebridge/types/registration.d.ts +22 -1
- package/package.json +1 -1
|
@@ -0,0 +1,208 @@
|
|
|
1
|
+
import { PageLayout as e } from "../../components/PageLayout.js";
|
|
2
|
+
import { EmptyState as t } from "../../components/EmptyState.js";
|
|
3
|
+
import { ErrorState as n, LoadingState as r } from "../../components/LoadingState.js";
|
|
4
|
+
import { MetricsCard as i } from "../../components/MetricsCard.js";
|
|
5
|
+
import { SPORT_LABELS as a } from "../../components/domain.js";
|
|
6
|
+
import { useAthleteBridge as o } from "../../context/AthleteBridgeContext.js";
|
|
7
|
+
import { useFixtures as s, useSessions as c, useTeams as l } from "../../hooks/useAthleteBridgeApi.js";
|
|
8
|
+
import { useRegistrationForms as u } from "../../hooks/useRegistrationApi.js";
|
|
9
|
+
import { useAbTranslate as d } from "../../i18n.js";
|
|
10
|
+
import { useMemo as f } from "react";
|
|
11
|
+
import { CalendarDays as p, ClipboardList as m, ShieldCheck as h, TrendingUp as g, Trophy as _, Users as v } from "lucide-react";
|
|
12
|
+
import { jsx as y, jsxs as b } from "react/jsx-runtime";
|
|
13
|
+
// src/atheletebridge/pages/control/ClubControlPage.tsx
|
|
14
|
+
var x = 100;
|
|
15
|
+
function S(e, t) {
|
|
16
|
+
let n = 0, r = 0, i = 0, a = 0, o = 0;
|
|
17
|
+
for (let s of t) {
|
|
18
|
+
let t = s.homeTeamId === e, c = s.awayTeamId === e;
|
|
19
|
+
if (t || c) {
|
|
20
|
+
if (s.status === "COMPLETED") {
|
|
21
|
+
if (s.homeScore == null || s.awayScore == null) continue;
|
|
22
|
+
n += 1;
|
|
23
|
+
let e = t ? s.homeScore : s.awayScore, o = t ? s.awayScore : s.homeScore;
|
|
24
|
+
e > o ? r += 1 : e === o ? i += 1 : a += 1;
|
|
25
|
+
} else (s.status === "SCHEDULED" || s.status === "LIVE" || s.status === "POSTPONED") && (o += 1);
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
return {
|
|
29
|
+
played: n,
|
|
30
|
+
won: r,
|
|
31
|
+
drawn: i,
|
|
32
|
+
lost: a,
|
|
33
|
+
upcoming: o
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
function C() {
|
|
37
|
+
let C = d(), { navigateTo: w } = o(), T = l({ pagination: { limit: x } }), E = s({ pagination: { limit: x } }), D = c({ pagination: { limit: x } }), O = u({ pagination: { limit: x } }), k = T.isLoading || E.isLoading || D.isLoading || O.isLoading, A = T.isError || E.isError || D.isError || O.isError, j = f(() => {
|
|
38
|
+
let e = E.data?.items ?? [];
|
|
39
|
+
return (T.data?.items ?? []).map((t) => ({
|
|
40
|
+
team: t,
|
|
41
|
+
rosterSize: t.members?.items?.length ?? 0,
|
|
42
|
+
...S(t.id, e)
|
|
43
|
+
}));
|
|
44
|
+
}, [T.data, E.data]), M = f(() => {
|
|
45
|
+
let e = (E.data?.items ?? []).filter((e) => e.status === "COMPLETED" && e.homeScore != null && e.awayScore != null), t = e.filter((e) => e.homeScore !== e.awayScore), n = j.reduce((e, t) => e + t.rosterSize, 0), r = (D.data?.items ?? []).filter((e) => e.status === "REQUESTED" || e.status === "CONFIRMED").length, i = (O.data?.items ?? []).filter((e) => e.status === "PUBLISHED");
|
|
46
|
+
return {
|
|
47
|
+
squads: j.length,
|
|
48
|
+
athletes: n,
|
|
49
|
+
played: e.length,
|
|
50
|
+
winRate: e.length > 0 ? Math.round(t.length / e.length * 100) : null,
|
|
51
|
+
upcomingSessions: r,
|
|
52
|
+
liveRegistrations: i.reduce((e, t) => e + t.submissionCount, 0)
|
|
53
|
+
};
|
|
54
|
+
}, [
|
|
55
|
+
E.data,
|
|
56
|
+
D.data,
|
|
57
|
+
O.data,
|
|
58
|
+
j
|
|
59
|
+
]);
|
|
60
|
+
return k ? /* @__PURE__ */ y(e, {
|
|
61
|
+
title: C("atheletebridge.pages.controlRoom.title", "Control room"),
|
|
62
|
+
children: /* @__PURE__ */ y(r, { label: C("atheletebridge.pages.controlRoom.loading", "Loading club overview…") })
|
|
63
|
+
}) : A ? /* @__PURE__ */ y(e, {
|
|
64
|
+
title: C("atheletebridge.pages.controlRoom.title", "Control room"),
|
|
65
|
+
children: /* @__PURE__ */ y(n, { onRetry: () => {
|
|
66
|
+
T.refetch(), E.refetch(), D.refetch(), O.refetch();
|
|
67
|
+
} })
|
|
68
|
+
}) : /* @__PURE__ */ b(e, {
|
|
69
|
+
title: C("atheletebridge.pages.controlRoom.title", "Control room"),
|
|
70
|
+
description: C("atheletebridge.pages.controlRoom.description", "Every squad in your club at a glance — rosters, results, what is coming up and who has registered."),
|
|
71
|
+
hero: !0,
|
|
72
|
+
gradientTitle: !0,
|
|
73
|
+
children: [
|
|
74
|
+
/* @__PURE__ */ b("div", {
|
|
75
|
+
className: "mb-8 grid grid-cols-2 gap-4 lg:grid-cols-3",
|
|
76
|
+
children: [
|
|
77
|
+
/* @__PURE__ */ y(i, {
|
|
78
|
+
icon: /* @__PURE__ */ y(h, { className: "h-4 w-4" }),
|
|
79
|
+
label: C("atheletebridge.pages.controlRoom.kpiSquads", "Squads"),
|
|
80
|
+
value: M.squads
|
|
81
|
+
}),
|
|
82
|
+
/* @__PURE__ */ y(i, {
|
|
83
|
+
icon: /* @__PURE__ */ y(v, { className: "h-4 w-4" }),
|
|
84
|
+
label: C("atheletebridge.pages.controlRoom.kpiAthletes", "Athletes on rosters"),
|
|
85
|
+
value: M.athletes
|
|
86
|
+
}),
|
|
87
|
+
/* @__PURE__ */ y(i, {
|
|
88
|
+
icon: /* @__PURE__ */ y(_, { className: "h-4 w-4" }),
|
|
89
|
+
label: C("atheletebridge.pages.controlRoom.kpiPlayed", "Fixtures played"),
|
|
90
|
+
value: M.played
|
|
91
|
+
}),
|
|
92
|
+
/* @__PURE__ */ y(i, {
|
|
93
|
+
icon: /* @__PURE__ */ y(g, { className: "h-4 w-4" }),
|
|
94
|
+
label: C("atheletebridge.pages.controlRoom.kpiWinRate", "Win rate"),
|
|
95
|
+
value: M.winRate == null ? "—" : `${M.winRate}%`
|
|
96
|
+
}),
|
|
97
|
+
/* @__PURE__ */ y(i, {
|
|
98
|
+
icon: /* @__PURE__ */ y(p, { className: "h-4 w-4" }),
|
|
99
|
+
label: C("atheletebridge.pages.controlRoom.kpiSessions", "Upcoming sessions"),
|
|
100
|
+
value: M.upcomingSessions
|
|
101
|
+
}),
|
|
102
|
+
/* @__PURE__ */ y(i, {
|
|
103
|
+
icon: /* @__PURE__ */ y(m, { className: "h-4 w-4" }),
|
|
104
|
+
label: C("atheletebridge.pages.controlRoom.kpiRegistrations", "Live registrations"),
|
|
105
|
+
value: M.liveRegistrations
|
|
106
|
+
})
|
|
107
|
+
]
|
|
108
|
+
}),
|
|
109
|
+
/* @__PURE__ */ y("h2", {
|
|
110
|
+
className: "mb-3 text-base font-semibold text-text-primary",
|
|
111
|
+
children: C("atheletebridge.pages.controlRoom.squads", "Squads")
|
|
112
|
+
}),
|
|
113
|
+
j.length === 0 ? /* @__PURE__ */ y(t, {
|
|
114
|
+
illustration: "empty-data",
|
|
115
|
+
icon: /* @__PURE__ */ y(h, { className: "h-10 w-10" }),
|
|
116
|
+
title: C("atheletebridge.pages.controlRoom.empty", "No squads yet"),
|
|
117
|
+
description: C("atheletebridge.pages.controlRoom.emptyHint", "Create your first team to start tracking squads here."),
|
|
118
|
+
action: /* @__PURE__ */ b("button", {
|
|
119
|
+
type: "button",
|
|
120
|
+
onClick: () => w("/teams/new"),
|
|
121
|
+
className: "inline-flex items-center gap-1.5 rounded-lg bg-action-primary-bg px-4 py-2 text-sm font-medium text-action-primary-text transition-colors hover:bg-action-primary-bg/90",
|
|
122
|
+
children: [
|
|
123
|
+
/* @__PURE__ */ y(v, { className: "h-4 w-4" }),
|
|
124
|
+
" ",
|
|
125
|
+
C("atheletebridge.pages.controlRoom.createTeam", "Create a team")
|
|
126
|
+
]
|
|
127
|
+
})
|
|
128
|
+
}) : /* @__PURE__ */ y("div", {
|
|
129
|
+
className: "overflow-x-auto rounded-lg border border-border-seam",
|
|
130
|
+
children: /* @__PURE__ */ b("table", {
|
|
131
|
+
className: "w-full text-sm",
|
|
132
|
+
"data-testid": "control-room-squads",
|
|
133
|
+
children: [/* @__PURE__ */ y("thead", {
|
|
134
|
+
className: "bg-bg-sunken text-left text-xs uppercase tracking-wide text-text-secondary",
|
|
135
|
+
children: /* @__PURE__ */ b("tr", { children: [
|
|
136
|
+
/* @__PURE__ */ y("th", {
|
|
137
|
+
className: "px-4 py-2 font-medium",
|
|
138
|
+
children: C("atheletebridge.pages.controlRoom.colSquad", "Squad")
|
|
139
|
+
}),
|
|
140
|
+
/* @__PURE__ */ y("th", {
|
|
141
|
+
className: "px-4 py-2 text-right font-medium",
|
|
142
|
+
children: C("atheletebridge.pages.controlRoom.colRoster", "Roster")
|
|
143
|
+
}),
|
|
144
|
+
/* @__PURE__ */ y("th", {
|
|
145
|
+
className: "px-4 py-2 text-right font-medium",
|
|
146
|
+
children: C("atheletebridge.pages.controlRoom.colRecord", "W · D · L")
|
|
147
|
+
}),
|
|
148
|
+
/* @__PURE__ */ y("th", {
|
|
149
|
+
className: "px-4 py-2 text-right font-medium",
|
|
150
|
+
children: C("atheletebridge.pages.controlRoom.colUpcoming", "Upcoming")
|
|
151
|
+
}),
|
|
152
|
+
/* @__PURE__ */ y("th", {
|
|
153
|
+
className: "px-4 py-2 text-right font-medium",
|
|
154
|
+
children: C("atheletebridge.pages.controlRoom.colPoints", "Points")
|
|
155
|
+
})
|
|
156
|
+
] })
|
|
157
|
+
}), /* @__PURE__ */ y("tbody", {
|
|
158
|
+
className: "divide-y divide-border-seam bg-bg-surface",
|
|
159
|
+
children: j.map((e) => /* @__PURE__ */ b("tr", {
|
|
160
|
+
tabIndex: 0,
|
|
161
|
+
role: "link",
|
|
162
|
+
onClick: () => w(`/teams/${e.team.id}`),
|
|
163
|
+
onKeyDown: (t) => {
|
|
164
|
+
t.key === "Enter" && w(`/teams/${e.team.id}`);
|
|
165
|
+
},
|
|
166
|
+
className: "cursor-pointer text-text-primary transition-colors hover:bg-bg-sunken focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[var(--color-focus-ring)]",
|
|
167
|
+
children: [
|
|
168
|
+
/* @__PURE__ */ b("td", {
|
|
169
|
+
className: "px-4 py-2",
|
|
170
|
+
children: [/* @__PURE__ */ y("span", {
|
|
171
|
+
className: "block font-medium",
|
|
172
|
+
children: e.team.name
|
|
173
|
+
}), /* @__PURE__ */ y("span", {
|
|
174
|
+
className: "block text-xs text-text-secondary",
|
|
175
|
+
children: [
|
|
176
|
+
a[e.team.sport],
|
|
177
|
+
e.team.ageGroup,
|
|
178
|
+
e.team.season
|
|
179
|
+
].filter(Boolean).join(" · ")
|
|
180
|
+
})]
|
|
181
|
+
}),
|
|
182
|
+
/* @__PURE__ */ y("td", {
|
|
183
|
+
className: "px-4 py-2 text-right tabular-nums",
|
|
184
|
+
children: e.rosterSize
|
|
185
|
+
}),
|
|
186
|
+
/* @__PURE__ */ y("td", {
|
|
187
|
+
className: "px-4 py-2 text-right tabular-nums",
|
|
188
|
+
children: e.played === 0 ? "—" : `${e.won} · ${e.drawn} · ${e.lost}`
|
|
189
|
+
}),
|
|
190
|
+
/* @__PURE__ */ y("td", {
|
|
191
|
+
className: "px-4 py-2 text-right tabular-nums",
|
|
192
|
+
children: e.upcoming
|
|
193
|
+
}),
|
|
194
|
+
/* @__PURE__ */ y("td", {
|
|
195
|
+
className: "px-4 py-2 text-right tabular-nums",
|
|
196
|
+
children: e.played === 0 ? "—" : e.won * 3 + e.drawn
|
|
197
|
+
})
|
|
198
|
+
]
|
|
199
|
+
}, e.team.id))
|
|
200
|
+
})]
|
|
201
|
+
})
|
|
202
|
+
})
|
|
203
|
+
]
|
|
204
|
+
});
|
|
205
|
+
}
|
|
206
|
+
export { C as ClubControlPage };
|
|
207
|
+
|
|
208
|
+
//# sourceMappingURL=ClubControlPage.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ClubControlPage.js","names":["PAGE_SIZE","squadRecord","played","won","drawn","lost","upcoming","fixture","fixtures","isHome","teamId","isAway","ours","theirs","ClubControlPage","tr","useAbTranslate","useAthleteBridge","teams","useTeams","useFixtures","sessions","useSessions","forms","useRegistrationForms","loading","failed","squadRows","useMemo","fixtureItems","team","kpis","completed","wins","athletes","sum","row","upcomingSessions","session","publishedForms","form","PageLayout","LoadingState","ErrorState","MetricsCard","ShieldCheck","Users","Trophy","TrendingUp","CalendarDays","ClipboardList","EmptyState","navigateTo","e","SPORT_LABELS"],"sources":["../../../../src/atheletebridge/pages/control/ClubControlPage.tsx"],"sourcesContent":["/**\n * Club control room (BOFF-5863)\n * @module atheletebridge/pages/control\n *\n * The multi-squad oversight surface for a club or academy: workspace-level\n * KPIs plus one row per squad derived ENTIRELY from records already loaded\n * through the real gateway queries — no invented metrics. A squad's\n * W/D/L record uses full-time scores (knockout extra-time / penalty deciders\n * are deliberately not folded into the league-style record).\n */\n\nimport { useMemo } from 'react';\nimport { CalendarDays, ClipboardList, ShieldCheck, TrendingUp, Trophy, Users } from 'lucide-react';\nimport { PageLayout } from '../../components/PageLayout';\nimport { EmptyState } from '../../components/EmptyState';\nimport { LoadingState, ErrorState } from '../../components/LoadingState';\nimport { MetricsCard } from '../../components/MetricsCard';\nimport { SPORT_LABELS } from '../../components/domain';\nimport { useAthleteBridge } from '../../context/AthleteBridgeContext';\nimport { useFixtures, useSessions, useTeams } from '../../hooks/useAthleteBridgeApi';\nimport { useRegistrationForms } from '../../hooks/useRegistrationApi';\nimport { useAbTranslate } from '../../i18n';\nimport type { AthFixture, AthTeam } from '../../types';\n\nconst PAGE_SIZE = 100;\n\ninterface SquadRow {\n team: AthTeam;\n rosterSize: number;\n played: number;\n won: number;\n drawn: number;\n lost: number;\n upcoming: number;\n}\n\n/** Full-time league-style record for one team across the loaded fixtures. */\nfunction squadRecord(teamId: string, fixtures: AthFixture[]) {\n let played = 0;\n let won = 0;\n let drawn = 0;\n let lost = 0;\n let upcoming = 0;\n for (const fixture of fixtures) {\n const isHome = fixture.homeTeamId === teamId;\n const isAway = fixture.awayTeamId === teamId;\n if (!isHome && !isAway) continue;\n if (fixture.status === 'COMPLETED') {\n if (fixture.homeScore == null || fixture.awayScore == null) continue;\n played += 1;\n const ours = isHome ? fixture.homeScore : fixture.awayScore;\n const theirs = isHome ? fixture.awayScore : fixture.homeScore;\n if (ours > theirs) won += 1;\n else if (ours === theirs) drawn += 1;\n else lost += 1;\n } else if (\n fixture.status === 'SCHEDULED' ||\n fixture.status === 'LIVE' ||\n fixture.status === 'POSTPONED'\n ) {\n upcoming += 1;\n }\n }\n return { played, won, drawn, lost, upcoming };\n}\n\nexport function ClubControlPage() {\n const tr = useAbTranslate();\n const { navigateTo } = useAthleteBridge();\n\n const teams = useTeams({ pagination: { limit: PAGE_SIZE } });\n const fixtures = useFixtures({ pagination: { limit: PAGE_SIZE } });\n const sessions = useSessions({ pagination: { limit: PAGE_SIZE } });\n const forms = useRegistrationForms({ pagination: { limit: PAGE_SIZE } });\n\n const loading = teams.isLoading || fixtures.isLoading || sessions.isLoading || forms.isLoading;\n const failed = teams.isError || fixtures.isError || sessions.isError || forms.isError;\n\n const squadRows = useMemo<SquadRow[]>(() => {\n const fixtureItems = fixtures.data?.items ?? [];\n return (teams.data?.items ?? []).map((team) => ({\n team,\n rosterSize: team.members?.items?.length ?? 0,\n ...squadRecord(team.id, fixtureItems),\n }));\n }, [teams.data, fixtures.data]);\n\n const kpis = useMemo(() => {\n const fixtureItems = fixtures.data?.items ?? [];\n const completed = fixtureItems.filter(\n (fixture) =>\n fixture.status === 'COMPLETED' && fixture.homeScore != null && fixture.awayScore != null\n );\n // A fixture counts as a \"win\" for the club when either side won —\n // this is a workspace-wide KPI, not a single-squad record.\n const wins = completed.filter((fixture) => fixture.homeScore !== fixture.awayScore);\n const athletes = squadRows.reduce((sum, row) => sum + row.rosterSize, 0);\n const upcomingSessions = (sessions.data?.items ?? []).filter(\n (session) => session.status === 'REQUESTED' || session.status === 'CONFIRMED'\n ).length;\n const publishedForms = (forms.data?.items ?? []).filter((form) => form.status === 'PUBLISHED');\n return {\n squads: squadRows.length,\n athletes,\n played: completed.length,\n winRate: completed.length > 0 ? Math.round((wins.length / completed.length) * 100) : null,\n upcomingSessions,\n liveRegistrations: publishedForms.reduce((sum, form) => sum + form.submissionCount, 0),\n };\n }, [fixtures.data, sessions.data, forms.data, squadRows]);\n\n if (loading) {\n return (\n <PageLayout title={tr('atheletebridge.pages.controlRoom.title', 'Control room')}>\n <LoadingState\n label={tr('atheletebridge.pages.controlRoom.loading', 'Loading club overview…')}\n />\n </PageLayout>\n );\n }\n\n if (failed) {\n return (\n <PageLayout title={tr('atheletebridge.pages.controlRoom.title', 'Control room')}>\n <ErrorState\n onRetry={() => {\n void teams.refetch();\n void fixtures.refetch();\n void sessions.refetch();\n void forms.refetch();\n }}\n />\n </PageLayout>\n );\n }\n\n return (\n <PageLayout\n title={tr('atheletebridge.pages.controlRoom.title', 'Control room')}\n description={tr(\n 'atheletebridge.pages.controlRoom.description',\n 'Every squad in your club at a glance — rosters, results, what is coming up and who has registered.'\n )}\n hero\n gradientTitle\n >\n <div className=\"mb-8 grid grid-cols-2 gap-4 lg:grid-cols-3\">\n <MetricsCard\n icon={<ShieldCheck className=\"h-4 w-4\" />}\n label={tr('atheletebridge.pages.controlRoom.kpiSquads', 'Squads')}\n value={kpis.squads}\n />\n <MetricsCard\n icon={<Users className=\"h-4 w-4\" />}\n label={tr('atheletebridge.pages.controlRoom.kpiAthletes', 'Athletes on rosters')}\n value={kpis.athletes}\n />\n <MetricsCard\n icon={<Trophy className=\"h-4 w-4\" />}\n label={tr('atheletebridge.pages.controlRoom.kpiPlayed', 'Fixtures played')}\n value={kpis.played}\n />\n <MetricsCard\n icon={<TrendingUp className=\"h-4 w-4\" />}\n label={tr('atheletebridge.pages.controlRoom.kpiWinRate', 'Win rate')}\n value={kpis.winRate == null ? '—' : `${kpis.winRate}%`}\n />\n <MetricsCard\n icon={<CalendarDays className=\"h-4 w-4\" />}\n label={tr('atheletebridge.pages.controlRoom.kpiSessions', 'Upcoming sessions')}\n value={kpis.upcomingSessions}\n />\n <MetricsCard\n icon={<ClipboardList className=\"h-4 w-4\" />}\n label={tr('atheletebridge.pages.controlRoom.kpiRegistrations', 'Live registrations')}\n value={kpis.liveRegistrations}\n />\n </div>\n\n <h2 className=\"mb-3 text-base font-semibold text-text-primary\">\n {tr('atheletebridge.pages.controlRoom.squads', 'Squads')}\n </h2>\n {squadRows.length === 0 ? (\n <EmptyState\n illustration=\"empty-data\"\n icon={<ShieldCheck className=\"h-10 w-10\" />}\n title={tr('atheletebridge.pages.controlRoom.empty', 'No squads yet')}\n description={tr(\n 'atheletebridge.pages.controlRoom.emptyHint',\n 'Create your first team to start tracking squads here.'\n )}\n action={\n <button\n type=\"button\"\n onClick={() => navigateTo('/teams/new')}\n className=\"inline-flex items-center gap-1.5 rounded-lg bg-action-primary-bg px-4 py-2 text-sm font-medium text-action-primary-text transition-colors hover:bg-action-primary-bg/90\"\n >\n <Users className=\"h-4 w-4\" />{' '}\n {tr('atheletebridge.pages.controlRoom.createTeam', 'Create a team')}\n </button>\n }\n />\n ) : (\n <div className=\"overflow-x-auto rounded-lg border border-border-seam\">\n <table className=\"w-full text-sm\" data-testid=\"control-room-squads\">\n <thead className=\"bg-bg-sunken text-left text-xs uppercase tracking-wide text-text-secondary\">\n <tr>\n <th className=\"px-4 py-2 font-medium\">\n {tr('atheletebridge.pages.controlRoom.colSquad', 'Squad')}\n </th>\n <th className=\"px-4 py-2 text-right font-medium\">\n {tr('atheletebridge.pages.controlRoom.colRoster', 'Roster')}\n </th>\n <th className=\"px-4 py-2 text-right font-medium\">\n {tr('atheletebridge.pages.controlRoom.colRecord', 'W · D · L')}\n </th>\n <th className=\"px-4 py-2 text-right font-medium\">\n {tr('atheletebridge.pages.controlRoom.colUpcoming', 'Upcoming')}\n </th>\n <th className=\"px-4 py-2 text-right font-medium\">\n {tr('atheletebridge.pages.controlRoom.colPoints', 'Points')}\n </th>\n </tr>\n </thead>\n <tbody className=\"divide-y divide-border-seam bg-bg-surface\">\n {squadRows.map((row) => (\n <tr\n key={row.team.id}\n tabIndex={0}\n role=\"link\"\n onClick={() => navigateTo(`/teams/${row.team.id}`)}\n onKeyDown={(e) => {\n if (e.key === 'Enter') navigateTo(`/teams/${row.team.id}`);\n }}\n className=\"cursor-pointer text-text-primary transition-colors hover:bg-bg-sunken focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[var(--color-focus-ring)]\"\n >\n <td className=\"px-4 py-2\">\n <span className=\"block font-medium\">{row.team.name}</span>\n <span className=\"block text-xs text-text-secondary\">\n {[SPORT_LABELS[row.team.sport], row.team.ageGroup, row.team.season]\n .filter(Boolean)\n .join(' · ')}\n </span>\n </td>\n <td className=\"px-4 py-2 text-right tabular-nums\">{row.rosterSize}</td>\n <td className=\"px-4 py-2 text-right tabular-nums\">\n {row.played === 0 ? '—' : `${row.won} · ${row.drawn} · ${row.lost}`}\n </td>\n <td className=\"px-4 py-2 text-right tabular-nums\">{row.upcoming}</td>\n <td className=\"px-4 py-2 text-right tabular-nums\">\n {row.played === 0 ? '—' : row.won * 3 + row.drawn}\n </td>\n </tr>\n ))}\n </tbody>\n </table>\n </div>\n )}\n </PageLayout>\n );\n}\n"],"mappings":";;;;;;;;;;;;;AAwBA,IAAMA,IAAY;AAalB,SAASC,EAAY,GAAgB,GAAwB;CAC3D,IAAIC,IAAS,GACTC,IAAM,GACNC,IAAQ,GACRC,IAAO,GACPC,IAAW;CACf,KAAK,IAAMC,KAAWC,GAAU;EAC9B,IAAMC,IAASF,EAAQ,eAAeG,GAChCC,IAASJ,EAAQ,eAAeG;EACtC,IAAKD,KAAWE,GAChB;OAAIJ,EAAQ,WAAW,aAAa;IAClC,IAAIA,EAAQ,aAAa,QAAQA,EAAQ,aAAa,MAAM;IAC5D,KAAU;IACV,IAAMK,IAAOH,IAASF,EAAQ,YAAYA,EAAQ,WAC5CM,IAASJ,IAASF,EAAQ,YAAYA,EAAQ;IACpD,AAAIK,IAAOC,IAAQ,KAAO,IACjBD,MAASC,IAAQ,KA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AAI,WAAW,IAAI,MAAMA,EAAI,MAAM,IAAIA,EAAI;QAC1C,CAAA;OACF;MAzBG,GAAAA,EAAI,KAAK,EAyBZ,CACL;KACI,CAAA,CACF;;GACJ,CAAA;EAEG;;AAEhB"}
|
|
@@ -1,27 +1,29 @@
|
|
|
1
1
|
import { PageLayout as e } from "../../components/PageLayout.js";
|
|
2
2
|
import { Scoreboard as t } from "../../components/Scoreboard.js";
|
|
3
|
+
import { StatusBadge as ee } from "../../components/StatusBadge.js";
|
|
3
4
|
import { Crest as n } from "../../components/Crest.js";
|
|
4
|
-
import { ErrorState as
|
|
5
|
+
import { ErrorState as te, LoadingState as ne } from "../../components/LoadingState.js";
|
|
5
6
|
import { FormField as r, fieldInputClass as i } from "../../components/form.js";
|
|
6
|
-
import { FIXTURE_TYPE_LABELS as
|
|
7
|
-
import { AvailabilityRsvpControl as
|
|
8
|
-
import { AvailabilityRosterPanel as
|
|
9
|
-
import { useScheduledTimeGate as
|
|
10
|
-
import { useAthleteBridge as
|
|
7
|
+
import { FIXTURE_TYPE_LABELS as re } from "../../components/domain.js";
|
|
8
|
+
import { AvailabilityRsvpControl as ie } from "../../components/availability/AvailabilityRsvpControl.js";
|
|
9
|
+
import { AvailabilityRosterPanel as ae } from "../../components/availability/AvailabilityRosterPanel.js";
|
|
10
|
+
import { useScheduledTimeGate as oe } from "../../hooks/useScheduledTimeGate.js";
|
|
11
|
+
import { useAthleteBridge as se } from "../../context/AthleteBridgeContext.js";
|
|
11
12
|
import "../../hooks/index.js";
|
|
12
|
-
import { useCancelFixture as
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
15
|
-
import {
|
|
13
|
+
import { useCancelFixture as ce, useFixture as le, usePostponeFixture as ue, useRecordFixtureResult as de, useUpdateFixture as fe } from "../../hooks/useAthleteBridgeApi.js";
|
|
14
|
+
import { useRegistrationForms as pe } from "../../hooks/useRegistrationApi.js";
|
|
15
|
+
import { buildScheduleInput as me, getFixtureLifecycleActions as he, initialScheduleInputs as ge } from "../../utils/fixtureLifecycle.js";
|
|
16
|
+
import { buildRecordResultInput as _e, parseScoreInput as a } from "../../utils/recordResult.js";
|
|
17
|
+
import { useAbTranslate as ve } from "../../i18n.js";
|
|
16
18
|
import { useState as o } from "react";
|
|
17
|
-
import { ArrowLeft as
|
|
18
|
-
import { useParams as
|
|
19
|
-
import { Fragment as
|
|
19
|
+
import { ArrowLeft as ye, Ban as be, CalendarClock as s, CalendarPlus as xe, ClipboardList as Se, Flag as Ce, Loader2 as c, Minus as we, Plus as Te, Trophy as l } from "lucide-react";
|
|
20
|
+
import { useParams as Ee } from "react-router";
|
|
21
|
+
import { Fragment as De, jsx as u, jsxs as d } from "react/jsx-runtime";
|
|
20
22
|
import { EmphasisPanel as f, GlassCard as p, ResponsiveDialog as m, ResponsiveDialogContent as h, ResponsiveDialogFooter as g, ResponsiveDialogHeader as _, ResponsiveDialogTitle as v } from "@burdenoff/fe-libs/ui";
|
|
21
|
-
import { useGlobalUi as
|
|
23
|
+
import { useGlobalUi as Oe } from "@burdenoff/fe-libs/shared/providers/shell/GlobalUiProvider";
|
|
22
24
|
// src/atheletebridge/pages/fixtures/FixtureDetailPage.tsx
|
|
23
25
|
function y() {
|
|
24
|
-
let y =
|
|
26
|
+
let y = ve(), { id: b } = Ee(), { navigateTo: x } = se(), S = le(b), C = pe({ fixtureId: b }), w = de(), T = fe(), E = ue(), D = ce(), { showToast: O } = Oe(), [k, A] = o(""), [j, M] = o(""), [N, ke] = o(""), [P, Ae] = o(""), [je, Me] = o(""), [Ne, Pe] = o(""), [Fe, Ie] = o({
|
|
25
27
|
homeRuns: "",
|
|
26
28
|
homeWickets: "",
|
|
27
29
|
homeOvers: "",
|
|
@@ -35,55 +37,55 @@ function y() {
|
|
|
35
37
|
margin: "",
|
|
36
38
|
superOver: !1,
|
|
37
39
|
dls: !1
|
|
38
|
-
}), [F, I] = o(null), L =
|
|
40
|
+
}), [F, I] = o(null), L = oe(S.data?.scheduledAt), [R, z] = o(null), [B, V] = o(""), [H, U] = o(""), [Le, W] = o(!1);
|
|
39
41
|
if (S.isLoading) return /* @__PURE__ */ u(e, {
|
|
40
42
|
title: y("atheletebridge.pages.fixtureDetail.title", "Fixture"),
|
|
41
|
-
children: /* @__PURE__ */ u(
|
|
43
|
+
children: /* @__PURE__ */ u(ne, { label: y("atheletebridge.pages.fixtureDetail.loading", "Loading fixture…") })
|
|
42
44
|
});
|
|
43
45
|
if (S.isError || !S.data) return /* @__PURE__ */ u(e, {
|
|
44
46
|
title: y("atheletebridge.pages.fixtureDetail.title", "Fixture"),
|
|
45
|
-
children: /* @__PURE__ */ u(
|
|
47
|
+
children: /* @__PURE__ */ u(te, {
|
|
46
48
|
title: y("atheletebridge.pages.fixtureDetail.notFoundTitle", "Fixture not found"),
|
|
47
49
|
message: y("atheletebridge.pages.fixtureDetail.notFoundMessage", "This fixture does not exist or you do not have access to it."),
|
|
48
50
|
onRetry: () => x("/fixtures")
|
|
49
51
|
})
|
|
50
52
|
});
|
|
51
|
-
let G = S.data, K = G.homeTeam?.name ?? y("atheletebridge.pages.fixtureDetail.home", "Home"), q = G.awayTeam?.name ?? (G.awayTeamId ? y("atheletebridge.pages.fixtureDetail.away", "Away") : "TBD"), J = !!G.awayTeamId && (G.status === "SCHEDULED" || G.status === "LIVE"),
|
|
52
|
-
a(
|
|
53
|
-
let { canReschedule: Y, canPostpone: X, canCancel: Z } =
|
|
54
|
-
let t =
|
|
53
|
+
let G = S.data, K = G.homeTeam?.name ?? y("atheletebridge.pages.fixtureDetail.home", "Home"), q = G.awayTeam?.name ?? (G.awayTeamId ? y("atheletebridge.pages.fixtureDetail.away", "Away") : "TBD"), J = !!G.awayTeamId && (G.status === "SCHEDULED" || G.status === "LIVE"), Re = J && L, ze = J && !L;
|
|
54
|
+
a(k), a(j), a(N), a(P);
|
|
55
|
+
let { canReschedule: Y, canPostpone: X, canCancel: Z } = he(G.status), Q = R === "reschedule" ? T.isPending : E.isPending, $ = (e) => {
|
|
56
|
+
let t = ge(e, G);
|
|
55
57
|
V(t.scheduledAtInput), U(t.kickoffAtInput), z(e);
|
|
56
|
-
},
|
|
58
|
+
}, Be = async (e) => {
|
|
57
59
|
e.preventDefault();
|
|
58
|
-
let t =
|
|
59
|
-
if (!t)
|
|
60
|
+
let t = me(B, H);
|
|
61
|
+
if (!t) O(y("atheletebridge.pages.fixtureDetail.scheduleDateRequired", "Pick a date and time first."), "error");
|
|
60
62
|
else try {
|
|
61
|
-
R === "reschedule" ? (await
|
|
63
|
+
R === "reschedule" ? (await T.mutateAsync({
|
|
62
64
|
id: G.id,
|
|
63
65
|
input: t
|
|
64
|
-
}),
|
|
66
|
+
}), O(y("atheletebridge.pages.fixtureDetail.rescheduledToast", "Fixture rescheduled."), "success")) : (await E.mutateAsync({
|
|
65
67
|
id: G.id,
|
|
66
68
|
input: t
|
|
67
|
-
}),
|
|
69
|
+
}), O(y("atheletebridge.pages.fixtureDetail.postponedToast", "Fixture postponed."), "success")), z(null);
|
|
68
70
|
} catch (e) {
|
|
69
|
-
|
|
71
|
+
O(e instanceof Error ? e.message : y("common.error", "Something went wrong."), "error");
|
|
70
72
|
}
|
|
71
|
-
},
|
|
73
|
+
}, Ve = async () => {
|
|
72
74
|
try {
|
|
73
|
-
await
|
|
75
|
+
await D.mutateAsync(G.id), O(y("atheletebridge.pages.fixtureDetail.cancelledToast", "Fixture cancelled."), "success"), W(!1);
|
|
74
76
|
} catch (e) {
|
|
75
|
-
|
|
77
|
+
O(e instanceof Error ? e.message : y("common.error", "Something went wrong."), "error"), W(!1);
|
|
76
78
|
}
|
|
77
79
|
};
|
|
78
80
|
return /* @__PURE__ */ d(e, {
|
|
79
81
|
title: `${K} vs ${q}`,
|
|
80
|
-
description: `${
|
|
82
|
+
description: `${re[G.type]}${G.competition ? ` · ${G.competition}` : ""}`,
|
|
81
83
|
actions: /* @__PURE__ */ d("button", {
|
|
82
84
|
type: "button",
|
|
83
85
|
onClick: () => x("/fixtures"),
|
|
84
86
|
className: "inline-flex items-center gap-1.5 rounded-lg border border-border-seam px-4 py-2 text-sm font-medium text-text-primary transition-colors hover:bg-bg-sunken",
|
|
85
87
|
children: [
|
|
86
|
-
/* @__PURE__ */ u(
|
|
88
|
+
/* @__PURE__ */ u(ye, { className: "h-4 w-4" }),
|
|
87
89
|
" ",
|
|
88
90
|
y("atheletebridge.pages.fixtureDetail.back", "Back")
|
|
89
91
|
]
|
|
@@ -96,10 +98,10 @@ function y() {
|
|
|
96
98
|
}),
|
|
97
99
|
/* @__PURE__ */ d("div", {
|
|
98
100
|
className: "mb-8 grid grid-cols-1 gap-4 lg:grid-cols-[minmax(0,1fr)_2fr]",
|
|
99
|
-
children: [/* @__PURE__ */ u(
|
|
101
|
+
children: [/* @__PURE__ */ u(ie, {
|
|
100
102
|
teamId: G.homeTeamId,
|
|
101
103
|
fixtureId: G.id
|
|
102
|
-
}), /* @__PURE__ */ u(
|
|
104
|
+
}), /* @__PURE__ */ u(ae, {
|
|
103
105
|
teamId: G.homeTeamId,
|
|
104
106
|
fixtureId: G.id
|
|
105
107
|
})]
|
|
@@ -132,7 +134,7 @@ function y() {
|
|
|
132
134
|
onClick: () => $("reschedule"),
|
|
133
135
|
className: "inline-flex items-center gap-1.5 rounded-lg border border-border-seam px-4 py-2 text-sm font-medium text-text-primary transition-colors hover:bg-bg-sunken",
|
|
134
136
|
children: [
|
|
135
|
-
/* @__PURE__ */ u(
|
|
137
|
+
/* @__PURE__ */ u(xe, { className: "h-4 w-4" }),
|
|
136
138
|
" ",
|
|
137
139
|
y("atheletebridge.pages.fixtureDetail.reschedule", "Reschedule")
|
|
138
140
|
]
|
|
@@ -152,7 +154,7 @@ function y() {
|
|
|
152
154
|
onClick: () => W(!0),
|
|
153
155
|
className: "inline-flex items-center gap-1.5 rounded-lg border border-border-seam px-4 py-2 text-sm font-medium text-status-error-text transition-colors hover:bg-status-error-bg-subtle",
|
|
154
156
|
children: [
|
|
155
|
-
/* @__PURE__ */ u(
|
|
157
|
+
/* @__PURE__ */ u(be, { className: "h-4 w-4" }),
|
|
156
158
|
" ",
|
|
157
159
|
y("atheletebridge.pages.fixtureDetail.cancelFixture", "Cancel fixture")
|
|
158
160
|
]
|
|
@@ -160,19 +162,19 @@ function y() {
|
|
|
160
162
|
]
|
|
161
163
|
})]
|
|
162
164
|
}),
|
|
163
|
-
|
|
165
|
+
ze && /* @__PURE__ */ u(f, {
|
|
164
166
|
className: "mb-8",
|
|
165
167
|
children: /* @__PURE__ */ u("p", {
|
|
166
168
|
className: "text-sm text-text-secondary",
|
|
167
169
|
children: y("atheletebridge.pages.fixtureDetail.recordResultUnavailable", "A result can be recorded once this fixture has started — after its scheduled date and time.")
|
|
168
170
|
})
|
|
169
171
|
}),
|
|
170
|
-
|
|
172
|
+
Re && /* @__PURE__ */ d("section", {
|
|
171
173
|
className: "mb-8",
|
|
172
174
|
children: [/* @__PURE__ */ d("h2", {
|
|
173
175
|
className: "mb-4 flex items-center gap-2 text-lg font-semibold text-text-primary",
|
|
174
176
|
children: [
|
|
175
|
-
/* @__PURE__ */ u(
|
|
177
|
+
/* @__PURE__ */ u(Ce, { className: "h-5 w-5" }),
|
|
176
178
|
" ",
|
|
177
179
|
y("atheletebridge.pages.fixtureDetail.recordResult", "Record result")
|
|
178
180
|
]
|
|
@@ -187,13 +189,13 @@ function y() {
|
|
|
187
189
|
/* @__PURE__ */ d("form", {
|
|
188
190
|
onSubmit: async (e) => {
|
|
189
191
|
if (e.preventDefault(), I(null), !b) return;
|
|
190
|
-
let t =
|
|
191
|
-
homeScore:
|
|
192
|
-
awayScore:
|
|
193
|
-
extraTimeHome:
|
|
194
|
-
extraTimeAway:
|
|
195
|
-
penaltyHome:
|
|
196
|
-
penaltyAway:
|
|
192
|
+
let t = _e({
|
|
193
|
+
homeScore: k,
|
|
194
|
+
awayScore: j,
|
|
195
|
+
extraTimeHome: N,
|
|
196
|
+
extraTimeAway: P,
|
|
197
|
+
penaltyHome: je,
|
|
198
|
+
penaltyAway: Ne
|
|
197
199
|
}, {
|
|
198
200
|
scoresRequired: y("atheletebridge.pages.fixtureDetail.scoresRequired", "Both scores are required and must be numbers."),
|
|
199
201
|
scoresNegative: y("atheletebridge.pages.fixtureDetail.scoresNegative", "Scores cannot be negative."),
|
|
@@ -209,15 +211,15 @@ function y() {
|
|
|
209
211
|
});
|
|
210
212
|
if (!t.ok) I(t.error);
|
|
211
213
|
else try {
|
|
212
|
-
await
|
|
214
|
+
await w.mutateAsync({
|
|
213
215
|
id: b,
|
|
214
216
|
input: t.input
|
|
215
|
-
}),
|
|
217
|
+
}), A(""), M(""), ke(""), Ae(""), Me(""), Pe("");
|
|
216
218
|
} catch (e) {
|
|
217
219
|
I(e instanceof Error ? e.message : y("atheletebridge.pages.fixtureDetail.recordFailed", "Failed to record result."));
|
|
218
220
|
}
|
|
219
221
|
},
|
|
220
|
-
children: [/* @__PURE__ */ d(
|
|
222
|
+
children: [/* @__PURE__ */ d(De, { children: [/* @__PURE__ */ d("div", {
|
|
221
223
|
className: "flex flex-wrap items-end justify-center gap-4 sm:gap-6",
|
|
222
224
|
children: [
|
|
223
225
|
/* @__PURE__ */ d("div", {
|
|
@@ -240,13 +242,13 @@ function y() {
|
|
|
240
242
|
id: "homeScore",
|
|
241
243
|
inputMode: "numeric",
|
|
242
244
|
className: `${i} text-center text-lg font-bold tabular-nums`,
|
|
243
|
-
value:
|
|
244
|
-
onChange: (e) =>
|
|
245
|
+
value: k,
|
|
246
|
+
onChange: (e) => A(e.target.value),
|
|
245
247
|
placeholder: "0"
|
|
246
248
|
})
|
|
247
249
|
})]
|
|
248
250
|
}),
|
|
249
|
-
/* @__PURE__ */ u(
|
|
251
|
+
/* @__PURE__ */ u(we, {
|
|
250
252
|
className: "mb-3 h-5 w-5 shrink-0 text-text-muted",
|
|
251
253
|
"aria-hidden": "true"
|
|
252
254
|
}),
|
|
@@ -260,8 +262,8 @@ function y() {
|
|
|
260
262
|
id: "awayScore",
|
|
261
263
|
inputMode: "numeric",
|
|
262
264
|
className: `${i} text-center text-lg font-bold tabular-nums`,
|
|
263
|
-
value:
|
|
264
|
-
onChange: (e) =>
|
|
265
|
+
value: j,
|
|
266
|
+
onChange: (e) => M(e.target.value),
|
|
265
267
|
placeholder: "0"
|
|
266
268
|
})
|
|
267
269
|
}), /* @__PURE__ */ d("div", {
|
|
@@ -281,9 +283,9 @@ function y() {
|
|
|
281
283
|
className: "mt-6 flex justify-center",
|
|
282
284
|
children: /* @__PURE__ */ d("button", {
|
|
283
285
|
type: "submit",
|
|
284
|
-
disabled:
|
|
286
|
+
disabled: w.isPending,
|
|
285
287
|
className: "inline-flex items-center gap-1.5 rounded-lg bg-action-primary-bg px-6 py-2.5 text-sm font-medium text-action-primary-text transition-colors hover:bg-action-primary-bg/90 disabled:opacity-60",
|
|
286
|
-
children: [
|
|
288
|
+
children: [w.isPending ? /* @__PURE__ */ u(c, { className: "h-4 w-4 animate-spin" }) : /* @__PURE__ */ u(l, { className: "h-4 w-4" }), y("atheletebridge.pages.fixtureDetail.recordResultAction", "Record result")]
|
|
287
289
|
})
|
|
288
290
|
})]
|
|
289
291
|
}),
|
|
@@ -294,6 +296,65 @@ function y() {
|
|
|
294
296
|
]
|
|
295
297
|
})]
|
|
296
298
|
}),
|
|
299
|
+
/* @__PURE__ */ d("section", {
|
|
300
|
+
className: "mb-8",
|
|
301
|
+
children: [/* @__PURE__ */ d("h2", {
|
|
302
|
+
className: "mb-4 flex items-center gap-2 text-lg font-semibold text-text-primary",
|
|
303
|
+
children: [
|
|
304
|
+
/* @__PURE__ */ u(Se, { className: "h-5 w-5" }),
|
|
305
|
+
" ",
|
|
306
|
+
y("atheletebridge.pages.fixtureDetail.signUps", "Tournament sign-ups")
|
|
307
|
+
]
|
|
308
|
+
}), C.isLoading ? /* @__PURE__ */ u("p", {
|
|
309
|
+
className: "text-sm text-text-secondary",
|
|
310
|
+
children: y("atheletebridge.pages.fixtureDetail.signUpsLoading", "Loading sign-up forms…")
|
|
311
|
+
}) : C.isError ? /* @__PURE__ */ u("p", {
|
|
312
|
+
className: "text-sm text-status-error-text",
|
|
313
|
+
children: y("atheletebridge.pages.fixtureDetail.signUpsError", "Sign-up forms could not be loaded.")
|
|
314
|
+
}) : (C.data?.items ?? []).length === 0 ? /* @__PURE__ */ d("div", {
|
|
315
|
+
className: "flex flex-wrap items-center justify-between gap-3 rounded-lg border border-dashed border-border-seam bg-bg-surface px-4 py-3",
|
|
316
|
+
children: [/* @__PURE__ */ u("p", {
|
|
317
|
+
className: "text-sm text-text-secondary",
|
|
318
|
+
children: y("atheletebridge.pages.fixtureDetail.signUpsEmpty", "No sign-up form for this fixture yet. Publish one and families register through its share link.")
|
|
319
|
+
}), /* @__PURE__ */ d("button", {
|
|
320
|
+
type: "button",
|
|
321
|
+
onClick: () => x("/registrations/new"),
|
|
322
|
+
className: "inline-flex items-center gap-1.5 rounded-lg border border-border-seam px-3 py-2 text-sm font-medium text-text-primary transition-colors hover:bg-bg-sunken",
|
|
323
|
+
children: [
|
|
324
|
+
/* @__PURE__ */ u(Te, { className: "h-4 w-4" }),
|
|
325
|
+
" ",
|
|
326
|
+
y("atheletebridge.pages.fixtureDetail.createSignUp", "Create sign-up form")
|
|
327
|
+
]
|
|
328
|
+
})]
|
|
329
|
+
}) : /* @__PURE__ */ u("ul", {
|
|
330
|
+
className: "divide-y divide-border-seam overflow-hidden rounded-lg border border-border-seam bg-bg-surface",
|
|
331
|
+
children: (C.data?.items ?? []).map((e) => /* @__PURE__ */ u("li", { children: /* @__PURE__ */ d("button", {
|
|
332
|
+
type: "button",
|
|
333
|
+
onClick: () => x(`/registrations/${e.id}`),
|
|
334
|
+
className: "flex w-full flex-wrap items-center justify-between gap-3 px-4 py-3 text-left transition-colors hover:bg-bg-sunken",
|
|
335
|
+
children: [/* @__PURE__ */ d("span", {
|
|
336
|
+
className: "min-w-0",
|
|
337
|
+
children: [/* @__PURE__ */ u("span", {
|
|
338
|
+
className: "block truncate font-medium text-text-primary",
|
|
339
|
+
children: e.title
|
|
340
|
+
}), /* @__PURE__ */ u("span", {
|
|
341
|
+
className: "block text-xs text-text-secondary",
|
|
342
|
+
children: e.isOpen ? y("atheletebridge.pages.fixtureDetail.signUpsOpen", "Accepting registrations") : y("atheletebridge.pages.fixtureDetail.signUpsNotOpen", "Not accepting registrations")
|
|
343
|
+
})]
|
|
344
|
+
}), /* @__PURE__ */ d("span", {
|
|
345
|
+
className: "flex items-center gap-3",
|
|
346
|
+
children: [/* @__PURE__ */ d("span", {
|
|
347
|
+
className: "text-sm tabular-nums text-text-secondary",
|
|
348
|
+
children: [
|
|
349
|
+
e.submissionCount,
|
|
350
|
+
" ",
|
|
351
|
+
y("atheletebridge.pages.fixtureDetail.signUpCount", "registered")
|
|
352
|
+
]
|
|
353
|
+
}), /* @__PURE__ */ u(ee, { status: e.status })]
|
|
354
|
+
})]
|
|
355
|
+
}) }, e.id))
|
|
356
|
+
})]
|
|
357
|
+
}),
|
|
297
358
|
G.competition && /* @__PURE__ */ d("button", {
|
|
298
359
|
type: "button",
|
|
299
360
|
onClick: () => x(`/standings?competition=${encodeURIComponent(G.competition ?? "")}`),
|
|
@@ -310,7 +371,7 @@ function y() {
|
|
|
310
371
|
!e && !Q && z(null);
|
|
311
372
|
},
|
|
312
373
|
children: /* @__PURE__ */ d(h, { children: [/* @__PURE__ */ u(_, { children: /* @__PURE__ */ u(v, { children: R === "reschedule" ? y("atheletebridge.pages.fixtureDetail.rescheduleTitle", "Reschedule fixture") : y("atheletebridge.pages.fixtureDetail.postponeTitle", "Postpone fixture") }) }), /* @__PURE__ */ d("form", {
|
|
313
|
-
onSubmit: (e) => void
|
|
374
|
+
onSubmit: (e) => void Be(e),
|
|
314
375
|
className: "space-y-4 px-1",
|
|
315
376
|
children: [
|
|
316
377
|
/* @__PURE__ */ u("p", {
|
|
@@ -357,9 +418,9 @@ function y() {
|
|
|
357
418
|
})] })
|
|
358
419
|
}),
|
|
359
420
|
/* @__PURE__ */ u(m, {
|
|
360
|
-
open:
|
|
421
|
+
open: Le,
|
|
361
422
|
onOpenChange: (e) => {
|
|
362
|
-
!e && !
|
|
423
|
+
!e && !D.isPending && W(!1);
|
|
363
424
|
},
|
|
364
425
|
children: /* @__PURE__ */ d(h, { children: [
|
|
365
426
|
/* @__PURE__ */ u(_, { children: /* @__PURE__ */ u(v, { children: y("atheletebridge.pages.fixtureDetail.cancelTitle", "Cancel fixture?") }) }),
|
|
@@ -370,15 +431,15 @@ function y() {
|
|
|
370
431
|
/* @__PURE__ */ d(g, { children: [/* @__PURE__ */ u("button", {
|
|
371
432
|
type: "button",
|
|
372
433
|
onClick: () => W(!1),
|
|
373
|
-
disabled:
|
|
434
|
+
disabled: D.isPending,
|
|
374
435
|
className: "rounded-lg border border-border-seam px-4 py-2 text-sm font-medium text-text-primary transition-colors hover:bg-bg-sunken disabled:opacity-60",
|
|
375
436
|
children: y("common.keepFixture", "Keep fixture")
|
|
376
437
|
}), /* @__PURE__ */ d("button", {
|
|
377
438
|
type: "button",
|
|
378
|
-
onClick: () => void
|
|
379
|
-
disabled:
|
|
439
|
+
onClick: () => void Ve(),
|
|
440
|
+
disabled: D.isPending,
|
|
380
441
|
className: "inline-flex items-center gap-1.5 rounded-lg bg-action-danger-bg px-4 py-2 text-sm font-semibold text-action-danger-text transition-colors hover:bg-action-danger-bgHover disabled:opacity-60",
|
|
381
|
-
children: [
|
|
442
|
+
children: [D.isPending && /* @__PURE__ */ u(c, { className: "h-4 w-4 animate-spin" }), y("atheletebridge.pages.fixtureDetail.cancelConfirm", "Cancel fixture")]
|
|
382
443
|
})] })
|
|
383
444
|
] })
|
|
384
445
|
})
|