formating summary box on portfolio page

This commit is contained in:
Khalim Conn-Kowlessar 2024-08-13 16:26:15 +01:00
parent 92bd82a0d5
commit 295d7abaff
2 changed files with 5 additions and 16 deletions

View file

@ -9,7 +9,6 @@ interface SummaryBoxProps {
budget: number | null;
totalCost: number | null;
co2EquivalentSavings: number | null;
totalWorkHours: number | null;
propertyValuationIncrease: number | null;
energySavings: number | null;
energyCostSavings: number | null;
@ -44,9 +43,6 @@ function SummaryBox({ scenarios, numProperties }: SummaryBoxProps) {
const [energySavingsFormatted, setEnergySavingsFormatted] = useState(
formatKwh(defaultScenario.energySavings)
);
const [estimatedDurationFormatted, setEstimatedDurationFormatted] = useState(
convertDaysToWorkingWeeks(defaultScenario.labourDays)
);
const handleScenarioChange = (scenarioId: string) => {
setSelectedScenarioId(Number(scenarioId));
@ -70,13 +66,14 @@ function SummaryBox({ scenarios, numProperties }: SummaryBoxProps) {
formatCo2(selectedScenario.co2EquivalentSavings)
);
setEnergySavingsFormatted(formatKwh(selectedScenario.energySavings));
setEstimatedDurationFormatted(
convertDaysToWorkingWeeks(selectedScenario.labourDays)
);
};
function formatMoney(amount: number | null) {
return amount === null ? "£0" : "£" + formatNumber(amount);
if (amount === 0) {
return "-";
}
return amount === null ? "-" : "£" + formatNumber(amount);
}
function formatBudget(budget: number | null) {
@ -131,12 +128,6 @@ function SummaryBox({ scenarios, numProperties }: SummaryBoxProps) {
{totalCostFormatted}
</td>
</tr>
<tr>
<td className="text-brandblue">Estimated Duration</td>
<td className="text-brandblue text-end">
{estimatedDurationFormatted}
</td>
</tr>
<tr>
<td className="text-brandblue">Total properties</td>
<td className="text-brandblue text-end">{numProperties}</td>

View file

@ -45,7 +45,6 @@ export default async function Page({
budget: performance.budget,
totalCost: performance.cost,
co2EquivalentSavings: performance.co2EquivalentSavings,
totalWorkHours: performance.totalWorkHours,
propertyValuationIncrease: performance.propertyValuationIncrease,
energySavings: performance.energySavings,
energyCostSavings: performance.energyCostSavings,
@ -61,7 +60,6 @@ export default async function Page({
budget: portfolio.budget,
totalCost: portfolio.cost,
co2EquivalentSavings: portfolio.co2EquivalentSavings,
totalWorkHours: portfolio.totalWorkHours,
propertyValuationIncrease: portfolio.propertyValuationIncrease,
energySavings: portfolio.energySavings,
energyCostSavings: portfolio.energyCostSavings,