Skip to content

Commit

Permalink
Fix welcome guide focus and e2e tests
Browse files Browse the repository at this point in the history
  • Loading branch information
youknowriad committed Jun 6, 2024
1 parent 8b47ac7 commit 5707016
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 16 deletions.
2 changes: 1 addition & 1 deletion packages/edit-post/src/components/layout/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -321,6 +321,7 @@ function Layout( {
<SlotFillProvider>
<ErrorBoundary>
<CommandMenu />
<WelcomeGuide postType={ currentPost.postType } />
<Editor
settings={ editorSettings }
initialEdits={ initialEdits }
Expand Down Expand Up @@ -359,7 +360,6 @@ function Layout( {
<EditPostKeyboardShortcuts />
<EditorKeyboardShortcutsRegister />
<BlockKeyboardShortcuts />
<WelcomeGuide />
<InitPatternModal />
<PluginArea onError={ onPluginAreaError } />
<PostEditorMoreMenu />
Expand Down
30 changes: 15 additions & 15 deletions packages/edit-post/src/components/welcome-guide/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
* WordPress dependencies
*/
import { useSelect } from '@wordpress/data';
import { store as editorStore } from '@wordpress/editor';

/**
* Internal dependencies
Expand All @@ -11,21 +10,22 @@ import WelcomeGuideDefault from './default';
import WelcomeGuideTemplate from './template';
import { store as editPostStore } from '../../store';

export default function WelcomeGuide() {
const { isActive, isEditingTemplate } = useSelect( ( select ) => {
const { isFeatureActive } = select( editPostStore );
const { getCurrentPostType } = select( editorStore );
const _isEditingTemplate = getCurrentPostType() === 'wp_template';
export default function WelcomeGuide( { postType } ) {
const { isActive, isEditingTemplate } = useSelect(
( select ) => {
const { isFeatureActive } = select( editPostStore );
const _isEditingTemplate = postType === 'wp_template';
const feature = _isEditingTemplate
? 'welcomeGuideTemplate'
: 'welcomeGuide';

const feature = _isEditingTemplate
? 'welcomeGuideTemplate'
: 'welcomeGuide';

return {
isActive: isFeatureActive( feature ),
isEditingTemplate: _isEditingTemplate,
};
}, [] );
return {
isActive: isFeatureActive( feature ),
isEditingTemplate: _isEditingTemplate,
};
},
[ postType ]
);

if ( ! isActive ) {
return null;
Expand Down

0 comments on commit 5707016

Please sign in to comment.