diff --git a/src/pages/Secrets/Transit/TransitRewrap.ts b/src/pages/Secrets/Transit/TransitRewrap.tsx similarity index 51% rename from src/pages/Secrets/Transit/TransitRewrap.ts rename to src/pages/Secrets/Transit/TransitRewrap.tsx index adc093b..dc166f2 100644 --- a/src/pages/Secrets/Transit/TransitRewrap.ts +++ b/src/pages/Secrets/Transit/TransitRewrap.tsx @@ -1,14 +1,14 @@ -import { CopyableModal } from "../../../elements/CopyableModal"; -import { Form } from "../../../elements/Form"; -import { Margin } from "../../../elements/Margin"; -import { Option } from "../../../elements/Option"; +import { CopyableModal } from "../../../elements/ReactCopyableModal"; +import { Form } from "../../../elements/ReactForm"; +import { Margin } from "../../../elements/ReactMargin"; import { Page } from "../../../types/Page"; import { SecretTitleElement } from "../SecretTitleElement"; import { getTransitKey } from "../../../api/transit/getTransitKey"; -import { makeElement } from "z-makeelement"; import { objectToMap } from "../../../utils"; +import { render } from "preact"; import { setErrorText } from "../../../pageUtils"; import { transitRewrap } from "../../../api/transit/transitRewrap"; +import UIkit from "uikit"; import i18next from "i18next"; type versionOption = { version: string; label: string }; @@ -22,8 +22,6 @@ export class TransitRewrapPage extends Page { await this.router.changePage("TRANSIT_VIEW_SECRET"); } - transitRewrapForm: HTMLFormElement; - async render(): Promise { const transitKey = await getTransitKey(this.state.baseMount, this.state.secretItem); @@ -47,54 +45,49 @@ export class TransitRewrapPage extends Page { }; }); - await this.router.setPageContent(""); - this.transitRewrapForm = Form( - [ - makeElement({ - tag: "select", - name: "version", - class: ["uk-select", "uk-width-1-2"], - children: options.map((option): HTMLElement => Option(option.label, option.version)), - }), - Margin( - makeElement({ - tag: "textarea", - class: ["uk-textarea", "uk-width-1-2"], - attributes: { - placeholder: i18next.t("transit_rewrap_input_placeholder"), - name: "ciphertext", - }, - }), - ), - makeElement({ - tag: "p", - id: "errorText", - class: "uk-text-danger", - }), - makeElement({ - tag: "button", - class: ["uk-button", "uk-button-primary"], - text: i18next.t("transit_rewrap_rewrap_btn"), - attributes: { - type: "submit", - }, - }), - ], - async (_) => await this.transitRewrapFormHandler(), + render( +
await this.onSubmit(data)}> + + + + +