File size: 913 Bytes
1e92f2d |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
import { useEffect } from 'react';
import { useDispatch, useSelector } from 'react-redux';
import AsyncLoad from 'calypso/components/async-load';
import { resetGuidedToursHistory } from 'calypso/state/guided-tours/actions';
import { getGuidedTourState } from 'calypso/state/guided-tours/selectors';
import getInitialQueryArguments from 'calypso/state/selectors/get-initial-query-arguments';
function GuidedTours() {
const dispatch = useDispatch();
const tourState = useSelector( getGuidedTourState );
const shouldShow = tourState && tourState.shouldShow;
const requestedTour = useSelector( getInitialQueryArguments )?.tour;
useEffect( () => {
if ( requestedTour === 'reset' ) {
dispatch( resetGuidedToursHistory() );
}
}, [ dispatch, requestedTour ] );
if ( ! shouldShow ) {
return null;
}
return <AsyncLoad require="calypso/layout/guided-tours/component" />;
}
export default GuidedTours;
|