import { useQuery } from "@tanstack/react-query"; import { DeckPreview } from "@/components/DeckPreview"; import { ListPreview } from "@/components/ListPreview"; import type { CollectionList } from "@/lib/collection-list-types"; import { isDeckRecord, isListRecord, recentActivityQueryOptions, } from "@/lib/ufos-queries"; interface ActivityFeedProps { limit?: number; } export function ActivityFeed({ limit = 6 }: ActivityFeedProps) { const { data: records, isLoading, error, } = useQuery(recentActivityQueryOptions(limit)); if (isLoading) { return ; } if (error || !records) { return (
Unable to load recent activity
); } if (records.length === 0) { return (
No recent activity yet
); } return (
{records.map((record) => { if (isDeckRecord(record)) { return ( ); } if (isListRecord(record)) { return ( ); } return null; })}
); } function ActivityFeedSkeleton({ count }: { count: number }) { return (
{Array.from({ length: count }).map((_, i) => (
{/* Handle */}
{/* Name */}
{/* Format */}
{/* Date */}
))}
); }