"use client"; import { useQuery } from "@tanstack/react-query"; import { MapsetCard } from "../../mapset-card"; import mapsetApi from "@/shared/services/mapset"; export default function HighlightMapset() { const { data: mapsets, isLoading } = useQuery({ queryKey: ["mapsets-highlight"], queryFn: () => mapsetApi .getMapsets( { limit: 3, filter: JSON.stringify([ "is_active=true", "is_popular=true", "status_validation=approved", ]), }, { skipAuth: true }, ) .then((res) => { return res.items; }), staleTime: 5000, }); if (isLoading) { return (
{[...Array(3)].map((_, index) => (
))}
); } if (!mapsets || mapsets.length === 0) { return <>; } return (
{mapsets.slice(0, 3).map((mapset) => (
))}
); }