-
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
10 additions
and
13 deletions.
There are no files selected for viewing
23 changes: 10 additions & 13 deletions
23
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,17 @@ | ||
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 { useCurrentRoute } from 'calypso/landing/stepper/hooks/use-current-route'; | ||
// import { useSite } from 'calypso/landing/stepper/hooks/use-site'; | ||
|
||
const AsyncHelpCenter = () => { | ||
const { setShowHelpCenter } = useDispatch( HELP_CENTER_STORE ); | ||
// 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; | ||
|
||
const handleClose = useCallback( () => { | ||
setShowHelpCenter( false ); | ||
}, [ setShowHelpCenter ] ); | ||
// const currentRoute = useCurrentRoute(); | ||
|
||
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; |