-
Notifications
You must be signed in to change notification settings - Fork 2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update async help center to use help center loader
- Loading branch information
Showing
1 changed file
with
7 additions
and
14 deletions.
There are no files selected for viewing
21 changes: 7 additions & 14 deletions
21
client/landing/stepper/declarative-flow/internals/components/help-center/async.tsx
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 |
---|---|---|
@@ -1,20 +1,13 @@ | ||
import { HelpCenter } from '@automattic/data-stores'; | ||
import { useDispatch } from '@wordpress/data'; | ||
import { useCallback } from 'react'; | ||
import AsyncLoad from 'calypso/components/async-load'; | ||
|
||
const HELP_CENTER_STORE = HelpCenter.register(); | ||
import HelpCenterLoader from 'calypso/components/help-center-loader'; | ||
// import { useSite } from 'calypso/landing/stepper/hooks/use-site'; | ||
|
||
const AsyncHelpCenter = () => { | ||
const { setShowHelpCenter } = useDispatch( HELP_CENTER_STORE ); | ||
|
||
const handleClose = useCallback( () => { | ||
setShowHelpCenter( false ); | ||
}, [ setShowHelpCenter ] ); | ||
// TODO: The useSite uses the `useLocation`, but we are not adding it inside the router because HelpCenter also has its own router. | ||
// const site = useSite(); | ||
const site = null; | ||
|
||
return ( | ||
<AsyncLoad require="@automattic/help-center" placeholder={ null } handleClose={ handleClose } /> | ||
); | ||
// TODO: Should we set the currentRoute prop or allow the HelpCenter get the default value from `window.___location`? It would probably cause issues not updating this value. Notice that the hook `useCurrentRoute` also depends on the router because it uses the `useLocation`. | ||
return <HelpCenterLoader site={ site } sectionName="stepper" loadHelpCenter />; | ||
}; | ||
|
||
export default AsyncHelpCenter; |