diff --git a/apps/web/lib/components/kanban-card.tsx b/apps/web/lib/components/kanban-card.tsx index ff327dd46..608563f4d 100644 --- a/apps/web/lib/components/kanban-card.tsx +++ b/apps/web/lib/components/kanban-card.tsx @@ -1,247 +1,208 @@ import Image from 'next/image'; -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 { pad } from "@app/helpers"; -import { TaskStatus } from "@app/constants"; -import { useEffect } from "react"; -import { TaskIssueStatus } from "lib/features"; +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 { pad } from '@app/helpers'; +import { TaskStatus } from '@app/constants'; +import { TaskIssueStatus } from 'lib/features'; function getStyle(provided: DraggableProvided, style: any) { - if (!style) { - return provided.draggableProps.style; - } - - return { - ...provided.draggableProps.style, - ...style, - }; + if (!style) { + return provided.draggableProps.style; + } + + return { + ...provided.draggableProps.style, + ...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 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 ( - <> -
- -

{title}

-
- - ) +function TagCard({ title, backgroundColor, color }: { title: string; backgroundColor: string; color: string }) { + return ( + <> +
+

+ {title} +

+
+ + ); } -function TagList({tags}: { - tags: Tag[] -}){ - return ( - <> -
- {tags.map((tag: Tag, index: number)=> { - return ( - - ) - })} -
- - ) +function TagList({ tags }: { tags: Tag[] }) { + return ( + <> +
+ {tags.map((tag: Tag, index: number) => { + return ; + })} +
+ + ); } - export const stackImages = (index: number, length: number) => { - const imageRadius = 20; - - const total_length = ((length+1) * imageRadius); - - return { - zIndex: (index+1).toString(), - right: `calc(${total_length -(imageRadius * (index + 2))}px)` - } -} - -function Priority({ - level -}: { - level: number -}) { - - const numberArray = Array.from({ length: level }, (_, index) => index + 1); - - return( - <> -
- {numberArray.map((item: any, index: number)=> { - return ( - - ) - })} -
- - ) + const imageRadius = 20; + + const total_length = (length + 1) * imageRadius; + + return { + zIndex: (index + 1).toString(), + right: `calc(${total_length - imageRadius * (index + 2)}px)` + }; +}; + +function Priority({ level }: { level: number }) { + const numberArray = Array.from({ length: level }, (_, index) => index + 1); + + return ( + <> +
+ {numberArray.map((item: any, index: number) => { + return ; + })} +
+ + ); } /** * card that represent each task - * @param props - * @returns + * @param props + * @returns */ -export default function Item(props: any) { - - const { - item, - isDragging, - isGroupedOver, - provided, - style, - isClone, - index, - } = props; - - const { - hours, - minutes, - seconds, - startTimer, - stopTimer, - timerStatus - } = useTimerView(); - - const handleTime = ()=>{ - if(item.status === TaskStatus.INPROGRESS){ - startTimer() - } else { - stopTimer() - } - - } - - useEffect(()=>{ - handleTime() - },[timerStatus?.running]) - - return ( -
-
-
- {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.members.map((option: any, index: number)=> { - return ( -
- {`${option.user.firstName} -
- ) - })} -
-
-
- {item.hasComment && - (
-
-
-
) - } -
- ); -} \ No newline at end of file +export default function Item(props: any) { + const { item, isDragging, isGroupedOver, provided, style, isClone, index } = props; + + const { hours, minutes, seconds } = useTimerView(); + + // const handleTime = () => { + // if (item.status === TaskStatus.INPROGRESS) { + // startTimer(); + // } else { + // stopTimer(); + // } + // }; + + // useEffect(() => { + // handleTime(); + // }, [timerStatus?.running]); + + return ( +
+
+
+ {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.members.map((option: any, index: number) => { + return ( +
+ {`${option.user.firstName} +
+ ); + })} +
+
+
+ {item.hasComment && ( +
+
+
+ )} +
+ ); +}