import { useSignal, useSignalEffect } from "@preact/signals"; import Button from "@/components/Button.tsx"; import { CopyIcon } from "@/components/Icons.tsx"; import InputField from "@/components/InputField.tsx"; import Form from "@/islands/Form.tsx"; import type { AdminUserEntry, CreatedUser } from "@/src/admin.ts"; import { auth_headers, fetch_json } from "@/src/client.ts"; import { format_bytes } from "@/src/files.ts"; const DATE_FORMAT = new Intl.DateTimeFormat(undefined, { dateStyle: "medium" }); interface CreatedNoticeProps { user: CreatedUser; } function CreatedNotice(props: CreatedNoticeProps) { const copied = useSignal(false); const error = useSignal(""); async function copy() { try { await navigator.clipboard.writeText(props.user.code); copied.value = true; setTimeout(() => copied.value = false, 2000); } catch { error.value = "Couldn't copy the code, select it and copy it by hand"; } } return (
Created {props.user.name}
Send them this code, it's how they log in. It won't be shown again.
{error.value}
}| Name | Files | Storage | Created |
|---|---|---|---|
| {user.name} {user.admin && ( Admin )} {!user.has_key && ( Not set up yet )} | {user.file_count} | {format_bytes(user.storage_used)} | {DATE_FORMAT.format(new Date(user.date_created))} |
{load_error.value}
:Loading...
; } return (