From f09bca72e9f9e78347c69ca62243e5679c30cd9a Mon Sep 17 00:00:00 2001 From: Ru Chern Chong Date: Mon, 2 Dec 2024 19:20:24 +0800 Subject: [PATCH] Clean up --- app/(dashboard)/layout.tsx | 3 +-- components/AppSidebar.tsx | 13 ++++++++++--- components/EmptyData.tsx | 2 +- config/index.ts | 4 ++-- constants/index.ts | 1 + 5 files changed, 15 insertions(+), 8 deletions(-) diff --git a/app/(dashboard)/layout.tsx b/app/(dashboard)/layout.tsx index 017d153..eb04a2e 100644 --- a/app/(dashboard)/layout.tsx +++ b/app/(dashboard)/layout.tsx @@ -5,7 +5,6 @@ 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"; @@ -58,7 +57,7 @@ const RootLayout = async ({ {ANNOUNCEMENT && {ANNOUNCEMENT}} -
+
diff --git a/components/AppSidebar.tsx b/components/AppSidebar.tsx index e8b27a4..07a5452 100644 --- a/components/AppSidebar.tsx +++ b/components/AppSidebar.tsx @@ -1,7 +1,7 @@ "use client"; import Link from "next/link"; -import { usePathname } from "next/navigation"; +import { usePathname, useSearchParams } from "next/navigation"; import { type IconType, SiBluesky, @@ -69,6 +69,8 @@ type Nav = { export const AppSidebar = () => { const pathname = usePathname(); + const searchParams = useSearchParams(); + const { setOpenMobile } = useSidebar(); return ( @@ -130,7 +132,12 @@ export const AppSidebar = () => { isActive={subItem.url === pathname} onClick={() => setOpenMobile(false)} > - + {subItem.icon && } {subItem.title} @@ -252,7 +259,7 @@ const data: Nav = { const title = item.title as VehicleType; return { ...item, - title: VEHICLE_TYPE_MAP[title] || title, + title: VEHICLE_TYPE_MAP[title] ?? title, url: `/cars/vehicle-types/${slugify(title)}`, }; }), diff --git a/components/EmptyData.tsx b/components/EmptyData.tsx index 3e13513..01ff578 100644 --- a/components/EmptyData.tsx +++ b/components/EmptyData.tsx @@ -10,7 +10,7 @@ export const EmptyData = () => { const pathname = usePathname(); return ( -
+
Error diff --git a/config/index.ts b/config/index.ts index 697007e..b01376d 100644 --- a/config/index.ts +++ b/config/index.ts @@ -88,14 +88,14 @@ export const VEHICLE_TYPE_LINKS: LinkItem[] = [ const label = link.label as VehicleType; return { ...link, - label: VEHICLE_TYPE_MAP[label] || label, + label: VEHICLE_TYPE_MAP[label] ?? label, href: `/cars/vehicle-types/${slugify(link.label)}`, }; }) .sort((a, b) => a.label.localeCompare(b.label)); export const COE_LINKS: LinkItem[] = [ - { href: "/coe", label: "Dashboard" }, + { href: "/coe", label: "COE Result" }, // { href: "/coe/prices", label: "COE Prices" }, // { href: "/coe/bidding", label: "COE Bidding" }, ]; diff --git a/constants/index.ts b/constants/index.ts index 321aaf1..1949577 100644 --- a/constants/index.ts +++ b/constants/index.ts @@ -25,4 +25,5 @@ export const VEHICLE_TYPE_MAP: Partial> = { "Multi-purpose Vehicle": "MPV", "Multi-purpose Vehicle/Station-wagon": "MPV", "Sports Utility Vehicle": "SUV", + "Station-wagon": "Station wagon", };