Files
flxn-app/src/features/matches/components/match-list.tsx
T
yohlo 0a7b5fa00f
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
i18n
2026-08-08 15:29:40 -07:00

47 lines
1.1 KiB
TypeScript

import { Stack, Text } from "@mantine/core";
import { useMemo } from "react";
import { Match } from "../types";
import MatchCard from "./match-card";
import { Trans } from "@lingui/react/macro";
interface MatchListProps {
matches: Match[];
hideH2H?: boolean;
}
const MatchList = ({ matches, hideH2H = false }: MatchListProps) => {
const filteredMatches = useMemo(
() =>
[...(matches ?? [])]
.filter(match =>
match.home && match.away && !match.bye && match.status != "tbd"
)
.sort((a, b) => a.start_time < b.start_time ? 1 : -1),
[matches]
);
if (!filteredMatches.length) {
return undefined;
}
const isRegional = filteredMatches[0]?.tournament?.regional;
return (
<Stack p="md" gap="sm">
{isRegional && (
<Text size="xs" c="dimmed" ta="center" px="md">
<Trans>Matches for regionals are unordered</Trans>
</Text>
)}
{filteredMatches.map((match, index) => (
<div
key={`match-${match.id}-${index}`}
>
<MatchCard match={match} hideH2H={hideH2H} />
</div>
))}
</Stack>
);
};
export default MatchList;