-
Notifications
You must be signed in to change notification settings - Fork 13
PROD-3234 Add Spinner while Header Loads -> PROD-3115_uni-nav #423
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,11 +10,12 @@ import { | |
} from 'react' | ||
import classNames from 'classnames' | ||
|
||
import { EnvironmentConfig, PagePortalId } from '../config' | ||
import { EnvironmentConfig, PageSubheaderPortalId } from '../config' | ||
import { | ||
authUrlLogin, | ||
authUrlLogout, | ||
authUrlSignup, | ||
LoadingSpinner, | ||
profileContext, | ||
ProfileContextData, | ||
routeContext, | ||
|
@@ -29,7 +30,7 @@ UniNavSnippet(EnvironmentConfig.UNIVERSAL_NAV.URL) | |
|
||
const Header: FC = () => { | ||
|
||
const { activeToolName }: RouteContextData = useContext(routeContext) | ||
const { activeToolName, activeToolRoute }: RouteContextData = useContext(routeContext) | ||
const { profile, initialized: profileReady }: ProfileContextData = useContext(profileContext) | ||
const [ready, setReady]: [boolean, Dispatch<SetStateAction<boolean>>] = useState<boolean>(false) | ||
const headerInit: MutableRefObject<boolean> = useRef(false) | ||
|
@@ -44,7 +45,7 @@ const Header: FC = () => { | |
headerInit.current = true | ||
|
||
tcUniNav( | ||
'tool', | ||
'init', | ||
navElementId, | ||
{ | ||
onReady() { | ||
|
@@ -55,6 +56,8 @@ const Header: FC = () => { | |
signOut() { window.location.href = authUrlLogout }, | ||
signUp() { window.location.href = authUrlSignup() }, | ||
toolName: activeToolName, | ||
toolRoute: activeToolRoute, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @brooketopcoder you'll have to add an effect on There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @vas3a yep--figured that out. I've done that in a separate PR. |
||
type: 'tool', | ||
user: profileReady && profile ? { | ||
handle: profile.handle, | ||
initials: `${profile.firstName.charAt(0)}${profile.lastName.charAt(0)}`, | ||
|
@@ -65,15 +68,18 @@ const Header: FC = () => { | |
) | ||
}, [ | ||
activeToolName, | ||
activeToolRoute, | ||
profileReady, | ||
profile]) | ||
profile, | ||
]) | ||
|
||
return ( | ||
<> | ||
<LoadingSpinner hide={ready} /> | ||
<div id={navElementId} /> | ||
<div | ||
id={PagePortalId} | ||
className={classNames('full-width-relative', !ready && 'hidden')} | ||
id={PageSubheaderPortalId} | ||
className={classNames('full-width-relative')} | ||
/> | ||
</> | ||
) | ||
|
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 every tool and app that implements UniNav going to need to do this?
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.
@testflyjets every tool will need to handle the authentication part (login/logout/sign up, and "set user")