chore(web): limit upcoming match cards

This commit is contained in:
dahyeon committed 2026-06-07 06:03:30 -07:00
1 parent 7b636ee793
commit a896342429
1 file changed
+11 -2
+11 -2
View File
@@ -3,6 +3,9 @@ import { mapApiMatchToMatchDetail } from '../api/mappers';
import { useMatches, useMe } from '../api/hooks';
import { DEFAULT_COMMUNITY_ID } from '../config';
const UPCOMING_GRID_MATCH_LIMIT = 3;
const UPCOMING_MATCH_LIST_LIMIT = UPCOMING_GRID_MATCH_LIMIT + 1;
function StatusBadge({ status }: { status: string }) {
const styles: Record<string, string> = {
모집중: 'bg-green-500/15 text-green-500 border-green-500/20',
@@ -44,7 +47,10 @@ function getStatusLabel(status: string) {
}
export default function HomePage() {
const upcomingMatchesQuery = useMatches({ limit: 20 }, DEFAULT_COMMUNITY_ID);
const upcomingMatchesQuery = useMatches(
{ limit: UPCOMING_MATCH_LIST_LIMIT },
DEFAULT_COMMUNITY_ID,
);
const finishedMatchesQuery = useMatches(
{ status: 'finished', limit: 10 },
DEFAULT_COMMUNITY_ID,
@@ -84,7 +90,10 @@ export default function HomePage() {
const finishedMatches =
finishedMatchesQuery.data?.map(mapApiMatchToMatchDetail) ?? [];
const nextMatch = upcomingMatches[0];
const upcomingCards = nextMatch ? upcomingMatches.slice(1) : upcomingMatches;
const upcomingCards = (nextMatch
? upcomingMatches.slice(1)
: upcomingMatches
).slice(0, UPCOMING_GRID_MATCH_LIMIT);
const currentUser =
meQuery.data?.memberships.find(
(membership) => membership.community?._id === DEFAULT_COMMUNITY_ID,