import { Spinner } from 'phosphor-react'; import { useState } from 'react'; import { useLibraryMutation, useLibraryQuery } from '@sd/client'; import { Button, PasswordInput } from '@sd/ui'; import { showAlertDialog } from '~/components'; // TODO: Should be a form export default () => { const keyringSk = useLibraryQuery(['keys.getSecretKey'], { initialData: '' }); const isUnlocked = useLibraryQuery(['keys.isUnlocked']); const unlockKeyManager = useLibraryMutation('keys.unlockKeyManager', { onError: () => showAlertDialog({ title: 'Unlock Error', value: 'The information provided to the key manager was incorrect' }) }); const isKeyManagerUnlocking = useLibraryQuery(['keys.isKeyManagerUnlocking']); const [masterPassword, setMasterPassword] = useState(''); const isUnlocking = unlockKeyManager.isLoading || isKeyManagerUnlocking.data == null; return (