minor styling

This commit is contained in:
Khalim Conn-Kowlessar 2025-10-31 23:56:20 +00:00
parent 03c6425fd7
commit 5512b02070
2 changed files with 17 additions and 12 deletions

View file

@ -74,9 +74,9 @@ export function ProjectProposal({ plans }: { plans: any[] }) {
: null;
return (
<div className="grid grid-cols-1 lg:grid-cols-3 gap-4">
<div className="grid grid-cols-1 grid-cols-5 gap-4">
{/* Chart */}
<Card className="lg:col-span-2 border border-gray-100 bg-gradient-to-br from-white to-gray-50/40 shadow-sm">
<Card className="col-span-3 border border-gray-100 bg-gradient-to-br from-white to-gray-50/40 shadow-sm">
<CardHeader>
<CardTitle className="text-base font-medium text-brandblue">
Homes by Work Type
@ -112,7 +112,7 @@ export function ProjectProposal({ plans }: { plans: any[] }) {
</Card>
{/* Metrics */}
<Card className="border border-gray-200 bg-white">
<Card className="col-span-2 border border-gray-200 bg-white">
<CardHeader>
<CardTitle className="text-lg font-semibold text-brandblue">
{mappedTitles[selectedType || "default"]}
@ -135,19 +135,19 @@ export function ProjectProposal({ plans }: { plans: any[] }) {
<div className="grid grid-cols-3 gap-4 text-center border-t pt-4">
<div>
<p className="text-xs text-gray-500 mb-1">Funding</p>
<p className="text-sm font-medium text-brandblue">
<p className="text-md font-medium text-brandblue">
£{formatNumber(selectedData?.totalFunding || 0)}
</p>
</div>
<div>
<p className="text-xs text-gray-500 mb-1">Carbon</p>
<p className="text-sm font-medium text-brandblue">
<p className="text-md font-medium text-brandblue">
{((selectedData?.totalCarbon || 0) * 1000).toFixed(2)} kgCOe
</p>
</div>
<div>
<p className="text-xs text-gray-500 mb-1">Bills</p>
<p className="text-sm font-medium text-brandblue">
<p className="text-md font-medium text-brandblue">
£{formatNumber(selectedData?.totalBills || 0)}
</p>
</div>
@ -185,13 +185,13 @@ export function DashboardSummary({ plans }: { plans: any[] }) {
{
title: "Carbon Savings",
value: `${(totalCarbon * 1000).toFixed(2)} kgCO₂e`,
subtitle: "Your projects total estimated CO₂e savings.",
subtitle: "Your projects total estimated CO₂e savings, per year.",
icon: Leaf,
},
{
title: "Bill Savings",
value: `£${formatNumber(totalBills)}`,
subtitle: "Expected total bill reductions across all homes.",
subtitle: "Expected total bill reductions across all homes, per year.",
icon: Zap,
},
{
@ -237,7 +237,7 @@ export function DashboardSummary({ plans }: { plans: any[] }) {
</CardHeader>
<CardContent>
<div className="text-3xl font-semibold text-transparent bg-clip-text bg-gradient-to-r from-brandblue to-midblue mb-1">
<div className="text-3xl font-semibold text-transparent bg-clip-text bg-gradient-to-r from-brandblue to-midblue mb-1 pb-2">
{c.value}
</div>
<p className="text-xs text-gray-500">{c.subtitle}</p>

View file

@ -14,6 +14,7 @@ export interface PlanWithTotals extends Record<string, unknown> {
postcode: string | null;
fundingScheme: string | null;
totalFunding: number | null;
totalUplift: number | null;
totalCarbonSavings: number | null;
totalBillSavings: number | null;
totalRecommendationCost?: number | null;
@ -36,6 +37,7 @@ export async function getPlansWithTotals(
p.postcode AS "postcode",
fp.scheme AS "fundingScheme",
COALESCE(fp.project_funding, 0) AS "totalFunding",
COALESCE(fp.total_uplift, 0) AS "totalUplift",
COALESCE(SUM(r.co2_equivalent_savings), 0) AS "totalCarbonSavings",
COALESCE(SUM(r.energy_cost_savings), 0) AS "totalBillSavings",
COALESCE(SUM(r.estimated_cost), 0) AS "totalRecommendationCost"
@ -67,7 +69,8 @@ export async function getPlansWithTotals(
p.address,
p.postcode,
fp.scheme,
fp.project_funding
fp.project_funding,
fp.total_uplift
ORDER BY pl.created_at DESC;
`);
@ -79,13 +82,15 @@ export async function getPlansWithTotals(
: DOMNA_COST_MAP.default;
const totalCost = plan.totalRecommendationCost ?? 0;
const funding = plan.totalFunding ?? 0;
const funding = (plan.totalFunding ?? 0) + (plan.totalUplift ?? 0);
const uplift = plan.totalUplift ?? 0;
const rawContribution = totalCost + surveyCost - funding;
const rawContribution = totalCost + surveyCost - funding - uplift;
const clientContribution = rawContribution > 0 ? rawContribution : 0;
return {
...plan,
totalFunding: funding, // overwrite
surveyCost,
clientContribution,
};