import { noop } from 'lodash' import { Plus } from 'lucide-react' import { Input, SelectContent_Shadcn_, SelectGroup_Shadcn_, SelectItem_Shadcn_, SelectTrigger_Shadcn_, Select_Shadcn_, } from 'ui' import { useProjectContext } from 'components/layouts/ProjectLayout/ProjectContext' import { usePgSodiumKeysQuery } from 'data/pg-sodium-keys/pg-sodium-keys-query' interface EncryptionKeySelectorProps { nameId?: string label?: string labelOptional?: string selectedKeyId?: any error?: string onSelectKey: (keyId: string) => void onUpdateDescription?: (desc: string) => void } const EncryptionKeySelector = ({ nameId = 'keyName', label = 'Encryption key', labelOptional, selectedKeyId, error, onSelectKey = noop, onUpdateDescription = noop, }: EncryptionKeySelectorProps) => { const { project } = useProjectContext() const { data } = usePgSodiumKeysQuery({ projectRef: project?.ref, connectionString: project?.connectionString, }) const keys = data || [] return ( <>
{key.name || 'No name provided'}
ID: {key.id}