-
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.
Only render Order History in the header user menu if the user has no available learner portal, and is thus not accessing content via a subscription. Also, only display 0 or 1 learner portal dashboard links, and give it the simple title "Dashboard".
- Loading branch information
1 parent
6266908
commit c20c618
Showing
5 changed files
with
139 additions
and
35 deletions.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,3 +6,4 @@ node_modules | |
temp | ||
src/i18n/transifex_input.json | ||
.vscode/ | ||
*~ |
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
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,37 @@ | ||
import { useEffect, useState } from 'react'; | ||
import { getLearnerPortalLinks, getSelectedEnterpriseUUID } from '@edx/frontend-enterprise'; | ||
import { getAuthenticatedHttpClient } from '@edx/frontend-platform/auth'; | ||
|
||
export default function useEnterpriseConfig(authenticatedUser) { | ||
const [enterpriseLearnerPortalLink, setEnterpriseLearnerPortalLink] = useState(); | ||
const [enterpriseCustomerBrandingConfig, setEnterpriseCustomerBrandingConfig] = useState(); | ||
useEffect( | ||
() => { | ||
const httpClient = getAuthenticatedHttpClient(); | ||
getLearnerPortalLinks(httpClient, authenticatedUser).then((learnerPortalLinks) => { | ||
const preferredUUID = getSelectedEnterpriseUUID(authenticatedUser); | ||
const preferredLearnerPortalLink = learnerPortalLinks.find(learnerPortalLink => | ||
learnerPortalLink.uuid === preferredUUID); | ||
if (preferredLearnerPortalLink) { | ||
setEnterpriseCustomerBrandingConfig({ | ||
logo: preferredLearnerPortalLink.branding_configuration.logo, | ||
logoAltText: preferredLearnerPortalLink.title, | ||
logoDestination: preferredLearnerPortalLink.url, | ||
}); | ||
|
||
setEnterpriseLearnerPortalLink({ | ||
type: 'item', | ||
href: preferredLearnerPortalLink.url, | ||
content: 'Dashboard', | ||
}); | ||
} | ||
}); | ||
}, | ||
[], | ||
); | ||
|
||
return { | ||
enterpriseLearnerPortalLink, | ||
enterpriseCustomerBrandingConfig, | ||
}; | ||
} |