diff --git a/app/components/CarOverviewTrends.tsx b/app/components/CarOverviewTrends.tsx index 72e3812..a7aa1c6 100644 --- a/app/components/CarOverviewTrends.tsx +++ b/app/components/CarOverviewTrends.tsx @@ -1,7 +1,13 @@ import { Suspense } from "react"; import { TrendChart } from "@/app/cars/fuel-types/[fuelType]/TrendChart"; import { DataTable } from "@/components/DataTable"; -import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card"; +import { + Card, + CardContent, + CardDescription, + CardHeader, + CardTitle, +} from "@/components/ui/card"; import type { Car } from "@/types"; interface Props { @@ -9,6 +15,8 @@ interface Props { } export const CarOverviewTrends = ({ cars }: Props) => { + const total = cars.reduce((acc, curr) => acc + curr.number, 0); + return (
@@ -23,7 +31,10 @@ export const CarOverviewTrends = ({ cars }: Props) => { - Registrations + Distribution Table + + A total of {total} registrations + diff --git a/components/DataTable.tsx b/components/DataTable.tsx index 0c7295c..edc633a 100644 --- a/components/DataTable.tsx +++ b/components/DataTable.tsx @@ -1,6 +1,6 @@ import Link from "next/link"; -import { Progress } from "@/app/components/Progress"; import Typography from "@/components/Typography"; +import { Progress } from "@/components/ui/progress"; import { Table, TableBody, @@ -44,19 +44,24 @@ export const DataTable = ({ data }: Props) => { )} {data.length > 0 && - data.map((item, index) => ( - + data.map(({ make, number }, index) => ( + - {item.make} + {make} - {item.number} + {number} - - {formatPercent(marketShare(item.number), { + + {formatPercent(marketShare(number), { minimumFractionDigits: 2, maximumFractionDigits: 2, })} - + + ))} diff --git a/constants/index.ts b/constants/index.ts index 9db5850..88704bb 100644 --- a/constants/index.ts +++ b/constants/index.ts @@ -1,9 +1,9 @@ export const CARS = { TABLE: { HEADERS: { - MAKE: "Make", + MAKE: "Brands", COUNT: "Count", - MARKET_SHARE: "Market Share", + MARKET_SHARE: "Distribution", }, }, };