"use client"; import { PrototypeCreatePrototypeModal } from "@prototype/components/prototypes/prototype-create-prototype-modal"; import { PrototypeLibraryLoadingModal } from "@prototype/components/shell/prototype-library-loading-modal"; import { PROTOTYPE_GALLERY_GRID_GAP_CLASS } from "@prototype/components/shell/prototype-gallery-shell"; import type { PrototypeMetadata } from "@prototype/lib/prototypes/prototype-config-types"; import { screenshotSrc } from "@prototype/lib/prototypes/screenshot-src"; import { useTrackEvent } from "@prototype/lib/prototypes/telemetry/prototype-telemetry-context"; import { useBootstrapPreview } from "@prototype/lib/prototypes/use-bootstrap-preview"; import { cn } from "@prototype/lib/utils"; import { Plus } from "lucide-react"; import Image from "next/image"; import Link from "next/link"; import { useState } from "react"; type PrototypeGalleryClientProps = { prototypes: PrototypeMetadata[]; screenshotVersions: Record; sourcePath?: string; }; const prototypeGalleryTitleClassName = "mt-2 text-sm text-[var(--tool-chrome-text-muted)] transition-colors duration-300 ease-out group-hover:text-[var(--tool-chrome-text-heading)]"; function PrototypeGalleryAddCard({ onClick }: { onClick: () => void }) { return ( ); } export function PrototypeGalleryClient({ prototypes, screenshotVersions, sourcePath, }: PrototypeGalleryClientProps) { const [createModalOpen, setCreateModalOpen] = useState(false); const [libraryLoadingModalOpen, setLibraryLoadingModalOpen] = useState(false); const track = useTrackEvent(); const { isComponentLibraryLoadingPanelVisible } = useBootstrapPreview(); const isNewPrototypeBlocked = isComponentLibraryLoadingPanelVisible; const handleNewPrototypeClick = () => { track("prototype.new_clicked", { surface: "gallery" }); if (isNewPrototypeBlocked) { setLibraryLoadingModalOpen(true); return; } setCreateModalOpen(true); }; return ( <>
{prototypes.map((prototype) => ( track( "prototype.opened", { title: prototype.title }, { slug: prototype.slug }, ) } >
{prototype.title}

{prototype.title}

))}
); }