Skip to content

Commit

Permalink
feat: add leadtime charts to manager dashboard
Browse files Browse the repository at this point in the history
  • Loading branch information
lhguerra committed Dec 9, 2024
1 parent 255e509 commit 2baaae2
Show file tree
Hide file tree
Showing 17 changed files with 453 additions and 376 deletions.
22 changes: 13 additions & 9 deletions app/spa/src/components/Projects/ProjectChartsTable.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import { useState } from "react"
import {
Backdrop,
Box,
CircularProgress,
Grid,
Link,
Paper,
Expand All @@ -15,7 +17,6 @@ import {
import { gql, useQuery } from "@apollo/client"
import { useTranslation } from "react-i18next"
import { useParams } from "react-router-dom"
import { Backdrop, CircularProgress } from "@mui/material"
import { formatDate, secondsToDays } from "../../lib/date"
import { DemandsList } from "../../modules/demand/demand.types"
import { Project } from "../../modules/project/project.types"
Expand Down Expand Up @@ -192,7 +193,7 @@ const ProjectChartsTable = () => {
<Cell>{t("details.start")}</Cell>
<Cell align="right">
{formatDate({
date: project.startDate,
date: project.startDate || "",
format: "dd/MM/yyyy",
})}
</Cell>
Expand All @@ -202,7 +203,10 @@ const ProjectChartsTable = () => {
<Box component="span">{t("details.end")}</Box>
</Cell>
<Cell align="right">
{formatDate({ date: project.endDate, format: "dd/MM/yyyy" })}
{formatDate({
date: project.endDate || "",
format: "dd/MM/yyyy",
})}
</Cell>
</Row>
<Row>
Expand Down Expand Up @@ -279,7 +283,7 @@ const ProjectChartsTable = () => {
})}
sx={{ color: "info.dark", textDecoration: "none" }}
>
{project.upstreamDemands.length}
{project.upstreamDemands?.length}
</Link>
</Cell>
</Row>
Expand Down Expand Up @@ -313,7 +317,7 @@ const ProjectChartsTable = () => {
})}
sx={{ color: "info.dark", textDecoration: "none" }}
>
{project.discardedDemands.length}
{project.discardedDemands?.length}
</Link>
</Cell>
</Row>
Expand All @@ -328,7 +332,7 @@ const ProjectChartsTable = () => {
})}
sx={{ color: "info.dark", textDecoration: "none" }}
>
{project.unscoredDemands.length}
{project.unscoredDemands?.length}
</Link>
</Cell>
</Row>
Expand All @@ -339,18 +343,18 @@ const ProjectChartsTable = () => {
href={`/companies/${companySlug}/demand_blocks`}
sx={{ color: "info.dark", textDecoration: "none" }}
>
{project.demandBlocks.length}
{project.demandBlocks?.length}
</Link>
</Cell>
</Row>
<Row>
<Cell>{t("details.flowPressure")}</Cell>
<Cell align="right">{project.flowPressure.toFixed(2)}</Cell>
<Cell align="right">{project.flowPressure?.toFixed(2)}</Cell>
</Row>
<Row>
<Cell>
{tDemands("list.demandsTable.averageSpeed", {
numberOfDemandsPerDay: project.averageSpeed.toFixed(2),
numberOfDemandsPerDay: project.averageSpeed?.toFixed(2),
})}
</Cell>
</Row>
Expand Down
Loading

0 comments on commit 2baaae2

Please sign in to comment.