Newer
Older

Planoetscher Daniel (Student Com20)
committed
import './project-details.scss';
import DetailGrid from 'components/layout/DetailGrid';
import BarChart from 'components/graphs/BarChart';
import ButtonLink from 'components/navigation/ButtonLink';
import { Project } from 'adapters/project';
import { useEffect, useState } from 'react';
import { getTeam } from 'adapters/team';
interface Props {
project: Project
}
export default function ProjectDetails({ project }: Props) {
const [teams, setTeams] = useState<string[]>([]);
useEffect(() => {
project.teams.forEach(teamId => {
getTeam(teamId).then((team) => setTeams(prev => [...prev, team.name]));
});

Planoetscher Daniel (Student Com20)
committed

Planoetscher Daniel (Student Com20)
committed
icon: 'group',
title: 'Teams',
label: teams.join(', ')

Planoetscher Daniel (Student Com20)
committed
}];
if (project.deadline) {
details.push({
icon: 'warning',
title: 'Deadline',
label: project.deadline?.getMonth().toString() ?? ''
});
}

Planoetscher Daniel (Student Com20)
committed
const data = [
{
label: 'Mon',
value: 50
},
{
label: 'Tue',
value: 20
}
]
return (
<section className="project-details">
<DetailGrid details={details} />
<BarChart data={data} />
<ButtonLink routing href={`/projects/${project.id}/edit`} className="expanded">

Planoetscher Daniel (Student Com20)
committed
Edit
</ButtonLink>
</section>
)
}