UNPKG

@e280/authlocal

Version:

User-sovereign login system for everybody

54 lines (51 loc) 1.57 kB
import { html, shadowView } from "@benev/slate"; import stylesCss from "./styles.css.js"; import themeCss from "../../../../../theme.css.js"; import { constants } from "../../../../../../constants.js"; import { Summary } from "../../../../common/summary/view.js"; import { Problems } from "../../../../common/problems/view.js"; export const Upload = shadowView(use => (options) => { use.name("upload"); use.styles([themeCss, stylesCss]); const { intake } = options; async function handleUpload(event) { const input = event.currentTarget; const files = Array.from(input.files ?? []); await intake.ingestFiles(files); } function accept() { options.onSave(intake.identities.value); options.onBack(); } return html ` <section theme-group> <section class=uploader theme-zone> <input type="file" multiple accept="${constants.seedExtension}" @change="${handleUpload}" /> </section> ${intake.problems.value.length > 0 ? Problems([intake.problems.value]) : null} </section> ${intake.identities.value.length > 0 ? Summary([intake.identities.value]) : null} <footer theme-buttons> <button theme-button=back @click="${options.onBack}"> Back </button> ${intake.identities.value.length > 0 ? html ` <button theme-button=happy @click="${accept}"> Import ${intake.identities.value.length === 1 ? "Identity" : "Identities"} </button> ` : null} </footer> `; }); //# sourceMappingURL=view.js.map