Skip to content

Commit

Permalink
Add planner page breadcrumb
Browse files Browse the repository at this point in the history
  • Loading branch information
anarute committed Jan 16, 2024
1 parent f1c8f66 commit 542de56
Showing 1 changed file with 43 additions and 0 deletions.
43 changes: 43 additions & 0 deletions frontend/src/app/planner/[slug]/page.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
import { Breadcrumbs, Chip, Typography } from '@mui/joy'
import Link from 'next/link'

import { getProjectAllocation } from '@/infra/projectAllocation/getProjectAllocation'
import { getProjects } from '@/infra/project/getProjects'

import { serverFetch } from '@/infra/lib/serverFetch'

const getPageData = async (id: string) => {
const apiClient = await serverFetch()
return await Promise.all([getProjectAllocation(apiClient, id), getProjects(apiClient)])
}

export default async function Page({ params }: { params: { slug: string } }) {
const [projectAllocations, projects] = await getPageData(params.slug)

const project = projects.find((p) => p.id === Number(params.slug))
const projectStats = { plannedHours: projectAllocations?.plannedHours }

return (
<>
<Breadcrumbs aria-label="breadcrumbs">
<Link color="neutral" href="#">
Projects
</Link>
<Link color="neutral" href="#">
<Typography
level="body-lg"
endDecorator={
<Chip component="span" size="sm" sx={{ textDecoration: 'underline' }}>
<Link href="/planner">Switch</Link>
</Chip>
}
justifyContent="center"
>
{project?.description}
</Typography>
</Link>
<Typography>Resource Planner</Typography>
</Breadcrumbs>
</>
)
}

0 comments on commit 542de56

Please sign in to comment.