i18n
CI/CD Pipeline / Build and Push PocketBase Docker Image (push) Successful in 8s
CI/CD Pipeline / i18n Catalog Check (push) Failing after 10s
CI/CD Pipeline / Build and Push App Docker Image (push) Skipped
CI/CD Pipeline / Deploy to Kubernetes (push) Skipped

This commit is contained in:
yohlo
2026-08-08 15:29:40 -07:00
parent 22c282d8fa
commit 0a7b5fa00f
178 changed files with 13099 additions and 1285 deletions
@@ -12,6 +12,7 @@ import { useSheet } from "@/hooks/use-sheet";
import Sheet from "@/components/sheet/sheet";
import { MatchForm } from "./match-form";
import toast from "@/lib/sonner";
import { Trans, useLingui } from "@lingui/react/macro";
const teamId = (t: Match["home"]): string | undefined =>
!t ? undefined : typeof t === "string" ? t : t.id;
@@ -30,6 +31,7 @@ interface MatchReportProps {
export const MatchReport: React.FC<MatchReportProps> = ({ match, compact }) => {
const { user } = useAuth();
const formSheet = useSheet();
const { t } = useLingui();
const [acknowledgedReport, setAcknowledgedReport] = useState<string | null>(
null
);
@@ -73,15 +75,15 @@ export const MatchReport: React.FC<MatchReportProps> = ({ match, compact }) => {
const report = useReportMatchScore(user?.id, {
onSuccess: (data: any) => {
if (data?.finalized) {
toast.success("Score confirmed 🍻");
toast.success(t`Score confirmed 🍻`);
if (data.downstreamReset) {
toast.error(
"Downstream matches were reset because the correction changed who advances."
t`Downstream matches were reset because the correction changed who advances.`
);
}
if (data.groupEditAfterKnockout) {
toast.error(
"Group result changed after the bracket was seeded — reseed the knockout stage if needed."
t`Group result changed after the bracket was seeded — reseed the knockout stage if needed.`
);
}
}
@@ -92,12 +94,12 @@ export const MatchReport: React.FC<MatchReportProps> = ({ match, compact }) => {
onSuccess: (data: any) => {
if (data?.downstreamReset) {
toast.error(
"Downstream matches were reset because the correction changed who advances."
t`Downstream matches were reset because the correction changed who advances.`
);
}
if (data?.groupEditAfterKnockout) {
toast.error(
"Group result changed after the bracket was seeded — reseed the knockout stage if needed."
t`Group result changed after the bracket was seeded — reseed the knockout stage if needed.`
);
}
},
@@ -109,21 +111,21 @@ export const MatchReport: React.FC<MatchReportProps> = ({ match, compact }) => {
(data: { home_cups: number; away_cups: number; ot_count: number }) => {
report.mutate({ data: { ...data, matchId: match.id } });
formSheet.close();
toast.success("Score submitted — waiting for the other team");
toast.success(t`Score submitted — waiting for the other team`);
},
[report, match.id, formSheet.close]
[report, match.id, formSheet.close, t]
);
const submitConfirm = useCallback(() => {
confirm.mutate({ data: { matchId: match.id } });
formSheet.close();
toast.success("Score confirmed 🍻");
}, [confirm, match.id, formSheet.close]);
toast.success(t`Score confirmed 🍻`);
}, [confirm, match.id, formSheet.close, t]);
const submitClear = useCallback(() => {
clear.mutate({ data: { matchId: match.id } });
toast.success("Report cleared");
}, [clear, match.id]);
toast.success(t`Report cleared`);
}, [clear, match.id, t]);
const openForm = useCallback(() => {
setAcknowledgedReport(pendingSignature);
@@ -143,7 +145,7 @@ export const MatchReport: React.FC<MatchReportProps> = ({ match, compact }) => {
const formSheetEl = (
<Sheet
title={sheetTakenOver ? "Confirm Score" : "Report Score"}
title={sheetTakenOver ? t`Confirm Score` : t`Report Score`}
{...formSheet.props}
>
{sheetTakenOver ? (
@@ -152,16 +154,16 @@ export const MatchReport: React.FC<MatchReportProps> = ({ match, compact }) => {
variant="light"
color="yellow"
icon={<LightningIcon size={18} weight="fill" />}
title={`${teamName(reportingTeam) ?? "The other team"} just reported a score`}
title={t`${teamName(reportingTeam) ?? t`The other team`} just reported a score`}
>
Does this look right?
<Trans>Does this look right?</Trans>
</Alert>
<Paper withBorder p="md">
<Group justify="center" gap="md" wrap="nowrap">
<Stack gap={2} align="center" style={{ flex: 1, minWidth: 0 }}>
<Text size="sm" fw={600} ta="center" lineClamp={1}>
{teamName(match.home) ?? "Home"}
{teamName(match.home) ?? t({ message: "Home", context: "match team" })}
</Text>
<Text fz={34} fw={700} lh={1.2}>
{match.reported_home_cups}
@@ -172,7 +174,7 @@ export const MatchReport: React.FC<MatchReportProps> = ({ match, compact }) => {
</Text>
<Stack gap={2} align="center" style={{ flex: 1, minWidth: 0 }}>
<Text size="sm" fw={600} ta="center" lineClamp={1}>
{teamName(match.away) ?? "Away"}
{teamName(match.away) ?? t({ message: "Away", context: "match team" })}
</Text>
<Text fz={34} fw={700} lh={1.2}>
{match.reported_away_cups}
@@ -188,7 +190,7 @@ export const MatchReport: React.FC<MatchReportProps> = ({ match, compact }) => {
onClick={submitConfirm}
loading={confirm.isPending}
>
Confirm {scoreText}
<Trans>Confirm {scoreText}</Trans>
</Button>
<Button
fullWidth
@@ -196,7 +198,7 @@ export const MatchReport: React.FC<MatchReportProps> = ({ match, compact }) => {
onClick={dismissTakeover}
disabled={confirm.isPending}
>
Not right enter our score
<Trans>Not right enter our score</Trans>
</Button>
</Stack>
</Stack>
@@ -220,7 +222,7 @@ export const MatchReport: React.FC<MatchReportProps> = ({ match, compact }) => {
onClick={openForm}
loading={report.isPending}
>
Report Score
<Trans>Report Score</Trans>
</Button>
{formSheetEl}
</>
@@ -237,11 +239,13 @@ export const MatchReport: React.FC<MatchReportProps> = ({ match, compact }) => {
gap={compact ? 4 : "xs"}
>
<Text size="xs" c="dimmed" lineClamp={2} style={{ minWidth: 0 }}>
Waiting for {teamName(opposingTeam) ?? "the other team"} to confirm{" "}
·{" "}
<Text span fw={600} c="bright">
{scoreText}
</Text>
<Trans>
Waiting for {teamName(opposingTeam) ?? t`the other team`} to confirm{" "}
·{" "}
<Text span fw={600} c="bright">
{scoreText}
</Text>
</Trans>
</Text>
<Button
size={size}
@@ -251,7 +255,7 @@ export const MatchReport: React.FC<MatchReportProps> = ({ match, compact }) => {
loading={clear.isPending}
style={{ flexShrink: 0 }}
>
Cancel
<Trans>Cancel</Trans>
</Button>
</Flex>
);
@@ -262,10 +266,12 @@ export const MatchReport: React.FC<MatchReportProps> = ({ match, compact }) => {
<>
<Stack gap={6}>
<Text size="xs" c="dimmed" lineClamp={2}>
{teamName(reportingTeam) ?? "Opponent"} reported{" "}
<Text span fw={600} c="bright">
{scoreText}
</Text>
<Trans>
{teamName(reportingTeam) ?? t`Opponent`} reported{" "}
<Text span fw={600} c="bright">
{scoreText}
</Text>
</Trans>
</Text>
<Group gap="xs" wrap="nowrap">
<Button
@@ -275,7 +281,7 @@ export const MatchReport: React.FC<MatchReportProps> = ({ match, compact }) => {
loading={confirm.isPending}
style={{ flex: 1 }}
>
Confirm
<Trans>Confirm</Trans>
</Button>
<Button
size={size}
@@ -283,7 +289,7 @@ export const MatchReport: React.FC<MatchReportProps> = ({ match, compact }) => {
onClick={openForm}
disabled={confirm.isPending}
>
Not right
<Trans>Not right</Trans>
</Button>
</Group>
</Stack>
@@ -294,7 +300,9 @@ export const MatchReport: React.FC<MatchReportProps> = ({ match, compact }) => {
return (
<Text size="xs" c="dimmed" lineClamp={2}>
Pending: {scoreText} · reported by {teamName(reportingTeam) ?? "a team"}
<Trans>
Pending: {scoreText} · reported by {teamName(reportingTeam) ?? t`a team`}
</Trans>
</Text>
);
}