Skip to content

Commit

Permalink
Clean up
Browse files Browse the repository at this point in the history
  • Loading branch information
ruchernchong committed Dec 2, 2024
1 parent f6f1735 commit f09bca7
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 8 deletions.
3 changes: 1 addition & 2 deletions app/(dashboard)/layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down Expand Up @@ -58,7 +57,7 @@ const RootLayout = async ({
{ANNOUNCEMENT && <Announcement>{ANNOUNCEMENT}</Announcement>}
<SidebarProvider>
<AppSidebar />
<main className="w-full">
<main className="w-full bg-gray-50">
<Header breadcrumbs={breadcrumbs}>
<SidebarTrigger />
</Header>
Expand Down
13 changes: 10 additions & 3 deletions components/AppSidebar.tsx
Original file line number Diff line number Diff line change
@@ -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,
Expand Down Expand Up @@ -69,6 +69,8 @@ type Nav = {

export const AppSidebar = () => {
const pathname = usePathname();
const searchParams = useSearchParams();

const { setOpenMobile } = useSidebar();

return (
Expand Down Expand Up @@ -130,7 +132,12 @@ export const AppSidebar = () => {
isActive={subItem.url === pathname}
onClick={() => setOpenMobile(false)}
>
<Link href={subItem.url}>
<Link
href={{
pathname: subItem.url,
query: searchParams.toString(),
}}
>
{subItem.icon && <subItem.icon />}
<span>{subItem.title}</span>
</Link>
Expand Down Expand Up @@ -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)}`,
};
}),
Expand Down
2 changes: 1 addition & 1 deletion components/EmptyData.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ export const EmptyData = () => {
const pathname = usePathname();

return (
<div className="flex flex-col items-center justify-center gap-4">
<div className="container flex min-h-screen flex-col items-center justify-center gap-4">
<Alert variant="destructive">
<AlertCircle className="h-4 w-4" />
<AlertTitle>Error</AlertTitle>
Expand Down
4 changes: 2 additions & 2 deletions config/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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" },
];
Expand Down
1 change: 1 addition & 0 deletions constants/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,5 @@ export const VEHICLE_TYPE_MAP: Partial<Record<VehicleType, string>> = {
"Multi-purpose Vehicle": "MPV",
"Multi-purpose Vehicle/Station-wagon": "MPV",
"Sports Utility Vehicle": "SUV",
"Station-wagon": "Station wagon",
};

0 comments on commit f09bca7

Please sign in to comment.