From c2d8be3f091969833111ea6cd788f6f7b8f18d94 Mon Sep 17 00:00:00 2001 From: Kitteh Date: Sun, 23 May 2021 13:05:06 +0100 Subject: [PATCH] Add tsx syntax to UserPassUsersList. --- .../Access/Auth/userpass/UserPassUsersList.ts | 54 ------------------- .../Auth/userpass/UserPassUsersList.tsx | 51 ++++++++++++++++++ 2 files changed, 51 insertions(+), 54 deletions(-) delete mode 100644 src/pages/Access/Auth/userpass/UserPassUsersList.ts create mode 100644 src/pages/Access/Auth/userpass/UserPassUsersList.tsx diff --git a/src/pages/Access/Auth/userpass/UserPassUsersList.ts b/src/pages/Access/Auth/userpass/UserPassUsersList.ts deleted file mode 100644 index bbef5c1..0000000 --- a/src/pages/Access/Auth/userpass/UserPassUsersList.ts +++ /dev/null @@ -1,54 +0,0 @@ -import { Page } from "../../../../types/Page"; -import { listUserPassUsers } from "../../../../api/auth/userpass/listUserPassUsers"; -import { makeElement } from "z-makeelement"; -import i18next from "i18next"; - -export class UserPassUsersListPage extends Page { - constructor() { - super(); - } - async goBack(): Promise { - await this.router.changePage("AUTH_HOME"); - } - - async render(): Promise { - const pageContent = makeElement({ tag: "div" }); - await this.router.setPageContent(pageContent); - pageContent.appendChild( - makeElement({ - tag: "button", - class: ["uk-button", "uk-margin", "uk-button-primary"], - onclick: async () => { - await this.router.changePage("USERPASS_USER_NEW"); - }, - text: i18next.t("userpass_user_list_new_btn"), - }), - ); - - const users = await listUserPassUsers(this.state.authPath); - pageContent.appendChild( - makeElement({ - tag: "ul", - children: [ - ...users.map((user) => { - return makeElement({ - tag: "li", - children: makeElement({ - tag: "a", - text: user, - onclick: async () => { - this.state.userPassUser = user; - await this.router.changePage("USERPASS_USER_VIEW"); - }, - }), - }); - }), - ], - }), - ); - } - - get name(): string { - return i18next.t("userpass_users_list_title"); - } -} diff --git a/src/pages/Access/Auth/userpass/UserPassUsersList.tsx b/src/pages/Access/Auth/userpass/UserPassUsersList.tsx new file mode 100644 index 0000000..41ee58b --- /dev/null +++ b/src/pages/Access/Auth/userpass/UserPassUsersList.tsx @@ -0,0 +1,51 @@ +import { Page } from "../../../../types/Page"; +import { listUserPassUsers } from "../../../../api/auth/userpass/listUserPassUsers"; +import { render } from "preact"; +import i18next from "i18next"; + +export class UserPassUsersListPage extends Page { + constructor() { + super(); + } + async goBack(): Promise { + await this.router.changePage("AUTH_HOME"); + } + + async render(): Promise { + const users = await listUserPassUsers(this.state.authPath); + + render( +
+ + + +
, + this.router.pageContentElement, + ); + } + + get name(): string { + return i18next.t("userpass_users_list_title"); + } +}