Skip to content

Commit

Permalink
fix: console and propType errors (#621)
Browse files Browse the repository at this point in the history
* fix: console and propType errors

* fix: updated default props
  • Loading branch information
awais-ansari authored Nov 28, 2024
1 parent 48e0cd3 commit 376386c
Show file tree
Hide file tree
Showing 8 changed files with 20 additions and 8 deletions.
1 change: 1 addition & 0 deletions .env.development
Original file line number Diff line number Diff line change
Expand Up @@ -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=''
1 change: 1 addition & 0 deletions .env.test
Original file line number Diff line number Diff line change
Expand Up @@ -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=''
6 changes: 3 additions & 3 deletions src/DesktopHeader.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -255,8 +255,8 @@ DesktopHeader.defaultProps = {
email: '',
loggedIn: false,
notificationAppData: {
apps: { },
tabsCount: { },
apps: {},
tabsCount: {},
appsId: [],
isNewNotificationViewEnabled: false,
notificationExpiryDays: 0,
Expand Down
2 changes: 2 additions & 0 deletions src/Header.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ ensureConfig([
'LOGO_URL',
'ACCOUNT_SETTINGS_URL',
'NOTIFICATION_FEEDBACK_URL',
'STUDIO_BASE_URL',
], 'Header component');

subscribe(APP_CONFIG_INITIALIZED, () => {
Expand Down Expand Up @@ -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) {
Expand Down
10 changes: 9 additions & 1 deletion src/Notification/data/hook.js
Original file line number Diff line number Diff line change
Expand Up @@ -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]);

Expand Down
4 changes: 2 additions & 2 deletions src/Notification/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -230,8 +230,8 @@ Notifications.propTypes = {
Notifications.defaultProps = {
showLeftMargin: true,
notificationAppData: {
apps: { },
tabsCount: { },
apps: {},
tabsCount: { count: 0 },
appsId: [],
isNewNotificationViewEnabled: false,
notificationExpiryDays: 0,
Expand Down
2 changes: 1 addition & 1 deletion src/studio-header/MobileMenu.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ const MobileMenu = ({
>
<ul className="p-0" style={{ listStyleType: 'none' }}>
{items.map(item => (
<li className="mobile-menu-item">
<li className="mobile-menu-item" key={`${id}-${item.title}`}>
<a href={item.href}>
{item.title}
</a>
Expand Down
2 changes: 1 addition & 1 deletion src/studio-header/NavDropdownMenu.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ NavDropdownMenu.propTypes = {
id: PropTypes.string.isRequired,
email: PropTypes.string,
name: PropTypes.string,
buttonTitle: PropTypes.string.isRequired,
buttonTitle: PropTypes.oneOfType([PropTypes.string, PropTypes.node]).isRequired,
items: PropTypes.arrayOf(PropTypes.shape({
href: PropTypes.string,
title: PropTypes.string,
Expand Down

0 comments on commit 376386c

Please sign in to comment.