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 ] );
const { hasTasksReminderFeature } = useSelect( ( select ) => {
const { activeSetuplist } = useSelect( ( select ) => {
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 {
hasTasksReminderFeature: taskLists.some(
( list ) => list.id === 'setup_experiment_1'
),
activeSetuplist: visibleSetupList.length
? visibleSetupList[ 0 ].id
: null,
};
} );
return (
<div className={ className } ref={ headerElement }>
{ hasTasksReminderFeature && (
{ activeSetuplist && (
<TasksReminderBar
pageTitle={ pageTitle }
updateBodyMargin={ updateBodyMargin }
taskListId={ activeSetuplist }
/>
) }
<div className="woocommerce-layout__header-wrapper">

View File

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