Newer
Older

Planoetscher Daniel (Student Com20)
committed
import { Link } from 'react-router-dom';

Planoetscher Daniel (Student Com20)
committed
import AssigneeList from 'components/ui/AssigneeList';
import { Task as ITask } from 'adapters/task';
import { useEffect, useState } from 'react';
import { getUser, User } from 'adapters/user';
export interface TaskProps {
task: ITask;
color?: string;
subtitle?: string;
export default function Task({ task, color, subtitle }: TaskProps) {
const [assignees, setAssignees] = useState<User[]>([]);

Planoetscher Daniel (Student Com20)
committed
useEffect(() => {
task.assigned.forEach((assign) => {
getUser(assign.user).then((user) => setAssignees(state => [...state, user])).catch(() => {})
})
}, [task]);

Planoetscher Daniel (Student Com20)
committed
<Link to={'/tasks/' + task.id} className="task">
<div className={'indicator' + (color ? ' bg-gradient-' + color : '')}></div>

Planoetscher Daniel (Student Com20)
committed
<div className="main-info">
<div className="icon-container">

Planoetscher Daniel (Student Com20)
committed
</div>
<div className="text-container">
<h4>{task.name}</h4>
<div className="time">{subtitle}</div>

Planoetscher Daniel (Student Com20)
committed
</div>

Planoetscher Daniel (Student Com20)
committed
<div className="description-container">

Planoetscher Daniel (Student Com20)
committed
{task.text}
<AssigneeList assignees={assignees} max={3} />

Planoetscher Daniel (Student Com20)
committed
</Link>