Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

nit: tidy decimal places and var storage #298

Merged
merged 1 commit into from
Jan 29, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions app/components/Dashboard/Cards/WhatDifference.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,13 @@ const Highlight: React.FC<React.PropsWithChildren> = ({ children }) => (
const Cards: React.FC<CardsProps> = ({ household }) => {
const moneySaved = Math.round(household.socialValue.moneySaved).toLocaleString();
const communityWealthDecade = Math.round(household.socialValue.communityWealthDecade).toLocaleString();
const embodiedCarbonSavings = household.socialValue.embodiedCarbonSavings;
const embodiedCarbonSavings = household.socialValue.embodiedCarbonSavings.toFixed(1);
const savingsEnergyPoundsYearly = Math.round(household.socialValue.savingsEnergyPoundsYearly).toLocaleString()
const savingsToNHSPerHeadYearly = Math.round(household.socialValue.savingsToNHSPerHeadYearly).toLocaleString();
const newBuildPrice = Math.round(household.property.newBuildPrice).toLocaleString();
const operationalCarbonSavingsYearly = household.socialValue.operationalCarbonSavingsYearly;
const operationalCarbonSavingsYearly = household.socialValue.operationalCarbonSavingsYearly.toFixed(1);
const maintenanceCost = Math.round(household.lifetime.lifetimeData[0].maintenanceCost[household.property.maintenanceLevel]).toLocaleString();
const localJobs = household.socialValue.localJobs.toFixed(1);

return <div className="flex flex-wrap gap-6">
<Card title="Money saved" figure={`£${moneySaved}`}>
Expand All @@ -67,7 +69,7 @@ const Cards: React.FC<CardsProps> = ({ household }) => {
<p>per person, per year of a healthy, well-maintained home</p>
</Card>
<Card title="Local economy">
<p>If new build, the home would add <Highlight>£{newBuildPrice}</Highlight> to the local economy, and <Highlight>£{Math.round(household.lifetime.lifetimeData[0].maintenanceCost[household.property.maintenanceLevel]).toLocaleString()}</Highlight> every year, supporting <Highlight>{household.socialValue.localJobs}</Highlight> full-time-equivalent jobs in total</p>
<p>If new build, the home would add <Highlight>£{newBuildPrice}</Highlight> to the local economy, and <Highlight>£{maintenanceCost}</Highlight> every year, supporting <Highlight>{localJobs}</Highlight> full-time-equivalent jobs in total</p>
</Card>
<Card title="Annual carbon savings" figure={`${operationalCarbonSavingsYearly} TCO₂e`}>
<p>If new build or retrofit, compared to average home</p>
Expand Down
Loading