From 2569b56f932f51d02867f362ed941095e2b1550f Mon Sep 17 00:00:00 2001 From: anishali2 Date: Sun, 11 Feb 2024 22:19:46 +0500 Subject: [PATCH 1/5] kanban task dropdown added --- apps/web/lib/components/kanban-card.tsx | 184 ++++++++++++++++++------ 1 file changed, 139 insertions(+), 45 deletions(-) diff --git a/apps/web/lib/components/kanban-card.tsx b/apps/web/lib/components/kanban-card.tsx index f97d6cc83..001136e04 100644 --- a/apps/web/lib/components/kanban-card.tsx +++ b/apps/web/lib/components/kanban-card.tsx @@ -1,14 +1,22 @@ -import VerticalThreeDot from '@components/ui/svgs/vertical-three-dot'; import { DraggableProvided } from 'react-beautiful-dnd'; -import CircularProgress from '@components/ui/svgs/circular-progress'; import PriorityIcon from '@components/ui/svgs/priority-icon'; -import { Tag } from '@app/interfaces'; -import { useTimerView } from '@app/hooks'; +import { ITeamTask, Tag } from '@app/interfaces'; +import { + useAuthenticateUser, + useCollaborative, + useOrganizationTeams, + useTMCardTaskEdit, + useTeamMemberCard, + useTimerView +} from '@app/hooks'; +import ImageComponent, { ImageOverlapperProps } from './image-overlapper'; +import { TaskInput, TaskIssueStatus } from 'lib/features'; +import Link from 'next/link'; +import CircularProgress from '@components/ui/svgs/circular-progress'; +import { HorizontalSeparator } from './separator'; import { pad } from '@app/helpers'; import { TaskStatus } from '@app/constants'; -import { TaskIssueStatus } from 'lib/features'; -import Link from 'next/link'; -import ImageComponent, { ImageOverlapperProps } from './image-overlapper'; +import { UserTeamCardMenu } from 'lib/features/team/user-team-card/user-team-card-menu'; function getStyle(provided: DraggableProvided, style: any) { if (!style) { @@ -86,38 +94,42 @@ function Priority({ level }: { level: number }) { ); } - +type ItemProps = { + item: ITeamTask; + isDragging: boolean; + isGroupedOver: boolean; + provided: DraggableProvided; + style: any; + isClone: boolean; + index: number; +}; /** * card that represent each task * @param props * @returns */ -export default function Item(props: any) { +export default function Item(props: ItemProps) { const { item, isDragging, isGroupedOver, provided, style, isClone, index } = props; const { hours, minutes, seconds } = useTimerView(); + const { activeTeam } = useOrganizationTeams(); + const { user } = useAuthenticateUser(); - const taskAssignee: ImageOverlapperProps[] = []; + const members = activeTeam?.members || []; + const currentUser = members.find((m) => m.employee.userId === user?.id); - item.members.map((member: any) => { - taskAssignee.push({ + const memberInfo = useTeamMemberCard(currentUser); + const taskEdition = useTMCardTaskEdit(memberInfo.memberTask); + const taskAssignee: ImageOverlapperProps[] = item.members.map((member: any) => { + return { id: member.user.id, url: member.user.imageUrl, alt: member.user.firstName - }); + }; }); + const { collaborativeSelect } = useCollaborative(memberInfo.memberUser); - // const handleTime = () => { - // if (item.status === TaskStatus.INPROGRESS) { - // startTimer(); - // } else { - // stopTimer(); - // } - // }; - - // useEffect(() => { - // handleTime(); - // }, [timerStatus?.running]); + const menu = <>{!collaborativeSelect && }; return (
-
-
- {item.tags && } +
+
+ + { + + } + + {menu} +
+
+
+ {!taskEdition.editMode ? ( + <> + + #{item.number} + + {item.title} + + + ) : ( +
+ { + console.log(e); + }} + onEnterKey={() => { + taskEdition.setEditMode(false); + }} + /> +
+ )} +
+ +
+
+ +
+
+
+ {item.status === TaskStatus.INPROGRESS ? ( +
+ Live: +

+ {pad(hours)}:{pad(minutes)}:{pad(seconds)}{' '} +

+
+ ) : ( +
+ Worked: +

+ {pad(hours)}:{pad(minutes)}:{pad(seconds)}{' '} +

+
+ )} +
+ + {/* {item. && ( +
+
+
+ )} */} +
+ {/*
+ {item.tags && } */} -
- */} + {/* + /> */} - #{item.number} - #{item.number} */} + {/* {item.title} - - -
-
-
- + */} + {/* */} + {/*
*/} + {/*
*/} + {/*
*/} + {/* */} - -
+ {/* */} + {/*
*/}
-
+ {/*
{item.status === TaskStatus.INPROGRESS ? (
Live: @@ -182,13 +276,13 @@ export default function Item(props: any) {

)} - -
- {item.hasComment && ( +
*/} + {/* */} + {/* {item.hasComment && (
- )} + )} */}
); } From be858e83826ec5e10930f9639cbdf29fb0569bab Mon Sep 17 00:00:00 2001 From: anishali2 Date: Sun, 11 Feb 2024 22:21:57 +0500 Subject: [PATCH 2/5] kanban task dropdown added --- apps/web/lib/components/kanban-card.tsx | 98 +++++-------------------- 1 file changed, 19 insertions(+), 79 deletions(-) diff --git a/apps/web/lib/components/kanban-card.tsx b/apps/web/lib/components/kanban-card.tsx index 001136e04..abe111742 100644 --- a/apps/web/lib/components/kanban-card.tsx +++ b/apps/web/lib/components/kanban-card.tsx @@ -29,23 +29,23 @@ function getStyle(provided: DraggableProvided, style: any) { }; } -function setCommentIconColor(commentType: 'tagged' | 'untagged') { - let style; - - if (commentType === 'tagged') { - style = { - backgroundColor: '#D95F5F' - }; - } else if (commentType === 'untagged') { - style = { - backgroundColor: '#27AE60' - }; - } else { - style = {}; - } - - return style; -} +// function setCommentIconColor(commentType: 'tagged' | 'untagged') { +// let style; + +// if (commentType === 'tagged') { +// style = { +// backgroundColor: '#D95F5F' +// }; +// } else if (commentType === 'untagged') { +// style = { +// backgroundColor: '#27AE60' +// }; +// } else { +// style = {}; +// } + +// return style; +// } function TagCard({ title, backgroundColor, color }: { title: string; backgroundColor: string; color: string }) { return ( @@ -149,16 +149,7 @@ export default function Item(props: ItemProps) { >
- - { - - } - + {} {menu}
@@ -177,6 +168,7 @@ export default function Item(props: ItemProps) { > {item.title} + ) : (
@@ -230,59 +222,7 @@ export default function Item(props: ItemProps) {
)} */}
- {/*
- {item.tags && } */} - - {/*
*/} - {/* */} - - {/* #{item.number} */} - {/* - {item.title} - */} - {/* */} - {/*
*/} - {/*
*/} - {/*
*/} - {/* */} - - {/* */} - {/*
*/}
- {/*
- {item.status === TaskStatus.INPROGRESS ? ( -
- Live: -

- {pad(hours)}:{pad(minutes)}:{pad(seconds)}{' '} -

-
- ) : ( -
- Worked: -

- {pad(hours)}:{pad(minutes)}:{pad(seconds)}{' '} -

-
- )} -
*/} - {/* */} - {/* {item.hasComment && ( -
-
-
- )} */} ); } From e43e795bfbb1e384d5c10cfa3af3088cc85441e6 Mon Sep 17 00:00:00 2001 From: anishali2 Date: Mon, 12 Feb 2024 21:28:02 +0500 Subject: [PATCH 3/5] typescript issue fix --- apps/web/lib/components/Kanban.tsx | 2 ++ apps/web/lib/components/kanban-card.tsx | 11 ++++------- 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/apps/web/lib/components/Kanban.tsx b/apps/web/lib/components/Kanban.tsx index cd36fea9c..14255bc60 100644 --- a/apps/web/lib/components/Kanban.tsx +++ b/apps/web/lib/components/Kanban.tsx @@ -67,6 +67,8 @@ function InnerItemList({ items, title }: { title: string; items: ITeamTask[]; dr {(dragProvided: DraggableProvided, dragSnapshot: DraggableStateSnapshot) => ( {!collaborativeSelect && }; return ( -
@@ -223,6 +220,6 @@ export default function Item(props: ItemProps) { )} */}
-
+ ); } From 2864348641bc04698a1749dbc40205e2e3d6cd6a Mon Sep 17 00:00:00 2001 From: anishali2 Date: Mon, 12 Feb 2024 21:35:39 +0500 Subject: [PATCH 4/5] typescript issue fix --- apps/web/lib/components/kanban-card.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/web/lib/components/kanban-card.tsx b/apps/web/lib/components/kanban-card.tsx index 02c6c9a86..f7588a04e 100644 --- a/apps/web/lib/components/kanban-card.tsx +++ b/apps/web/lib/components/kanban-card.tsx @@ -109,7 +109,7 @@ type ItemProps = { * @returns */ export default function Item(props: ItemProps) { - const { item, isDragging, isGroupedOver, provided, style, isClone, index } = props; + const { item, isDragging, provided, style, index } = props; const { hours, minutes, seconds } = useTimerView(); const { activeTeam } = useOrganizationTeams(); From 59ab3d28a1362bfe3a7fcd7bfb6d5c1ed78a348c Mon Sep 17 00:00:00 2001 From: anishali2 Date: Tue, 13 Feb 2024 02:31:36 +0500 Subject: [PATCH 5/5] added the removed code --- apps/web/lib/components/kanban-card.tsx | 36 ++++++++++++------------- 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/apps/web/lib/components/kanban-card.tsx b/apps/web/lib/components/kanban-card.tsx index f7588a04e..da534aa4f 100644 --- a/apps/web/lib/components/kanban-card.tsx +++ b/apps/web/lib/components/kanban-card.tsx @@ -29,23 +29,23 @@ function getStyle(provided: DraggableProvided, style: any) { }; } -// function setCommentIconColor(commentType: 'tagged' | 'untagged') { -// let style; +function setCommentIconColor(commentType: 'tagged' | 'untagged') { + let style; -// if (commentType === 'tagged') { -// style = { -// backgroundColor: '#D95F5F' -// }; -// } else if (commentType === 'untagged') { -// style = { -// backgroundColor: '#27AE60' -// }; -// } else { -// style = {}; -// } + if (commentType === 'tagged') { + style = { + backgroundColor: '#D95F5F' + }; + } else if (commentType === 'untagged') { + style = { + backgroundColor: '#27AE60' + }; + } else { + style = {}; + } -// return style; -// } + return style; +} function TagCard({ title, backgroundColor, color }: { title: string; backgroundColor: string; color: string }) { return ( @@ -210,14 +210,14 @@ export default function Item(props: ItemProps) { )} - {/* {item. && ( + {item.issueType && (
- )} */} + )}