-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
762410d
commit ae68ffc
Showing
7 changed files
with
144 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
import React from 'react'; | ||
import { reduxHooks } from 'hooks'; // eslint-disable-line import/no-unresolved | ||
import { | ||
Badge, breakpoints, Dropdown, useWindowSize, | ||
} from '@openedx/paragon'; | ||
import { useIntl } from '@edx/frontend-platform/i18n'; | ||
import _ from 'lodash'; | ||
import { getConfig } from '@edx/frontend-platform'; | ||
import messages from './messages'; | ||
|
||
const UserCareerMenuItem = () => { | ||
const { formatMessage } = useIntl(); | ||
const { width } = useWindowSize(); | ||
const isMobile = width <= breakpoints.small.maxWidth; | ||
|
||
const dashboard = reduxHooks.useEnterpriseDashboardData(); | ||
|
||
if (!_.isEmpty(dashboard)) { | ||
return null; | ||
} | ||
if (isMobile) { | ||
return ( | ||
<li className="nav-item" key="item-career"> | ||
<a href={`${getConfig().CAREER_LINK_URL}`} className="nav-link"> | ||
{formatMessage(messages.career)} | ||
<Badge className="px-2 mx-2" variant="warning"> | ||
{formatMessage(messages.newAlert)} | ||
</Badge> | ||
</a> | ||
</li> | ||
); | ||
} | ||
return ( | ||
<Dropdown.Item href={`${getConfig().CAREER_LINK_URL}`} key="item-career"> | ||
{formatMessage(messages.career)} | ||
<Badge className="px-2 mx-2" variant="warning"> | ||
{formatMessage(messages.newAlert)} | ||
</Badge> | ||
</Dropdown.Item> | ||
); | ||
}; | ||
|
||
export default UserCareerMenuItem; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
import React from 'react'; | ||
import { reduxHooks } from 'hooks'; // eslint-disable-line import/no-unresolved | ||
import { breakpoints, Dropdown, useWindowSize } from '@openedx/paragon'; | ||
import { useIntl } from '@edx/frontend-platform/i18n'; | ||
import _ from 'lodash'; | ||
import messages from './messages'; | ||
|
||
const UserDashboardMenuGroup = () => { | ||
const { formatMessage } = useIntl(); | ||
const { width } = useWindowSize(); | ||
const isMobile = width <= breakpoints.small.maxWidth; | ||
|
||
const dashboard = reduxHooks.useEnterpriseDashboardData(); | ||
|
||
if (isMobile) { | ||
return ( | ||
<> | ||
<li className="nav-item" key="item-dashboard"> | ||
<a href="/edx-dashboard" className="nav-link active"> | ||
{formatMessage(messages.dashboardPersonal)} | ||
</a> | ||
</li> | ||
{!_.isEmpty(dashboard) && ( | ||
<li className="nav-item" key={dashboard.label}> | ||
<a href={dashboard.url} className="nav-link active"> | ||
{dashboard.label} {formatMessage(messages.dashboard)} | ||
</a> | ||
</li> | ||
)} | ||
</> | ||
); | ||
} | ||
return ( | ||
<> | ||
<Dropdown.Header>{formatMessage(messages.dashboardSwitch)}</Dropdown.Header> | ||
<Dropdown.Item as="a" href="/edx-dashboard" className="active" key="item-dashboard"> | ||
{formatMessage(messages.dashboardPersonal)} | ||
</Dropdown.Item> | ||
{!_.isEmpty(dashboard) && ( | ||
<Dropdown.Item as="a" href={dashboard.url} key={dashboard.label}> | ||
{dashboard.label} {formatMessage(messages.dashboard)} | ||
</Dropdown.Item> | ||
)} | ||
<Dropdown.Divider /> | ||
</> | ||
); | ||
}; | ||
|
||
export default UserDashboardMenuGroup; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
// eslint-disable-next-line import/prefer-default-export | ||
export const reduxHooks = { | ||
useEnterpriseDashboardData: () => {}, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
import { defineMessages } from '@edx/frontend-platform/i18n'; | ||
|
||
const messages = defineMessages({ | ||
dashboard: { | ||
id: 'learnerVariantDashboard.menu.dashboard.label', | ||
defaultMessage: 'Dashboard', | ||
description: 'The text for the user menu Dashboard navigation link.', | ||
}, | ||
dashboardPersonal: { | ||
id: 'learnerVariantDashboard.menu.dashboardPersonal.label', | ||
defaultMessage: 'Personal', | ||
description: 'Link to personal dashboard in user menu', | ||
}, | ||
dashboardSwitch: { | ||
id: 'learnerVariantDashboard.menu.dashboardSwitch.label', | ||
defaultMessage: 'SWITCH DASHBOARD', | ||
description: 'Switch Dashboard header in the user menu', | ||
}, | ||
career: { | ||
id: 'leanerDashboard.menu.career.label', | ||
defaultMessage: 'Career', | ||
description: 'The text for the user menu Career navigation link.', | ||
}, | ||
newAlert: { | ||
id: 'header.menu.new.label', | ||
defaultMessage: 'New', | ||
description: 'The text announcing that an item in the user menu is New', | ||
}, | ||
}); | ||
|
||
export default messages; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters