'use client'; import { useState, type FormEvent } from 'react'; /** A file's password, asked where the file is shown; `purpose` says what it opens the file for. */ export function UnlockForm({ state, name, purpose, onUnlock, }: { state: { readonly incorrect: boolean; readonly trying: boolean }; name: string; purpose: string; onUnlock: (password: string) => void; }) { const [password, setPassword] = useState(''); const submit = (event: FormEvent) => { event.preventDefault(); if (password) onUnlock(password); }; return (
); }