import { ReactNode } from 'react'; import { Card, CardHeader, CardTitle, CardDescription, CardContent } from './ui/card'; import { Button } from './ui/button'; import { Loader2, Copy, Check, AlertCircle } from 'lucide-react'; import { useState } from 'react'; interface UtilityCardProps { title: string; description: string; icon: ReactNode; action?: { label: string; onClick: () => void; disabled?: boolean; loading?: boolean; }; children?: ReactNode; error?: Error | null; isLoading?: boolean; } export function UtilityCard({ title, description, icon, action, children, error, isLoading, }: UtilityCardProps) { return (
{icon}
{title} {description}
{isLoading ? (
) : error ? (
{error.message}
) : ( children )} {action && ( )}
); } interface CopyableValueProps { value: string; label?: string; multiline?: boolean; } export function CopyableValue({ value, label, multiline = false }: CopyableValueProps) { const [copied, setCopied] = useState(false); const handleCopy = async () => { await navigator.clipboard.writeText(value); setCopied(true); setTimeout(() => setCopied(false), 2000); }; return (
{label &&
{label}
}
{multiline ? (
{value}
) : ( {value} )}
); }