"use client"; import * as React from "react"; import { useRouter } from "next/navigation"; import { Archive, Check } from "lucide-react"; import { archiveProject, selectProject } from "@/actions/projects"; import { Button, type ButtonProps } from "@/components/ui/button"; import { Dialog, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogTitle } from "@/components/ui/dialog"; import { Alert } from "@/components/ui/alert"; import { Input } from "@/components/ui/input"; import { Field, Label } from "@/components/ui/label"; /** Makes the project the current one (cookie) and refreshes the dashboard. */ export function SelectProjectButton({ projectId, size = "xs", variant = "outline", children }: { projectId: string } & Pick) { const router = useRouter(); const [pending, startTransition] = React.useTransition(); return ( ); } export function ArchiveProjectButton({ projectId, name, disabled, disabledReason }: { projectId: string; name: string; disabled?: boolean; disabledReason?: string }) { const router = useRouter(); const [open, setOpen] = React.useState(false); const [confirmName, setConfirmName] = React.useState(""); const [error, setError] = React.useState(null); const [pending, startTransition] = React.useTransition(); return ( <>
{disabled && disabledReason ?

{disabledReason}

: null}
{ if (!pending) { setOpen(o); setError(null); setConfirmName(""); } }} > Archive {name}? Archived projects disappear from the dashboard and their API keys stop authenticating. Request history is kept for your plan's retention window. Contact support to restore an archived project. {error ? {error} : null} setConfirmName(e.target.value)} autoComplete="off" autoFocus /> ); }