From 192a29d0dd7ccee4c0d5f1237a790e6ef04678c8 Mon Sep 17 00:00:00 2001 From: Anton Lantukh Date: Thu, 11 Jan 2024 11:18:13 +0100 Subject: [PATCH] fix(project): pre-release fixes - fix date check for live events - fix error component node container - fix translations to be parsed by i18n --- .../__snapshots__/DemoConfigDialog.test.tsx.snap | 4 ++-- src/components/ErrorPage/ErrorPage.tsx | 4 ++-- src/services/api.service.ts | 4 ++-- src/services/settings.service.ts | 5 ++--- 4 files changed, 8 insertions(+), 9 deletions(-) diff --git a/src/components/DemoConfigDialog/__snapshots__/DemoConfigDialog.test.tsx.snap b/src/components/DemoConfigDialog/__snapshots__/DemoConfigDialog.test.tsx.snap index 52d6e97fe..354b7a0b9 100644 --- a/src/components/DemoConfigDialog/__snapshots__/DemoConfigDialog.test.tsx.snap +++ b/src/components/DemoConfigDialog/__snapshots__/DemoConfigDialog.test.tsx.snap @@ -117,7 +117,7 @@ exports[` > renders and matches snapshot error dialog 1`] = `

demo_note

- + diff --git a/src/components/ErrorPage/ErrorPage.tsx b/src/components/ErrorPage/ErrorPage.tsx index 341621811..dd7070c68 100644 --- a/src/components/ErrorPage/ErrorPage.tsx +++ b/src/components/ErrorPage/ErrorPage.tsx @@ -45,7 +45,7 @@ export const ErrorPageWithoutTranslation = ({ title, children, message, learnMor

{message || 'Try refreshing this page or come back later.'}

{children} {(IS_DEVELOPMENT_BUILD || IS_DEMO_MODE || IS_PREVIEW_MODE) && helpLink && ( -

+

{learnMoreLabel || 'Learn More'} @@ -54,7 +54,7 @@ export const ErrorPageWithoutTranslation = ({ title, children, message, learnMor )} -

+
)} diff --git a/src/services/api.service.ts b/src/services/api.service.ts index f804bba66..1049f3adb 100644 --- a/src/services/api.service.ts +++ b/src/services/api.service.ts @@ -34,9 +34,9 @@ export default class ApiService { }; private parseDate = (item: PlaylistItem, prop: string) => { - const date = item[prop]; + const date = item[prop] as string | undefined; - if (date && !isValid(date)) { + if (date && !isValid(new Date(date))) { console.error(`Invalid "${prop}" date provided for the "${item.title}" media item`); return undefined; } diff --git a/src/services/settings.service.ts b/src/services/settings.service.ts index 67a07738a..1d42cc1e0 100644 --- a/src/services/settings.service.ts +++ b/src/services/settings.service.ts @@ -79,11 +79,10 @@ export default class SettingsService { }); const i18n = getI18n(); - const bundle = i18n.getResourceBundle(i18n.language, 'error'); const errorPayload = { - title: bundle['settings_invalid'], - description: bundle['check_your_settings'], + title: i18n.t('error:settings_invalid'), + description: i18n.t('error:check_your_settings'), helpLink: 'https://github.com/jwplayer/ott-web-app/blob/develop/docs/initialization-file.md', };