"use client"; import { type ReactNode } from "react"; import { BadgeCheck, Plus } from "lucide-react"; import { EmptyState } from "@/components/ui/empty-state"; import { Button } from "@/components/ui/button"; import { HERO_BODY, IndexHero } from "@/components/ui/map-hero"; import { cn } from "@/lib/utils"; import { Card, CardContent } from "@/components/ui/card"; import { CountBadge } from "@/components/ui/count-badge"; import { ListCardHeader, useIsEmptyList, } from "@/components/ui/list-card-header"; import { LoadMoreTrigger } from "@/components/ui/load-more-trigger"; import { BackdropCardList } from "@/components/ui/backdrop-card"; import { CERTIFICATION_CARD_GRID } from "@/components/certifications/certification-card"; import { CERTIFICATION_CARD_ASPECT_CLASS } from "@/lib/certification"; export interface CertificationsPageFrameProps { isLoading: boolean; totalCount: number; itemsPerPage: number; /** One `CertificationCard` per certification - list items, for its list. */ cards?: ReactNode[]; isLoadingMore?: boolean; loadFailed?: boolean; hasMore?: boolean; onLoadMore?: () => void; /** Opens the new-card dialog. */ onNew?: () => void; } const noop = () => {}; // Everything /certifications draws before its cards exist, kept apart from the data render so // the page's first render is this frame. Every data-varying prop is optional, // and the defaults are that first render. export function CertificationsPageFrame({ isLoading, totalCount, itemsPerPage, cards = [], isLoadingMore = false, loadFailed = false, hasMore = false, onLoadMore = noop, onNew = noop, }: CertificationsPageFrameProps) { // An unstarted wallet. Nothing narrows this list, so an empty one is the // whole story. const isEmptyList = useIsEmptyList({ isLoading, count: cards.length, isNarrowed: false, }); return (
New certification } />
{/* The card is the list's header - its count - and what it says when there is nothing to list. The certifications themselves are cards of their own, so they sit below it rather than in it, as /dives draws its dives. */} {!isLoading && cards.length === 0 && ( Add your first certification } /> )} {(isLoading || cards.length > 0) && ( {cards} )}
); }