Skip to content

Commit

Permalink
Enable new block badge globally
Browse files Browse the repository at this point in the history
We decided to enable the new block badge for all users.
  • Loading branch information
dcalhoun committed Sep 29, 2021
1 parent fdf9057 commit 936509b
Showing 1 changed file with 14 additions and 21 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,29 +10,22 @@ import { setBlockTypeImpressions } from '@wordpress/react-native-bridge';
import { store as blockEditorStore } from '../../../store';

function useBlockTypeImpressions( blockTypes ) {
const { blockTypeImpressions, enableEditorOnboarding } = useSelect(
( select ) => {
const { getSettings: getBlockEditorSettings } = select(
blockEditorStore
);
const { editorOnboarding, impressions } = getBlockEditorSettings();

return {
blockTypeImpressions: impressions,
enableEditorOnboarding: editorOnboarding,
};
},
[]
);
const { blockTypeImpressions } = useSelect( ( select ) => {
const { getSettings: getBlockEditorSettings } = select(
blockEditorStore
);
const { impressions } = getBlockEditorSettings();

return {
blockTypeImpressions: impressions,
};
}, [] );
const { updateSettings } = useDispatch( blockEditorStore );

const items = enableEditorOnboarding
? blockTypes.map( ( blockType ) => ( {
...blockType,
isNew: blockTypeImpressions[ blockType.name ] > 0,
} ) )
: blockTypes;

const items = blockTypes.map( ( blockType ) => ( {
...blockType,
isNew: blockTypeImpressions[ blockType.name ] > 0,
} ) );
const trackBlockTypeSelected = ( { name } ) => {
if ( blockTypeImpressions[ name ] > 0 ) {
const updatedBlockTypeImpressions = {
Expand Down

0 comments on commit 936509b

Please sign in to comment.