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 and sundasnoreen12 committed Nov 29, 2024
1 parent 48e0cd3 commit 63a2d7e
Show file tree
Hide file tree
Showing 24 changed files with 44 additions and 625 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=''
1 change: 1 addition & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@ dist
example
node_modules
src/lightning.js
src/i18n/messages/
16 changes: 10 additions & 6 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
export TRANSIFEX_RESOURCE = frontend-component-header-edx
transifex_resource = frontend-component-header-edx
transifex_langs = "ar,fr,es_419,zh_CN,pt,it,de,uk,ru,hi,fr_CA"

intl_imports = ./node_modules/.bin/intl-imports.js
transifex_utils = ./node_modules/.bin/transifex-utils.js
i18n = ./src/i18n
transifex_input = $(i18n)/transifex_input.json
Expand Down Expand Up @@ -50,9 +47,16 @@ push_translations:
# Pushing comments to Transifex...
./node_modules/@edx/reactifex/bash_scripts/put_comments_v3.sh

# Pulls translations from Transifex.
pull_translations:
tx pull -t -f --mode reviewed --languages=$(transifex_langs)
rm -rf src/i18n/messages
mkdir src/i18n/messages
cd src/i18n/messages \
&& atlas pull $(ATLAS_OPTIONS) \
translations/frontend-component-header/src/i18n/messages:frontend-component-header\
translations/frontend-platform/src/i18n/messages:frontend-platform \
translations/paragon/src/i18n/messages:paragon \

$(intl_imports) frontend-component-header-edx frontend-platform paragon

# This target is used by Travis.
validate-no-uncommitted-package-lock-changes:
Expand Down
11 changes: 11 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
"@edx/browserslist-config": "1.2.0",
"@edx/frontend-platform": "^8.1.0",
"@edx/reactifex": "2.2.0",
"@edx/openedx-atlas": "^0.6.0",
"@openedx/frontend-build": "^14.0.10",
"@testing-library/dom": "9.3.4",
"@testing-library/jest-dom": "5.17.0",
Expand Down
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,13 +230,13 @@ Notifications.propTypes = {
Notifications.defaultProps = {
showLeftMargin: true,
notificationAppData: {
apps: { },
tabsCount: { },
apps: {},
appsId: [],
isNewNotificationViewEnabled: false,
notificationExpiryDays: 0,
notificationStatus: '',
showNotificationsTray: false,
tabsCount: { count: 0 },
},
};

Expand Down
29 changes: 1 addition & 28 deletions src/i18n/index.js
Original file line number Diff line number Diff line change
@@ -1,28 +1 @@
import arMessages from './messages/ar.json';
import frMessages from './messages/fr.json';
import es419Messages from './messages/es_419.json';
import zhcnMessages from './messages/zh_CN.json';
import ptMessages from './messages/pt.json';
import itMessages from './messages/it.json';
import ukMessages from './messages/uk.json';
import deMessages from './messages/de.json';
import ruMessages from './messages/ru.json';
import hiMessages from './messages/hi.json';
import frCAMessages from './messages/fr_CA.json';
// no need to import en messages-- they are in the defaultMessage field

const messages = {
ar: arMessages,
'es-419': es419Messages,
fr: frMessages,
'zh-cn': zhcnMessages,
pt: ptMessages,
it: itMessages,
de: deMessages,
hi: hiMessages,
'fr-ca': frCAMessages,
ru: ruMessages,
uk: ukMessages,
};

export default messages;
export default [];
53 changes: 0 additions & 53 deletions src/i18n/messages/ar.json

This file was deleted.

53 changes: 0 additions & 53 deletions src/i18n/messages/de.json

This file was deleted.

53 changes: 0 additions & 53 deletions src/i18n/messages/es_419.json

This file was deleted.

53 changes: 0 additions & 53 deletions src/i18n/messages/fr.json

This file was deleted.

Loading

0 comments on commit 63a2d7e

Please sign in to comment.