refactor: Remove unused ui parts

This commit is contained in:
behnam 2025-03-11 10:57:25 +03:00
parent 75b1671982
commit 0d18a63956
3 changed files with 3 additions and 27 deletions

View File

@ -1,6 +1,4 @@
import { DocumentIcon } from "@/app/components/icons/document";
import HomeIcon from "@/app/components/icons/home";
import { UserIcon } from "@/app/components/icons/user";
import { usePathname } from "next/navigation";
import { useRef } from "react";
@ -23,15 +21,9 @@ export default function navLinkPersonalVM() {
// Depending on the size of the application, this would be stored in a database.
const links = useRef<LinkItem[]>([
{ name: "Home", href: "/dashboard", icon: HomeIcon },
{
name: "Invoices",
href: "/dashboard/invoices",
icon: DocumentIcon,
},
{ name: "Customers", href: "/dashboard/customers", icon: UserIcon },
]).current;
return {
links,
isLinkActive: (link: LinkItem) => pathname === link.href,
isLinkActive: (link: LinkItem) => pathname.includes(link.href),
};
}

View File

@ -2,27 +2,13 @@ import {
LatestInvoicesSkeleton,
RevenueChartSkeleton,
} from "@/app/[lang]/dashboard/components/server/skeletons";
import CardWrapper from "@/app/[lang]/dashboard/components/server/cards";
import RevenueChart from "@/app/[lang]/dashboard/components/server/revenue-chart";
import { Suspense } from "react";
import { getServerTranslation, LANGS } from "@/bootstrap/i18n/i18n";
import langKey from "@/bootstrap/i18n/dictionaries/lang-key";
import LatestInvoices from "@/app/[lang]/dashboard/components/server/latest-invoices";
export default async function Dashboard(props: {
params: Promise<{ lang: LANGS }>;
}) {
const { params } = props;
const { lang } = await params;
const { t } = await getServerTranslation(lang);
export default async function Dashboard() {
return (
<main>
<h1 className="mb-4 text-xl md:text-2xl">
{t(langKey.global.dashboard)}
</h1>
<div className="grid gap-6 sm:grid-cols-2 lg:grid-cols-4">
<CardWrapper />
</div>
<div className="mt-6 grid grid-cols-1 gap-6 md:grid-cols-4 lg:grid-cols-8">
<Suspense fallback={<RevenueChartSkeleton />}>
<RevenueChart />

View File

@ -21,9 +21,7 @@ export default class CreateRandomInvoiceButtonVM extends BaseVM<ButtonVm> {
constructor() {
super();
this.createInvoice = this.di.resolve(
createInvoiceController.prototype.name,
);
this.createInvoice = this.di.resolve(createInvoiceController.name);
}
useVM(): ButtonVm {