From 91415eef244e4920402b332c354ba50228dac841 Mon Sep 17 00:00:00 2001 From: Ldoppea Date: Tue, 25 Jul 2023 11:31:43 +0200 Subject: [PATCH] refactor: Change makeHtmlErrorPage theme param from string to enum --- src/app/view/Error/Pages/GenericErrorPage.ts | 3 ++- src/app/view/Error/Pages/makeHtmlErrorPage.ts | 14 ++++++++++---- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/src/app/view/Error/Pages/GenericErrorPage.ts b/src/app/view/Error/Pages/GenericErrorPage.ts index a98c2bac5..b5ff2d51c 100644 --- a/src/app/view/Error/Pages/GenericErrorPage.ts +++ b/src/app/view/Error/Pages/GenericErrorPage.ts @@ -1,6 +1,7 @@ import { ErrorPageGenerator, ErrorPageGeneratorArguments, + Theme, makeHtmlErrorPage } from '/app/view/Error/Pages/makeHtmlErrorPage' import { t } from '/locales/i18n' @@ -27,5 +28,5 @@ export const GenericErrorPage: ErrorPageGenerator = ({ backgroundColor, errorDetails: error?.details, reset: true, - invertedTheme: false + theme: Theme.light }) diff --git a/src/app/view/Error/Pages/makeHtmlErrorPage.ts b/src/app/view/Error/Pages/makeHtmlErrorPage.ts index 7775e2558..d741c342d 100644 --- a/src/app/view/Error/Pages/makeHtmlErrorPage.ts +++ b/src/app/view/Error/Pages/makeHtmlErrorPage.ts @@ -5,6 +5,11 @@ import { getDimensions } from '/libs/dimensions' import { themeCss } from '/screens/login/components/assets/common/css/cssTheme' import { t } from '/locales/i18n' +export enum Theme { + light, + inverted +} + export interface ErrorPageGeneratorArguments { backgroundColor?: string error?: { @@ -51,7 +56,7 @@ interface MakeErrorPageProps { reset?: boolean backgroundColor?: string errorDetails?: string - invertedTheme?: boolean + theme?: Theme } export const makeHtmlErrorPage = ({ @@ -63,13 +68,14 @@ export const makeHtmlErrorPage = ({ reset, backgroundColor, errorDetails, - invertedTheme = true + theme = Theme.inverted }: MakeErrorPageProps): string => { const dimensions = getDimensions() const navbarHeight = dimensions.navbarHeight const statusBarHeight = dimensions.statusBarHeight - const theme = invertedTheme ? 'theme-inverted' : 'theme-light' + const themeString = + theme === Theme.inverted ? 'theme-inverted' : 'theme-light' return ` @@ -100,7 +106,7 @@ export const makeHtmlErrorPage = ({ - +
${ header ? headerTemplate : ''