diff --git a/src/components/GoalPreview/GoalPreview.tsx b/src/components/GoalPreview/GoalPreview.tsx index 4177f837c..1fa8de682 100644 --- a/src/components/GoalPreview/GoalPreview.tsx +++ b/src/components/GoalPreview/GoalPreview.tsx @@ -1,4 +1,4 @@ -import React, { FC, useCallback, useMemo, useRef, useState } from 'react'; +import React, { FC, useCallback, useMemo, useRef } from 'react'; import dynamic from 'next/dynamic'; import styled from 'styled-components'; import { danger0, gapM, gapS, gray7 } from '@taskany/colors'; @@ -106,22 +106,11 @@ export const GoalPreviewModal: React.FC = ({ shortId, goal, de return utils.goal.getById.invalidate(shortId); }, [utils.goal.getById, shortId]); - const [goalEditModalVisible, setGoalEditModalVisible] = useState(false); - const onGoalEdit = useCallback(() => { - setGoalEditModalVisible(false); - + dispatchModalEvent(ModalEvent.GoalEditModal)(); invalidateFn(); }, [invalidateFn]); - const onGoalEditModalShow = useCallback(() => { - setGoalEditModalVisible(true); - }, []); - - const onGoalEditModalClose = useCallback(() => { - setGoalEditModalVisible(false); - }, []); - const stateChangeMutations = trpc.goal.switchState.useMutation(); const onGoalStateChange = useCallback( async (nextState: GoalStateChangeSchema['state']) => { @@ -138,7 +127,6 @@ export const GoalPreviewModal: React.FC = ({ shortId, goal, de ); const onPreviewClose = useCallback(() => { - setGoalEditModalVisible(false); onClose?.(); }, [onClose]); @@ -404,13 +392,7 @@ export const GoalPreviewModal: React.FC = ({ shortId, goal, de {nullable(goal, (g) => nullable(g._isEditable, () => ( <> - +