Enabling reminder bar for both experiments and control

This commit is contained in:
Joel T 2022-04-27 13:58:14 -07:00
parent 27cecd9b83
commit 8e04383fb0
2 changed files with 18 additions and 8 deletions

View File

@ -95,21 +95,32 @@ export const Header = ( { sections, isEmbedded = false, query } ) => {
} }
}, [ isEmbedded, sections, siteTitle ] ); }, [ isEmbedded, sections, siteTitle ] );
const { hasTasksReminderFeature } = useSelect( ( select ) => { const { activeSetuplist } = useSelect( ( select ) => {
const taskLists = select( ONBOARDING_STORE_NAME ).getTaskLists(); const taskLists = select( ONBOARDING_STORE_NAME ).getTaskLists();
const visibleSetupList = taskLists
.filter( ( list ) => list.isVisible )
.filter( ( list ) =>
[
'setup_experiment_1',
'setup_experiment_2',
'setup',
].includes( list.id )
);
return { return {
hasTasksReminderFeature: taskLists.some( activeSetuplist: visibleSetupList.length
( list ) => list.id === 'setup_experiment_1' ? visibleSetupList[ 0 ].id
), : null,
}; };
} ); } );
return ( return (
<div className={ className } ref={ headerElement }> <div className={ className } ref={ headerElement }>
{ hasTasksReminderFeature && ( { activeSetuplist && (
<TasksReminderBar <TasksReminderBar
pageTitle={ pageTitle }
updateBodyMargin={ updateBodyMargin } updateBodyMargin={ updateBodyMargin }
taskListId={ activeSetuplist }
/> />
) } ) }
<div className="woocommerce-layout__header-wrapper"> <div className="woocommerce-layout__header-wrapper">

View File

@ -24,7 +24,6 @@ import './reminder-bar.scss';
type ReminderBarProps = { type ReminderBarProps = {
taskListId: string; taskListId: string;
pageTitle: string;
updateBodyMargin: () => void; updateBodyMargin: () => void;
}; };
@ -83,7 +82,7 @@ const ReminderText: React.FC< ReminderTextProps > = ( {
}; };
export const TasksReminderBar: React.FC< ReminderBarProps > = ( { export const TasksReminderBar: React.FC< ReminderBarProps > = ( {
taskListId = 'setup_experiment_1', taskListId,
updateBodyMargin, updateBodyMargin,
} ) => { } ) => {
const { updateOptions } = useDispatch( OPTIONS_STORE_NAME ); const { updateOptions } = useDispatch( OPTIONS_STORE_NAME );