From 376386c58be17e779ece2ac2224fde437b2b567c Mon Sep 17 00:00:00 2001 From: Awais Ansari <79941147+awais-ansari@users.noreply.github.com> Date: Thu, 28 Nov 2024 18:32:47 +0500 Subject: [PATCH] fix: console and propType errors (#621) * fix: console and propType errors * fix: updated default props --- .env.development | 1 + .env.test | 1 + src/DesktopHeader.jsx | 6 +++--- src/Header.jsx | 2 ++ src/Notification/data/hook.js | 10 +++++++++- src/Notification/index.jsx | 4 ++-- src/studio-header/MobileMenu.jsx | 2 +- src/studio-header/NavDropdownMenu.jsx | 2 +- 8 files changed, 20 insertions(+), 8 deletions(-) diff --git a/.env.development b/.env.development index 53605820..cd76ce6a 100644 --- a/.env.development +++ b/.env.development @@ -22,3 +22,4 @@ LOGO_WHITE_URL=https://edx-cdn.org/v3/prod/logo-white.svg FAVICON_URL=https://edx-cdn.org/v3/prod/favicon.ico NOTIFICATION_FEEDBACK_URL='' CAREERS_URL='' +STUDIO_BASE_URL='' diff --git a/.env.test b/.env.test index 335fa225..ff42aeae 100644 --- a/.env.test +++ b/.env.test @@ -22,3 +22,4 @@ LOGO_WHITE_URL=https://edx-cdn.org/v3/prod/logo-white.svg FAVICON_URL=https://edx-cdn.org/v3/prod/favicon.ico NOTIFICATION_FEEDBACK_URL='' CAREERS_URL='' +STUDIO_BASE_URL='' diff --git a/src/DesktopHeader.jsx b/src/DesktopHeader.jsx index 0390b7e7..6c4aa801 100644 --- a/src/DesktopHeader.jsx +++ b/src/DesktopHeader.jsx @@ -207,7 +207,7 @@ DesktopHeader.propTypes = { items: PropTypes.arrayOf(PropTypes.shape({ type: PropTypes.oneOf(['item', 'menu']), href: PropTypes.string, - content: PropTypes.string, + content: PropTypes.oneOfType([PropTypes.string, PropTypes.node]), disabled: PropTypes.bool, isActive: PropTypes.bool, onClick: PropTypes.func, @@ -255,8 +255,8 @@ DesktopHeader.defaultProps = { email: '', loggedIn: false, notificationAppData: { - apps: { }, - tabsCount: { }, + apps: {}, + tabsCount: {}, appsId: [], isNewNotificationViewEnabled: false, notificationExpiryDays: 0, diff --git a/src/Header.jsx b/src/Header.jsx index 29b9f6ec..2b1a8fbe 100644 --- a/src/Header.jsx +++ b/src/Header.jsx @@ -28,6 +28,7 @@ ensureConfig([ 'LOGO_URL', 'ACCOUNT_SETTINGS_URL', 'NOTIFICATION_FEEDBACK_URL', + 'STUDIO_BASE_URL', ], 'Header component'); subscribe(APP_CONFIG_INITIALIZED, () => { @@ -188,6 +189,7 @@ const Header = ({ secondaryMenu: getConfig().MINIMAL_HEADER || getConfig().AUTHN_MINIMAL_HEADER ? [] : secondaryMenu, userMenu: getConfig().AUTHN_MINIMAL_HEADER ? [] : userMenu, loggedOutItems: getConfig().AUTHN_MINIMAL_HEADER ? [] : loggedOutItems, + studioBaseUrl: config.STUDIO_BASE_URL, }; if (enterpriseCustomerBrandingConfig) { diff --git a/src/Notification/data/hook.js b/src/Notification/data/hook.js index f9f73130..164a6e8c 100644 --- a/src/Notification/data/hook.js +++ b/src/Notification/data/hook.js @@ -84,7 +84,15 @@ export function useNotification() { isNewNotificationViewEnabled, }; } catch (error) { - return { notificationStatus: RequestStatus.FAILED }; + return { + notificationStatus: RequestStatus.FAILED, + apps: {}, + appsId: [], + isNewNotificationViewEnabled: false, + notificationExpiryDays: 0, + showNotificationsTray: false, + tabsCount: { count: 0 }, + }; } }, [normalizeNotificationCounts]); diff --git a/src/Notification/index.jsx b/src/Notification/index.jsx index f1865f42..2462f110 100644 --- a/src/Notification/index.jsx +++ b/src/Notification/index.jsx @@ -230,8 +230,8 @@ Notifications.propTypes = { Notifications.defaultProps = { showLeftMargin: true, notificationAppData: { - apps: { }, - tabsCount: { }, + apps: {}, + tabsCount: { count: 0 }, appsId: [], isNewNotificationViewEnabled: false, notificationExpiryDays: 0, diff --git a/src/studio-header/MobileMenu.jsx b/src/studio-header/MobileMenu.jsx index 610321e6..2bfe6cc5 100644 --- a/src/studio-header/MobileMenu.jsx +++ b/src/studio-header/MobileMenu.jsx @@ -20,7 +20,7 @@ const MobileMenu = ({ >