From 8c9066d2b28ed466fc27e69cde5c030569f1d71c Mon Sep 17 00:00:00 2001 From: Sami Mazouz Date: Sat, 16 Jul 2022 09:54:51 +0100 Subject: [PATCH 1/2] fix(a11y): color preview fields have no aria label Signed-off-by: Sami Mazouz --- .../admin/components/{AppearancePage.js => AppearancePage.tsx} | 2 ++ framework/core/locale/core.yml | 2 ++ 2 files changed, 4 insertions(+) rename framework/core/js/src/admin/components/{AppearancePage.js => AppearancePage.tsx} (95%) diff --git a/framework/core/js/src/admin/components/AppearancePage.js b/framework/core/js/src/admin/components/AppearancePage.tsx similarity index 95% rename from framework/core/js/src/admin/components/AppearancePage.js rename to framework/core/js/src/admin/components/AppearancePage.tsx index 0550f3841a..02aede4bab 100644 --- a/framework/core/js/src/admin/components/AppearancePage.js +++ b/framework/core/js/src/admin/components/AppearancePage.tsx @@ -88,11 +88,13 @@ export default class AppearancePage extends AdminPage { type: 'color-preview', setting: 'theme_primary_color', placeholder: '#aaaaaa', + ariaLabel: app.translator.trans('core.admin.appearance.colors_primary_label'), })} {this.buildSettingComponent({ type: 'color-preview', setting: 'theme_secondary_color', placeholder: '#aaaaaa', + ariaLabel: app.translator.trans('core.admin.appearance.colors_secondary_label'), })} , 70 diff --git a/framework/core/locale/core.yml b/framework/core/locale/core.yml index 29d407a380..601422c6f4 100644 --- a/framework/core/locale/core.yml +++ b/framework/core/locale/core.yml @@ -11,6 +11,8 @@ core: appearance: colored_header_label: Colored Header colors_heading: Colors + colors_primary_label: Primary Color + colors_secondary_label: Secondary Color colors_text: "Choose two colors to theme your forum with. The first will be used as a highlight color, while the second will be used to style background elements." custom_footer_heading: Custom Footer custom_footer_text: => core.ref.custom_footer_text From 6e1efd1e195b68a11b0a0e98a7669dde30c0658c Mon Sep 17 00:00:00 2001 From: Sami Mazouz Date: Tue, 19 Jul 2022 19:30:21 +0100 Subject: [PATCH 2/2] 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 (