"use client";
import * as React from "react";
import { Copy, Folder, Pencil, Play, Star, Trash2 } from "lucide-react";
import { Badge } from "@/components/ui/badge";
import { Button } from "@/components/ui/button";
import { ProviderIcon } from "@/components/brand/provider-icon";
import { RowMenu } from "@/components/projects/row-menu";
import { useApp } from "@/components/app/store";
import { useIsMobile, useLongPress } from "@/lib/client/hooks";
import { formatRelative, truncate, cn } from "@/lib/utils";
import type { PublicPrompt } from "@/lib/client/types";
import type { ActionSheetItem } from "@/components/ui/sheet";
import { PROMPT_KIND_META } from "./prompt-kind";
export interface PromptCardActions {
onUse: (p: PublicPrompt) => void;
onEdit: (p: PublicPrompt) => void;
onDuplicate?: (p: PublicPrompt) => void;
onToggleFavorite: (p: PublicPrompt) => void;
onDelete: (p: PublicPrompt) => void;
}
/** Prompt card (grid) or compact row (`compact`, used on project pages). Long-press on phones opens the actions. */
export function PromptCard({ prompt: p, actions, compact, className }: { prompt: PublicPrompt; actions: PromptCardActions; compact?: boolean; className?: string }) {
const { modelsByKey } = useApp();
const isMobile = useIsMobile();
const [menu, setMenu] = React.useState(false);
const press = useLongPress({ onLongPress: () => setMenu(true), disabled: !isMobile });
const meta = PROMPT_KIND_META[p.kind];
const model = p.defaultModelKey ? modelsByKey.get(p.defaultModelKey) : null;
const items: (ActionSheetItem | "separator")[] = [
{ key: "use", label: "Use in chat", icon:
{p.description}
: null}