From 2fde536c652f89cd9bfac3c5ed9cb2a927f25bd1 Mon Sep 17 00:00:00 2001 From: Maksim Sviridov Date: Wed, 31 Jul 2024 12:35:18 +0300 Subject: [PATCH] feat(GoalSidebar): clone goal --- .../GoalCreateForm/GoalCreateForm.tsx | 32 +++++++++++++------ .../GoalSidebar/GoalSidebar.i18n/en.json | 3 +- .../GoalSidebar/GoalSidebar.i18n/ru.json | 3 +- src/components/GoalSidebar/GoalSidebar.tsx | 8 ++++- src/utils/dispatchModal.ts | 7 ++-- 5 files changed, 37 insertions(+), 16 deletions(-) diff --git a/src/components/GoalCreateForm/GoalCreateForm.tsx b/src/components/GoalCreateForm/GoalCreateForm.tsx index 8677be68c..d4cb39a56 100644 --- a/src/components/GoalCreateForm/GoalCreateForm.tsx +++ b/src/components/GoalCreateForm/GoalCreateForm.tsx @@ -10,7 +10,7 @@ import { dispatchModalEvent, ModalEvent } from '../../utils/dispatchModal'; import { GoalForm } from '../GoalForm/GoalForm'; import { trpc } from '../../utils/trpcClient'; import { GoalCommon, goalCommonSchema } from '../../schema/goal'; -import { ActivityByIdReturnType, GoalCreateReturnType } from '../../../trpc/inferredTypes'; +import { ActivityByIdReturnType, GoalByIdReturnType, GoalCreateReturnType } from '../../../trpc/inferredTypes'; import { useGoalResource } from '../../hooks/useGoalResource'; import { combobox, @@ -28,13 +28,25 @@ import { Dropdown, DropdownPanel, DropdownTrigger } from '../Dropdown/Dropdown'; import { tr } from './GoalCreateForm.i18n'; import s from './GoalCreateForm.module.css'; -interface GoalCreateFormProps { - title?: string; +interface GoalCreateFormProps + extends Partial, 'priority' | 'description' | 'title' | 'personal' | 'tags'>> { onGoalCreate?: (val: GoalCreateReturnType) => void; - personal?: boolean; + project?: { + id: string; + title: string; + flowId: string; + } | null; } -const GoalCreateForm: React.FC = ({ title, onGoalCreate, personal }) => { +const GoalCreateForm: React.FC = ({ + title, + onGoalCreate, + personal, + project, + description, + priority, + tags, +}) => { const router = useRouter(); const { user } = usePageContext(); const [goalCreateFormActionCache, setGoalCreateFormActionCache] = useLocalStorage('goalCreateFormAction'); @@ -139,12 +151,14 @@ const GoalCreateForm: React.FC = ({ title, onGoalCreate, pe