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 COE PQP Rates page #186

Merged
merged 2 commits into from
Jan 29, 2025
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
1 change: 1 addition & 0 deletions app/(default)/@breadcrumbs/[...slug]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ interface BreadcrumbItem {

const BREADCRUMB_MAP: Record<string, string> = {
coe: "COE",
pqp: "PQP Rates",
};

const generateBreadcrumbs = (slug: string[]): BreadcrumbItem[] => {
Expand Down
10 changes: 10 additions & 0 deletions app/(default)/coe/pqp/columns.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
export const columns = [
{
accessorKey: "month",
header: "Month",
},
{ accessorKey: "Category A", header: "Category A" },
{ accessorKey: "Category B", header: "Category B" },
{ accessorKey: "Category C", header: "Category C" },
{ accessorKey: "Category D", header: "Category D" },
];
94 changes: 94 additions & 0 deletions app/(default)/coe/pqp/page.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
import { AlertCircle } from "lucide-react";
import { StructuredData } from "@/components/StructuredData";
import Typography from "@/components/Typography";
import { Alert, AlertDescription, AlertTitle } from "@/components/ui/alert";
import { DataTable } from "@/components/ui/data-table";
import { API_URL, SITE_TITLE, SITE_URL } from "@/config";
import { fetchApi } from "@/utils/fetchApi";
import { columns } from "./columns";
import type { WebPage, WithContext } from "schema-dts";

const title = "PQP Rates";
const description =
"Latest Prevailing Quota Premium (PQP) rates for COE renewal in Singapore. These rates show the average COE prices over the last 3 months.";

export const generateMetadata = () => {
const canonical = "/coe/pqp";

return {
title,
description,
openGraph: {
images: `${SITE_URL}/opengraph-image.png`,
url: canonical,
siteName: SITE_TITLE,
locale: "en_SG",
type: "website",
},
twitter: {
card: "summary_large_image",
images: `${SITE_URL}/twitter-image.png`,
site: "@sgcarstrends",
creator: "@sgcarstrends",
},
alternates: {
canonical,
},
};
};

const PQPRatesPage = async () => {
const pqpRates = await fetchApi<
Array<Record<string, Record<string, number>>>
>(`${API_URL}/coe/pqp`);

const data = Object.entries(pqpRates).map(([month, pqpRates]) => ({
month,
...pqpRates,
}));

const structuredData: WithContext<WebPage> = {
"@context": "https://schema.org",
"@type": "WebPage",
name: title,
description,
url: `${SITE_URL}/coe/pqp`,
};

return (
<>
<StructuredData data={structuredData} />
<div className="flex flex-col gap-y-4">
<Typography.H1>PQP Rates</Typography.H1>
<Alert>
<AlertCircle className="h-4 w-4" />
<AlertTitle>Understanding PQP Rates</AlertTitle>
<AlertDescription>
<Typography.P>
Certificate of Entitlement (COE) Prevailing Quota Premium (PQP)
rates are specific to Singapore&apos;s vehicle ownership system.
They represent the average COE prices over the last 3 months,
which car owners must pay to renew their existing vehicle&apos;s
COE.
</Typography.P>
<Typography.P>
The PQP system allows car owners to extend their COE for another 5
or 10 years by paying the prevailing market rate rather than
bidding in the open market. This is particularly relevant for
owners who wish to keep their vehicles beyond the initial 10-year
COE period.
</Typography.P>
<Typography.P>
The Land Transport Authority (LTA) calculates and updates these
rates monthly based on the moving average of COE prices in the
preceding three months.
</Typography.P>
</AlertDescription>
</Alert>
<DataTable columns={columns} data={data} />
</div>
</>
);
};

export default PQPRatesPage;
4 changes: 4 additions & 0 deletions components/AppSidebar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -265,6 +265,10 @@ const data: Nav = {
icon: DollarSign,
url: "/coe",
},
{
title: "PQP Rates",
url: "/coe/pqp",
},
// {
// title: "COE",
// icon: "",
Expand Down
8 changes: 4 additions & 4 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.