Style !
This commit is contained in:
+28
-18
@@ -1,5 +1,8 @@
|
||||
import { useComputed, useSignal } from "@preact/signals";
|
||||
|
||||
import Button from "@/components/Button.tsx";
|
||||
import InputField from "@/components/InputField.tsx";
|
||||
import TextAreaField from "@/components/TextAreaField.tsx";
|
||||
import { post_json } from "@/src/client.ts";
|
||||
import { save_master_key } from "@/src/key_store.ts";
|
||||
import {
|
||||
@@ -102,56 +105,63 @@ export default function KeysCreate(props: KeysCreateProps) {
|
||||
|
||||
if (step.value === "create") {
|
||||
return (
|
||||
<div>
|
||||
<p>Your files are encrypted in this browser with a key the server never sees.</p>
|
||||
<button type="button" onClick={create}>Create encryption key</button>
|
||||
<div class="mx-auto flex max-w-md flex-col items-center py-8">
|
||||
<p class="mb-6 text-center leading-normal text-gray-800 dark:text-gray-400">
|
||||
Your files are encrypted in this browser with a key the server never sees.
|
||||
</p>
|
||||
<Button variant="primary" onClick={create}>Create encryption key</Button>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
return (
|
||||
<form onSubmit={finish}>
|
||||
<fieldset disabled={step.value === "saving"}>
|
||||
<p>Back up your key. If you lose it, your files can't be recovered, not even by the server.</p>
|
||||
<form class="mx-auto max-w-md py-8" onSubmit={finish}>
|
||||
<fieldset class="flex flex-col gap-4" disabled={step.value === "saving"}>
|
||||
<p class="leading-normal text-gray-800 dark:text-gray-400">
|
||||
Back up your key. If you lose it, your files can't be recovered, not even by the server.
|
||||
</p>
|
||||
|
||||
<h2>Key file</h2>
|
||||
<textarea readOnly value={key_text.value} />
|
||||
<button type="button" onClick={download_key_file}>Download key file</button>
|
||||
<label>
|
||||
<h2 class="mt-4 text-lg font-bold">Key file</h2>
|
||||
<TextAreaField class="h-24 font-mono text-sm break-all" readOnly value={key_text.value} />
|
||||
<Button variant="link" class="self-start" onClick={download_key_file}>Download key file</Button>
|
||||
<label class="flex cursor-pointer items-center gap-2 leading-normal">
|
||||
<input
|
||||
type="checkbox"
|
||||
class="size-5 accent-primary-500"
|
||||
checked={saved_file.value}
|
||||
onChange={(event) => saved_file.value = event.currentTarget.checked}
|
||||
/>
|
||||
I saved my key file somewhere safe
|
||||
</label>
|
||||
|
||||
<h2>Passphrase (optional)</h2>
|
||||
<p>
|
||||
<h2 class="mt-4 text-lg font-bold">Passphrase (optional)</h2>
|
||||
<p class="text-sm leading-normal text-gray-700 dark:text-gray-400">
|
||||
Stores a copy of your key on the server, locked with this passphrase, so you can unlock other
|
||||
devices with it. The key file is the stronger backup.
|
||||
</p>
|
||||
<input
|
||||
<InputField
|
||||
type="password"
|
||||
autoComplete="new-password"
|
||||
placeholder="Passphrase"
|
||||
value={passphrase.value}
|
||||
onInput={(event) => passphrase.value = event.currentTarget.value}
|
||||
/>
|
||||
<input
|
||||
<InputField
|
||||
type="password"
|
||||
autoComplete="new-password"
|
||||
placeholder="Confirm passphrase"
|
||||
value={passphrase_confirm.value}
|
||||
onInput={(event) => passphrase_confirm.value = event.currentTarget.value}
|
||||
/>
|
||||
{passphrase_error.value && <p role="alert">{passphrase_error.value}</p>}
|
||||
{passphrase_error.value && (
|
||||
<p role="alert" class="text-error-600 dark:text-error-400">{passphrase_error.value}</p>
|
||||
)}
|
||||
|
||||
<button type="submit" disabled={!can_continue.value}>
|
||||
<Button type="submit" variant="primary" class="mt-4" disabled={!can_continue.value}>
|
||||
{step.value === "saving" ? "Saving..." : "Continue"}
|
||||
</button>
|
||||
</Button>
|
||||
</fieldset>
|
||||
{error.value && <p role="alert">{error.value}</p>}
|
||||
{error.value && <p role="alert" class="mt-4 text-error-600 dark:text-error-400">{error.value}</p>}
|
||||
</form>
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user