From b914188754c8d26325ef977c57703033698d6174 Mon Sep 17 00:00:00 2001 From: CREDO23 Date: Thu, 21 Nov 2024 21:07:58 +0200 Subject: [PATCH] createw new project in add task or task detail page --- .../blocks/task-secondary-info.tsx | 263 ++++++++---------- apps/web/components/ui/svgs/project-icon.tsx | 12 +- apps/web/lib/features/task/task-status.tsx | 2 +- 3 files changed, 121 insertions(+), 156 deletions(-) diff --git a/apps/web/components/pages/task/details-section/blocks/task-secondary-info.tsx b/apps/web/components/pages/task/details-section/blocks/task-secondary-info.tsx index 959b2c4da..d527197b0 100644 --- a/apps/web/components/pages/task/details-section/blocks/task-secondary-info.tsx +++ b/apps/web/components/pages/task/details-section/blocks/task-secondary-info.tsx @@ -8,6 +8,7 @@ import { ActiveTaskSizesDropdown, ActiveTaskStatusDropdown, ActiveTaskVersionDropdown, + CreateTeamModal, EpicPropertiesDropdown as TaskEpicDropdown, TaskLabels, TaskStatus, @@ -21,11 +22,12 @@ import { Fragment, useCallback, useEffect, useMemo, useState } from 'react'; import { useAtomValue } from 'jotai'; import TaskRow from '../components/task-row'; import { useTranslations } from 'next-intl'; -import { ChevronDownIcon, Square4OutlineIcon } from 'assets/svg'; +import { AddIcon, ChevronDownIcon, Square4OutlineIcon, TrashIcon } from 'assets/svg'; import { Listbox, Transition } from '@headlessui/react'; import { clsxm } from '@/app/utils'; import { organizationProjectsState } from '@/app/stores/organization-projects'; import ProjectIcon from '@components/ui/svgs/project-icon'; +import { ScrollArea, ScrollBar } from '@components/ui/scroll-bar'; type StatusType = 'version' | 'epic' | 'status' | 'label' | 'size' | 'priority'; @@ -104,23 +106,6 @@ const TaskSecondaryInfo = () => { - {/* Epic */} - {task && task.issueType === 'Story' && ( - - { - onTaskSelect({ - id: d - } as ITeamTask); - }} - className="lg:min-w-[170px] text-black" - forDetails={true} - sidebarUI={true} - taskStatusClassName="text-[0.625rem] w-[7.6875rem] h-[2.35rem] max-w-[7.6875rem] rounded 3xl:text-xs" - defaultValue={task.parentId || ''} - /> - - )} {/* Epic */} {task && task.issueType === 'Story' && ( @@ -139,27 +124,8 @@ const TaskSecondaryInfo = () => { )} - {task && } {task && } - {/* Task Status */} - - - - - {/* Task Status */} { - {/* Task Labels */} - - - - {tags.length > 0 && ( - -
- {tags.map((tag, i) => { - return ( - - - - ); - })} -
-
- )} {/* Task Labels */} { {/* Task project */} {task && ( - + )} @@ -344,7 +282,7 @@ export default TaskSecondaryInfo; */ export function ProjectDropDown(props: ITaskProjectDropdownProps) { const { task, controlled = false, onChange, styles } = props; - + const { openModal, isOpen, closeModal } = useModal(); const organizationProjects = useAtomValue(organizationProjectsState); const { getOrganizationProjects } = useOrganizationProjects(); const { updateTask, updateLoading } = useTeamTasks(); @@ -395,96 +333,115 @@ export function ProjectDropDown(props: ITaskProjectDropdownProps) { }, [task, updateTask]); return ( -
- { - if (controlled && onChange) { - onChange(project); - } else { - handleUpdateProject(project); - } - - setSelected(project); - }} + <> +
- {({ open }) => { - return ( - <> - - {selected && ( -
- -
- )} - {updateLoading ? ( - - ) : ( -

- {selected?.name ?? 'Project'} -

- )} - { + if (controlled && onChange) { + onChange(project); + } else { + handleUpdateProject(project); + } + + setSelected(project); + }} + > + {({ open }) => { + return ( + <> + - - - - + {selected && ( +
+ +
+ )} + {updateLoading ? ( + + ) : ( +

+ {selected?.name ?? 'Project'} +

+ )} + - {organizationProjects.map((item, i) => { - return ( - -
  • - {item.name} -
  • -
    - ); - })} - {!controlled && ( - - )} -
    -
    -
    - - ); - }} - -
    + aria-hidden="true" + /> + + + + + + +
    + {organizationProjects.map((item, i) => { + return ( + +
  • + {' '} + {item.name} +
  • +
    + ); + })} + {!controlled && ( +
    + + +
    + )} +
    + +
    +
    +
    +
    + + ); + }} +
    +
    + {} + ); } diff --git a/apps/web/components/ui/svgs/project-icon.tsx b/apps/web/components/ui/svgs/project-icon.tsx index e15ec9d40..1512e0648 100644 --- a/apps/web/components/ui/svgs/project-icon.tsx +++ b/apps/web/components/ui/svgs/project-icon.tsx @@ -1,6 +1,14 @@ -export default function ProjectIcon() { +import { IIconProps } from '@/app/interfaces'; + +export default function ProjectIcon(props: Partial) { return ( - + ({ {items.map((item, i) => { const item_value = item?.value || item?.name;