-
Notifications
You must be signed in to change notification settings - Fork 58
Support External Help Link #917
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
binh-dam-ibigroup
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
miles-grant-ibigroup
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Works! Just a few nitpicks
lib/util/auth.js
Outdated
| url: '/help' | ||
| } | ||
| ] | ||
| export const accountLinks = (config) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nitpick: can we refactor this to take in extraMenuItems instead of the entire config?
lib/util/auth.js
Outdated
| export const accountLinks = (config) => { | ||
| const helpLink = | ||
| config?.extraMenuItems.find((link) => link.id === 'help') || undefined | ||
| const helpLinkUrl = helpLink ? helpLink.href : '/help' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we inline this?
| messageId: 'help', | ||
| // Add a target attribute if you need the link to open in a new window, etc. | ||
| // (supports the same values as <a target=... >). | ||
| // target: '_blank', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this supposed to be uncommented?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This exists in dev, but I think it's just a demonstration? Seems like weird behavior for this to open a new tab by default
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good call. We can leave it commented out for now!
| const mapStateToProps = (state) => { | ||
| return { | ||
| auth0Config: getAuth0Config(state.otp.config.persistence), | ||
| config: state.otp.config, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Once accountLinks is extracted this can be refactored to only extract the part of the config we need
miles-grant-ibigroup
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looking good! Just one small crash fix and we should be good to go
| auth0Config: getAuth0Config(state.otp.config.persistence), | ||
| config: state.otp.config, | ||
| configLanguages: state.otp.config.language, | ||
| extraMenuItems: state.otp.config.extraMenuItems, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You need optional chaining here!
Description:
If there is an external "help" link supplied in the config, the "help" option inside the account dropdown will direct users to the external web address. An icon will also be added indicating the link is an external link.
PR Checklist: