import { Archive } from "lucide-react"; import { Button } from "@/src/components/ui/button"; import { Popover, PopoverContent, PopoverTrigger, } from "@/src/components/ui/popover"; import React from "react"; import { usePostHogClientCapture } from "@/src/features/posthog-analytics/usePostHogClientCapture"; import { useHasProjectAccess } from "@/src/features/rbac/utils/checkProjectAccess"; import { api } from "@/src/utils/api"; import { useEmptyScoreConfigs } from "@/src/features/scores/hooks/useEmptyConfigs"; export const ArchiveScoreConfigButton = ({ configId, projectId, isArchived, name, }: { configId: string; projectId: string; isArchived: boolean; name: string; }) => { const capture = usePostHogClientCapture(); const { emptySelectedConfigIds, setEmptySelectedConfigIds } = useEmptyScoreConfigs(); const hasAccess = useHasProjectAccess({ projectId: projectId, scope: "scoreConfigs:CUD", }); const utils = api.useUtils(); const configMutation = api.scoreConfigs.update.useMutation({ onSuccess: () => void utils.scoreConfigs.invalidate(), }); return ( e.stopPropagation()} className="max-w-[500px]" >

{isArchived ? "Restore config" : "Archive config"}

Your config is currently{" "} {isArchived ? `archived. Restore if you want to use "${name}" in annotation again.` : `active. Archive if you no longer want to use "${name}" in annotation. Historic "${name}" scores will still be shown and can be deleted. You can restore your config at any point.`}

); };