Skip to content

Commit 376386c

Browse files
authored
fix: console and propType errors (#621)
* fix: console and propType errors * fix: updated default props
1 parent 48e0cd3 commit 376386c

File tree

8 files changed

+20
-8
lines changed

8 files changed

+20
-8
lines changed

.env.development

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,3 +22,4 @@ LOGO_WHITE_URL=https://edx-cdn.org/v3/prod/logo-white.svg
2222
FAVICON_URL=https://edx-cdn.org/v3/prod/favicon.ico
2323
NOTIFICATION_FEEDBACK_URL=''
2424
CAREERS_URL=''
25+
STUDIO_BASE_URL=''

.env.test

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,3 +22,4 @@ LOGO_WHITE_URL=https://edx-cdn.org/v3/prod/logo-white.svg
2222
FAVICON_URL=https://edx-cdn.org/v3/prod/favicon.ico
2323
NOTIFICATION_FEEDBACK_URL=''
2424
CAREERS_URL=''
25+
STUDIO_BASE_URL=''

src/DesktopHeader.jsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -207,7 +207,7 @@ DesktopHeader.propTypes = {
207207
items: PropTypes.arrayOf(PropTypes.shape({
208208
type: PropTypes.oneOf(['item', 'menu']),
209209
href: PropTypes.string,
210-
content: PropTypes.string,
210+
content: PropTypes.oneOfType([PropTypes.string, PropTypes.node]),
211211
disabled: PropTypes.bool,
212212
isActive: PropTypes.bool,
213213
onClick: PropTypes.func,
@@ -255,8 +255,8 @@ DesktopHeader.defaultProps = {
255255
email: '',
256256
loggedIn: false,
257257
notificationAppData: {
258-
apps: { },
259-
tabsCount: { },
258+
apps: {},
259+
tabsCount: {},
260260
appsId: [],
261261
isNewNotificationViewEnabled: false,
262262
notificationExpiryDays: 0,

src/Header.jsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ ensureConfig([
2828
'LOGO_URL',
2929
'ACCOUNT_SETTINGS_URL',
3030
'NOTIFICATION_FEEDBACK_URL',
31+
'STUDIO_BASE_URL',
3132
], 'Header component');
3233

3334
subscribe(APP_CONFIG_INITIALIZED, () => {
@@ -188,6 +189,7 @@ const Header = ({
188189
secondaryMenu: getConfig().MINIMAL_HEADER || getConfig().AUTHN_MINIMAL_HEADER ? [] : secondaryMenu,
189190
userMenu: getConfig().AUTHN_MINIMAL_HEADER ? [] : userMenu,
190191
loggedOutItems: getConfig().AUTHN_MINIMAL_HEADER ? [] : loggedOutItems,
192+
studioBaseUrl: config.STUDIO_BASE_URL,
191193
};
192194

193195
if (enterpriseCustomerBrandingConfig) {

src/Notification/data/hook.js

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,15 @@ export function useNotification() {
8484
isNewNotificationViewEnabled,
8585
};
8686
} catch (error) {
87-
return { notificationStatus: RequestStatus.FAILED };
87+
return {
88+
notificationStatus: RequestStatus.FAILED,
89+
apps: {},
90+
appsId: [],
91+
isNewNotificationViewEnabled: false,
92+
notificationExpiryDays: 0,
93+
showNotificationsTray: false,
94+
tabsCount: { count: 0 },
95+
};
8896
}
8997
}, [normalizeNotificationCounts]);
9098

src/Notification/index.jsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -230,8 +230,8 @@ Notifications.propTypes = {
230230
Notifications.defaultProps = {
231231
showLeftMargin: true,
232232
notificationAppData: {
233-
apps: { },
234-
tabsCount: { },
233+
apps: {},
234+
tabsCount: { count: 0 },
235235
appsId: [],
236236
isNewNotificationViewEnabled: false,
237237
notificationExpiryDays: 0,

src/studio-header/MobileMenu.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ const MobileMenu = ({
2020
>
2121
<ul className="p-0" style={{ listStyleType: 'none' }}>
2222
{items.map(item => (
23-
<li className="mobile-menu-item">
23+
<li className="mobile-menu-item" key={`${id}-${item.title}`}>
2424
<a href={item.href}>
2525
{item.title}
2626
</a>

src/studio-header/NavDropdownMenu.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ NavDropdownMenu.propTypes = {
4747
id: PropTypes.string.isRequired,
4848
email: PropTypes.string,
4949
name: PropTypes.string,
50-
buttonTitle: PropTypes.string.isRequired,
50+
buttonTitle: PropTypes.oneOfType([PropTypes.string, PropTypes.node]).isRequired,
5151
items: PropTypes.arrayOf(PropTypes.shape({
5252
href: PropTypes.string,
5353
title: PropTypes.string,

0 commit comments

Comments
 (0)