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

Add maintenance page #172

Merged
merged 7 commits into from
Nov 30, 2024
Merged
Show file tree
Hide file tree
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
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ const Breadcrumbs = async (props: { params: Params }) => {
<BreadcrumbList>
<BreadcrumbItem>
<BreadcrumbLink asChild>
<Link href="/">Home</Link>
<Link href="/public">Home</Link>
</BreadcrumbLink>
</BreadcrumbItem>
{breadcrumbs.map(({ isLastItem, href, label }) => (
Expand Down
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Suspense } from "react";
import { fetchMonths } from "@/app/cars/utils/fetchMonths";
import { fetchMonths } from "@/app/(dashboard)/cars/utils/fetchMonths";
import { CarOverviewTrends } from "@/app/components/CarOverviewTrends";
import { EmptyData } from "@/components/EmptyData";
import { MonthSelector } from "@/components/MonthSelector";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,9 @@ export const columns: ColumnDef<Car>[] = [
cell: ({ row }) => {
const type = row.getValue("fuel_type") as string;
return (
<Link href={`/cars/fuel-types/${type.toLowerCase()}`}>{type}</Link>
<Link href={`/app/(dashboard)/cars/fuel-types/${type.toLowerCase()}`}>
{type}
</Link>
);
},
},
Expand All @@ -37,7 +39,11 @@ export const columns: ColumnDef<Car>[] = [
cell: ({ row }) => {
const type = row.getValue("vehicle_type") as string;
return (
<Link href={`/cars/vehicle-types/${type.toLowerCase()}`}>{type}</Link>
<Link
href={`/app/(dashboard)/cars/vehicle-types/${type.toLowerCase()}`}
>
{type}
</Link>
);
},
},
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { TrendChart } from "@/app/cars/makes/[make]/TrendChart";
import { columns } from "@/app/cars/makes/[make]/columns";
import { TrendChart } from "@/app/(dashboard)/cars/makes/[make]/TrendChart";
import { columns } from "@/app/(dashboard)/cars/makes/[make]/columns";
import { MakeSelector } from "@/app/components/MakeSelector";
import { EmptyData } from "@/components/EmptyData";
import { StructuredData } from "@/components/StructuredData";
Expand Down
139 changes: 68 additions & 71 deletions app/cars/page.tsx → app/(dashboard)/cars/page.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import { Suspense } from "react";
import { notFound } from "next/navigation";
import { Leaderboard } from "@/components/Leaderboard";
import { MonthSelector } from "@/components/MonthSelector";
Expand Down Expand Up @@ -91,7 +90,7 @@ const CarsPage = async (props: { searchParams: SearchParams }) => {
}

Object.assign(car, {
vehicle_type: VEHICLE_TYPE_MAP[vehicle_type] || vehicle_type,
vehicle_type: VEHICLE_TYPE_MAP[vehicle_type] ?? vehicle_type,
});

return car;
Expand Down Expand Up @@ -158,78 +157,76 @@ const CarsPage = async (props: { searchParams: SearchParams }) => {
</Typography.H3>
)}
{cars.length > 0 && (
<>
<div className="flex flex-col gap-y-4">
<div className="grid grid-cols-1 gap-4 xl:grid-cols-3">
<Card>
<CardHeader>
<CardTitle>Total Registrations</CardTitle>
</CardHeader>
<CardContent>
<p className="text-4xl font-bold text-primary">{total}</p>
</CardContent>
</Card>
<Card>
<CardHeader>
<CardTitle>Top Fuel Type</CardTitle>
</CardHeader>
<CardContent>
<p className="text-2xl font-bold text-green-600">
{topFuelType} ({topFuelTypeValue})
</p>
<p className="text-gray-600">Highest adoption rate</p>
</CardContent>
</Card>
<Card>
<CardHeader>
<CardTitle>Top Vehicle Type</CardTitle>
</CardHeader>
<CardContent>
<p className="text-2xl font-bold text-pink-600">
{topVehicleType} ({topVehicleTypeValue})
</p>
<p className="text-gray-600">Highest adoption rate</p>
</CardContent>
</Card>
{/*<UnreleasedFeature>*/}
{/* <Card>*/}
{/* <CardHeader>*/}
{/* <CardTitle>Trend</CardTitle>*/}
{/* </CardHeader>*/}
{/* <CardContent>*/}
{/* <p className="text-2xl font-bold text-orange-600">*/}
{/* Electric*/}
{/* </p>*/}
{/* <p className="text-gray-600">*/}
{/* Steady increase in registrations*/}
{/* </p>*/}
{/* </CardContent>*/}
{/* </Card>*/}
{/*</UnreleasedFeature>*/}
<div className="flex flex-col gap-y-4">
<div className="grid grid-cols-1 gap-4 xl:grid-cols-3">
<Card>
<CardHeader>
<CardTitle>Total Registrations</CardTitle>
</CardHeader>
<CardContent>
<p className="text-4xl font-bold text-primary">{total}</p>
</CardContent>
</Card>
<Card>
<CardHeader>
<CardTitle>Top Fuel Type</CardTitle>
</CardHeader>
<CardContent>
<p className="text-2xl font-bold text-green-600">
{topFuelType} ({topFuelTypeValue})
</p>
<p className="text-gray-600">Highest adoption rate</p>
</CardContent>
</Card>
<Card>
<CardHeader>
<CardTitle>Top Vehicle Type</CardTitle>
</CardHeader>
<CardContent>
<p className="text-2xl font-bold text-pink-600">
{topVehicleType} ({topVehicleTypeValue})
</p>
<p className="text-gray-600">Highest adoption rate</p>
</CardContent>
</Card>
{/*<UnreleasedFeature>*/}
{/* <Card>*/}
{/* <CardHeader>*/}
{/* <CardTitle>Trend</CardTitle>*/}
{/* </CardHeader>*/}
{/* <CardContent>*/}
{/* <p className="text-2xl font-bold text-orange-600">*/}
{/* Electric*/}
{/* </p>*/}
{/* <p className="text-gray-600">*/}
{/* Steady increase in registrations*/}
{/* </p>*/}
{/* </CardContent>*/}
{/* </Card>*/}
{/*</UnreleasedFeature>*/}
</div>
<div className="grid gap-4 xl:grid-cols-12">
<div className="grid grid-cols-1 gap-4 xl:col-span-6">
<StatisticsCard
title="By Fuel Type"
description="Distribution of vehicles based on fuel type"
data={numberByFuelType}
total={total}
linkPrefix="fuel-types"
/>
<StatisticsCard
title="By Vehicle Type"
description="Distribution of vehicles based on vehicle type"
data={numberByVehicleType}
total={total}
linkPrefix="vehicle-types"
/>
</div>
<div className="grid gap-4 xl:grid-cols-12">
<div className="grid grid-cols-1 gap-4 xl:col-span-6">
<StatisticsCard
title="By Fuel Type"
description="Distribution of vehicles based on fuel type"
data={numberByFuelType}
total={total}
linkPrefix="fuel-types"
/>
<StatisticsCard
title="By Vehicle Type"
description="Distribution of vehicles based on vehicle type"
data={numberByVehicleType}
total={total}
linkPrefix="vehicle-types"
/>
</div>
<div className="grid grid-cols-1 gap-4 xl:col-span-6">
<Leaderboard cars={cars} />
</div>
<div className="grid grid-cols-1 gap-4 xl:col-span-6">
<Leaderboard cars={cars} />
</div>
</div>
</>
</div>
)}
</div>
</>
Expand Down
File renamed without changes
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { fetchMonths } from "@/app/cars/utils/fetchMonths";
import { fetchMonths } from "@/app/(dashboard)/cars/utils/fetchMonths";
import { CarOverviewTrends } from "@/app/components/CarOverviewTrends";
import { EmptyData } from "@/components/EmptyData";
import { MonthSelector } from "@/components/MonthSelector";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
"use client";

import { useMemo } from "react";
import { columns } from "@/app/coe/(prices)/columns";
import { columns } from "@/app/(dashboard)/coe/(prices)/columns";
import useStore from "@/app/store";
import { DataTable } from "@/components/ui/data-table";
import type { COEResult } from "@/types";
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { TrendTable } from "@/app/coe/(prices)/TrendTable";
import { TrendTable } from "@/app/(dashboard)/coe/(prices)/TrendTable";
import { COECategories } from "@/components/COECategories";
import { COEPremiumChart } from "@/components/COEPremiumChart";
import { StructuredData } from "@/components/StructuredData";
Expand Down
File renamed without changes.
File renamed without changes.
4 changes: 2 additions & 2 deletions app/layout.tsx → app/(dashboard)/layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@ import { Inter } from "next/font/google";
import Script from "next/script";
import { GoogleAnalytics } from "@next/third-parties/google";
import classNames from "classnames";
import { Analytics } from "@/app/components/Analytics";
import { Announcement } from "@/app/components/Announcement";
// import { Footer } from "@/app/components/Footer";
import { AppSidebar } from "@/components/AppSidebar";
import { Header } from "@/components/Header";
import { SidebarProvider, SidebarTrigger } from "@/components/ui/sidebar";
import { ANNOUNCEMENT, SITE_TITLE, SITE_URL } from "@/config";
import "./globals.css";
import { Analytics } from "./components/Analytics";
import "../globals.css";
import type { Metadata } from "next";

const inter = Inter({ subsets: ["latin"] });
Expand Down
File renamed without changes
File renamed without changes
2 changes: 1 addition & 1 deletion app/components/CarOverviewTrends.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Suspense } from "react";
import { TrendChart } from "@/app/cars/fuel-types/[fuelType]/TrendChart";
import { TrendChart } from "@/app/(dashboard)/cars/fuel-types/[fuelType]/TrendChart";
import { DataTable } from "@/components/DataTable";
import {
Card,
Expand Down
Loading