From 6e1efd1e195b68a11b0a0e98a7669dde30c0658c Mon Sep 17 00:00:00 2001 From: Sami Mazouz Date: Tue, 19 Jul 2022 19:30:21 +0100 Subject: [PATCH] refactor: convert page components to TypeScript Co-authored-by: David Wheatley Signed-off-by: Sami Mazouz --- .../core/js/src/admin/AdminApplication.ts | 2 + .../js/src/admin/components/AdminPage.tsx | 8 +-- .../src/admin/components/AppearancePage.tsx | 3 +- .../{BasicsPage.js => BasicsPage.tsx} | 34 +++++++------ .../js/src/admin/components/ExtensionPage.tsx | 2 +- .../components/{MailPage.js => MailPage.tsx} | 51 +++++++++++++------ ...PermissionsPage.js => PermissionsPage.tsx} | 4 +- ...ficationsPage.js => NotificationsPage.tsx} | 10 ++-- .../{SettingsPage.js => SettingsPage.tsx} | 40 +++++++-------- 9 files changed, 91 insertions(+), 63 deletions(-) rename framework/core/js/src/admin/components/{BasicsPage.js => BasicsPage.tsx} (84%) rename framework/core/js/src/admin/components/{MailPage.js => MailPage.tsx} (69%) rename framework/core/js/src/admin/components/{PermissionsPage.js => PermissionsPage.tsx} (96%) rename framework/core/js/src/forum/components/{NotificationsPage.js => NotificationsPage.tsx} (54%) rename framework/core/js/src/forum/components/{SettingsPage.js => SettingsPage.tsx} (70%) diff --git a/framework/core/js/src/admin/AdminApplication.ts b/framework/core/js/src/admin/AdminApplication.ts index 301662cdfe..5a712ddb12 100644 --- a/framework/core/js/src/admin/AdminApplication.ts +++ b/framework/core/js/src/admin/AdminApplication.ts @@ -37,6 +37,8 @@ export interface AdminApplicationData extends ApplicationData { extensions: Record; settings: Record; modelStatistics: Record; + displayNameDrivers: string[]; + slugDrivers: Record; } export default class AdminApplication extends Application { diff --git a/framework/core/js/src/admin/components/AdminPage.tsx b/framework/core/js/src/admin/components/AdminPage.tsx index 658fd53f39..80c663364a 100644 --- a/framework/core/js/src/admin/components/AdminPage.tsx +++ b/framework/core/js/src/admin/components/AdminPage.tsx @@ -60,7 +60,7 @@ export type HTMLInputTypes = export interface CommonSettingsItemOptions extends Mithril.Attributes { setting: string; - label: Mithril.Children; + label?: Mithril.Children; help?: Mithril.Children; className?: string; } @@ -137,6 +137,8 @@ export type AdminHeaderAttrs = AdminHeaderOptions & Partial>; +export type SaveSubmitEvent = SubmitEvent & { redraw: boolean }; + export default abstract class AdminPage extends Page { settings: MutableSettings = {}; loading: boolean = false; @@ -162,7 +164,7 @@ export default abstract class AdminPage): Mithril.Children { + submitButton(): Mithril.Children { return (