"use client"; import { useCallback, useMemo, useState } from "react"; import { IconEdit, IconTrash, IconEye, IconEyeOff, IconKey } from "@tabler/icons-react"; import { Button } from "@kandev/ui/button"; import { Dialog, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogTitle, } from "@kandev/ui/dialog"; import { Input } from "@kandev/ui/input"; import { Textarea } from "@kandev/ui/textarea"; import { SettingsPageTemplate } from "@/components/settings/settings-page-template"; import { useSecrets } from "@/hooks/domains/settings/use-secrets"; import { useAppStore } from "@/components/state-provider"; import { createSecret, updateSecret, deleteSecret, revealSecret, } from "@/lib/api/domains/secrets-api"; import { useRequest } from "@/lib/http/use-request"; import type { SecretListItem } from "@/lib/types/http-secrets"; type SecretFormState = { name: string; value: string; }; const defaultFormState: SecretFormState = { name: "", value: "", }; /* ------------------------------------------------------------------ */ /* Create / Edit form */ /* ------------------------------------------------------------------ */ type SecretFormProps = { title: string; formState: SecretFormState; onFormChange: (patch: Partial) => void; onSubmit: () => void; onCancel: () => void; isValid: boolean; isBusy: boolean; submitLabel: string; }; function SecretForm({ title, formState, onFormChange, onSubmit, onCancel, isValid, isBusy, submitLabel, }: SecretFormProps) { return (
{title}
onFormChange({ name: e.target.value })} placeholder="Name (e.g. OpenAI Production Key)" />