@@ -9,8 +9,8 @@ import { useTranslation } from 'react-i18next';
99import { useParams } from 'react-router-dom' ;
1010import { ReactComponent as SaveTemplateIcon } from 'src/assets/icons/template.svg' ;
1111import { Divider } from 'src/common/components/divider' ;
12+ import { usePlan , usePlanIsDraft } from '../../../hooks/usePlan' ;
1213import { usePlanContext } from '../context/planContext' ;
13- import { usePlan } from '../../../hooks/usePlan' ;
1414
1515const OptionalTooltip = ( {
1616 children,
@@ -36,7 +36,8 @@ const IconButtonMenu = () => {
3636
3737 const { setIsSaveTemplateModalOpen, setIsDeleteModalOpen } = usePlanContext ( ) ;
3838 const { planId } = useParams ( ) ;
39- const { plan, planComposedStatus } = usePlan ( planId ) ;
39+ const { planComposedStatus } = usePlan ( planId ) ;
40+ const isDraft = usePlanIsDraft ( planId ) ;
4041
4142 const handleMenuClick = ( value ?: string ) => {
4243 if ( value === 'delete' ) {
@@ -74,14 +75,14 @@ const IconButtonMenu = () => {
7475 </ >
7576 ) }
7677 < OptionalTooltip
77- show = { plan ?. status !== 'draft' }
78+ show = { ! isDraft }
7879 content = { t ( '__PLAN_DELETE_PLAN_TOOLTIP' ) }
7980 >
8081 < ButtonMenu . Item
8182 data-qa = "delete-action-item"
8283 type = "danger"
8384 value = "delete"
84- isDisabled = { plan ?. status !== 'draft' }
85+ isDisabled = { ! isDraft }
8586 icon = { < TrashIcon /> }
8687 >
8788 { t ( '__PLAN_DELETE_PLAN_CTA' ) }
0 commit comments