From b5e00cc97ca5cfa1116d8eac8487b19139447995 Mon Sep 17 00:00:00 2001 From: Maksim Sviridov Date: Wed, 19 Jul 2023 10:47:55 +0300 Subject: [PATCH] fix(GoalCriteria): hide action dropdown --- src/components/GoalCriteria/GoalCriteria.tsx | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/src/components/GoalCriteria/GoalCriteria.tsx b/src/components/GoalCriteria/GoalCriteria.tsx index f3ac351d2..36baf2b67 100644 --- a/src/components/GoalCriteria/GoalCriteria.tsx +++ b/src/components/GoalCriteria/GoalCriteria.tsx @@ -246,7 +246,7 @@ const criteriaGuard = (props: GoalCriteriaItemProps): props is CriteriaAsGoalPro type CriteriaActionItem = { label: string; - onClick: () => void; + handler: () => void; color?: string; icon: React.ReactNode; }; @@ -293,7 +293,7 @@ const GoalCriteriaItem: React.FC = memo((props) => { actions.push({ label: tr('Create as goal'), icon: , - onClick: onConvertToGoal, + handler: onConvertToGoal, }); } @@ -301,12 +301,16 @@ const GoalCriteriaItem: React.FC = memo((props) => { label: tr('Delete'), icon: , color: danger0, - onClick: onRemove, + handler: onRemove, }); return actions; }, [canEdit, onRemove, props, onConvertToGoal]); + const handleChange = useCallback((val: CriteriaActionItem) => { + val.handler(); + }, []); + return ( {criteriaGuard(props) ? ( @@ -342,12 +346,13 @@ const GoalCriteriaItem: React.FC = memo((props) => { {nullable(availableActions, (actions) => ( } items={actions} renderItem={(props) => (