diff --git a/app/components/ConfigCard.tsx b/app/components/ConfigCard.tsx index a3fb5ba..6b3ff9f 100644 --- a/app/components/ConfigCard.tsx +++ b/app/components/ConfigCard.tsx @@ -10,6 +10,8 @@ import { useRouter } from "next/navigation"; import { colors } from "@/app/lib/colors"; import { SavedConfig, ConfigPublic } from "@/app/lib/types/configs"; import { formatRelativeTime } from "@/app/lib/utils"; +import { CheckIcon, CopyIcon } from "@/app/components/icons"; +import { useToast } from "@/app/hooks/useToast"; interface ConfigCardProps { config: ConfigPublic; @@ -28,12 +30,29 @@ export default function ConfigCard({ onLoadSingleVersion, }: ConfigCardProps) { const router = useRouter(); + const toast = useToast(); const [expanded, setExpanded] = useState(false); const [isLoadingDetails, setIsLoadingDetails] = useState(false); const [latestVersion, setLatestVersion] = useState(null); const [totalVersions, setTotalVersions] = useState(0); const [showTools, setShowTools] = useState(false); const [showVectorStores, setShowVectorStores] = useState(false); + const [copiedId, setCopiedId] = useState(false); + + const handleCopyId = useCallback( + async (e: React.MouseEvent) => { + e.stopPropagation(); + try { + await navigator.clipboard.writeText(config.id); + setCopiedId(true); + toast.success("Config ID copied to clipboard"); + setTimeout(() => setCopiedId(false), 2000); + } catch { + toast.error("Failed to copy"); + } + }, + [config.id, toast], + ); const handleToggleExpand = useCallback(async () => { if (expanded) { @@ -219,6 +238,30 @@ export default function ConfigCard({ ) : latestVersion ? (
+
+ + Config ID: + + + {config.id} + + +
+ {/* Config Details */}