Skip to content

Commit

Permalink
Merge pull request #3357 from ever-co/3100-feature-task--add-project-…
Browse files Browse the repository at this point in the history
…information-in-dashboard-task-that-is-working-on-for-each-user

[Feature]  Add project information in task card
  • Loading branch information
evereq authored Nov 21, 2024
2 parents 681714b + 360c0bb commit 63381f1
Showing 1 changed file with 22 additions and 6 deletions.
28 changes: 22 additions & 6 deletions apps/web/lib/features/task/task-all-status-type.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
'use client';

import { useCustomEmblaCarousel, useDailyPlan, useSyncRef } from '@app/hooks';
import { ITeamTask, Nullable } from '@app/interfaces';
import { useCustomEmblaCarousel, useDailyPlan, useOrganizationProjects, useSyncRef } from '@app/hooks';
import { IProject, ITeamTask, Nullable } from '@app/interfaces';
import { RoundedButton } from 'lib/components';
import { useEffect, useMemo } from 'react';
import { useEffect, useMemo, useState } from 'react';
import {
TaskStatus,
useTaskLabelsValue,
Expand All @@ -15,6 +15,7 @@ import { clsxm } from '@app/utils';
import { planBadgeContent, planBadgeContPast } from '@app/helpers';
import { CalendarIcon } from '@radix-ui/react-icons';
import { FilterTabs } from '../user-profile-plans';
import ProjectIcon from '@components/ui/svgs/project-icon';

export function TaskAllStatusTypes({
task,
Expand All @@ -35,6 +36,8 @@ export function TaskAllStatusTypes({
const taskSizes = useTaskSizesValue();
const taskLabels = useTaskLabelsValue();
const taskStatus = useTaskStatusValue();
const { getOrganizationProject } = useOrganizationProjects();
const [project, setProject] = useState<IProject>();

const { dailyPlan } = useDailyPlan();

Expand Down Expand Up @@ -68,6 +71,17 @@ export function TaskAllStatusTypes({

const taskId = task ? planBadgeContPast(dailyPlan.items, task.id) : '';

useEffect(() => {
const fetchProject = async () => {
if (task?.projectId) {
const res = await getOrganizationProject(task.projectId);
setProject(res?.data);
}
};

fetchProject();
}, [getOrganizationProject, task?.projectId]);

return (
<div className="relative w-full h-full flex flex-col justify-center">
<div ref={viewportRef} className="overflow-hidden w-full relative">
Expand All @@ -81,7 +95,6 @@ export function TaskAllStatusTypes({
titleClassName={'text-[0.625rem] font-[500]'}
/>
)}

{task?.priority && (
<TaskStatus
{...taskPriorities[task?.priority || 'Low']}
Expand All @@ -91,7 +104,6 @@ export function TaskAllStatusTypes({
titleClassName={'text-[0.625rem] font-[500]'}
/>
)}

{task?.size && !toBlockCard && (
<TaskStatus
{...taskSizes[task?.size || 'Medium']}
Expand All @@ -101,7 +113,11 @@ export function TaskAllStatusTypes({
titleClassName={'text-[0.625rem] font-[500]'}
/>
)}

{project && (
<div className="flex items-center justify-center gap-1 h-full px-2 bg-slate-200">
<ProjectIcon /> <span className=" text-xs truncate">{project.name}</span>
</div>
)}
{planBadgeContent(dailyPlan.items, task?.id ?? '', tab) && (
<div
className={clsxm(
Expand Down

0 comments on commit 63381f1

Please sign in to comment.