develop #3

Merged
behnam merged 39 commits from develop into main 2024-11-26 15:47:00 +00:00
16 changed files with 48 additions and 34 deletions
Showing only changes of commit f522877b19 - Show all commits

View File

@ -1,5 +0,0 @@
import DashboardSkeleton from "@/app/dashboard/components/skeletons/skeletons";
export default function Loading() {
return <DashboardSkeleton />;
}

View File

@ -0,0 +1,29 @@
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';
type LinkItem = {
name: string;
href: string;
icon: (props: {className?: string}) => JSX.Element
}
export default function navLinkPersonalVM() {
const pathname = usePathname()
// Map of links to display in the side navigation.
// Depending on the size of the application, this would be stored in a database.
const links: LinkItem[] = [
{ name: 'Home', href: '/dashboard', icon: HomeIcon },
{
name: 'Invoices',
href: '/dashboard/invoices',
icon: DocumentIcon,
},
{ name: 'Customers', href: '/dashboard/customers', icon: UserIcon },
];
return {
links,
isLinkActive: (link: LinkItem) => pathname === link.href
}
}

View File

@ -1,25 +1,10 @@
'use client' 'use client'
import { DocumentIcon } from '@/app/components/icons/document'; import navLinkPersonalVM from '@/app/dashboard/components/client/nav-links/nav-link-controller';
import HomeIcon from '@/app/components/icons/home';
import { UserIcon } from '@/app/components/icons/user';
import clsx from 'clsx'; import clsx from 'clsx';
import Link from 'next/link' import Link from 'next/link'
import { usePathname } from 'next/navigation';
// Map of links to display in the side navigation.
// Depending on the size of the application, this would be stored in a database.
const links = [
{ name: 'Home', href: '/dashboard', icon: HomeIcon },
{
name: 'Invoices',
href: '/dashboard/invoices',
icon: DocumentIcon,
},
{ name: 'Customers', href: '/dashboard/customers', icon: UserIcon },
];
export default function NavLinks() { export default function NavLinks() {
const pathname = usePathname() const { links, isLinkActive } = navLinkPersonalVM()
return ( return (
<> <>
{links.map((link) => { {links.map((link) => {
@ -31,7 +16,7 @@ export default function NavLinks() {
className={clsx( className={clsx(
'flex h-[48px] grow items-center justify-center gap-2 rounded-md bg-gray-50 p-3 text-sm font-medium hover:bg-sky-100 hover:text-blue-600 md:flex-none md:justify-start md:p-2 md:px-3', 'flex h-[48px] grow items-center justify-center gap-2 rounded-md bg-gray-50 p-3 text-sm font-medium hover:bg-sky-100 hover:text-blue-600 md:flex-none md:justify-start md:p-2 md:px-3',
{ {
'bg-sky-100 text-blue-600': pathname === link.href, 'bg-sky-100 text-blue-600': isLinkActive(link),
}, },
)} )}
> >

View File

@ -1,4 +1,4 @@
import cardController from "@/app/dashboard/components/card/card-controller"; import cardController from "@/app/dashboard/components/server/card/card-controller";

View File

@ -1,5 +1,5 @@
import { Card } from '@/app/dashboard/components/card/card'; import { Card } from '@/app/dashboard/components/server/card/card';
import cardsController from '@/app/dashboard/components/cards/cards-controller'; import cardsController from '@/app/dashboard/components/server/cards/cards-controller';
export default async function CardWrapper() { export default async function CardWrapper() {

View File

@ -1,4 +1,4 @@
import latestInvoicesController from '@/app/dashboard/components/latest-invoices/latest-invoices-controller'; import latestInvoicesController from '@/app/dashboard/components/server/latest-invoices/latest-invoices-controller';
import { ArrowPathIcon } from '@heroicons/react/24/outline'; import { ArrowPathIcon } from '@heroicons/react/24/outline';
import clsx from 'clsx'; import clsx from 'clsx';
import Image from 'next/image'; import Image from 'next/image';

View File

@ -1,4 +1,4 @@
import revenueChartController from '@/app/dashboard/components/revenue-chart/revenue-chart-controller'; import revenueChartController from '@/app/dashboard/components/server/revenue-chart/revenue-chart-controller';
import { CalendarIcon } from '@heroicons/react/24/outline'; import { CalendarIcon } from '@heroicons/react/24/outline';
export default async function RevenueChart() { export default async function RevenueChart() {

View File

@ -1,4 +1,4 @@
import NavLinks from '@/app/dashboard/components/nav-links'; import NavLinks from '@/app/dashboard/components/client/nav-links/nav-links';
import Link from 'next/link'; import Link from 'next/link';
export default function SideNav() { export default function SideNav() {

View File

@ -1,4 +1,4 @@
import SideNav from "@/app/dashboard/components/sidenav"; import SideNav from "@/app/dashboard/components/server/sidenav";
export default function Layout({ children }: { children: React.ReactNode }) { export default function Layout({ children }: { children: React.ReactNode }) {

View File

@ -0,0 +1,5 @@
import DashboardSkeleton from "@/app/dashboard/components/server/skeletons/skeletons";
export default function Loading() {
return <DashboardSkeleton />;
}

View File

@ -1,7 +1,7 @@
import { LatestInvoicesSkeleton, RevenueChartSkeleton } from "@/app/dashboard/components/skeletons/skeletons"; import { LatestInvoicesSkeleton, RevenueChartSkeleton } from "@/app/dashboard/components/server/skeletons/skeletons";
import CardWrapper from "@/app/dashboard/components/cards/cards"; import CardWrapper from "@/app/dashboard/components/server/cards/cards";
import LatestInvoices from "@/app/dashboard/components/latest-invoices/latest-invoices"; import LatestInvoices from "@/app/dashboard/components/server/latest-invoices/latest-invoices";
import RevenueChart from "@/app/dashboard/components/revenue-chart/revenue-chart"; import RevenueChart from "@/app/dashboard/components/server/revenue-chart/revenue-chart";
import { Suspense } from "react"; import { Suspense } from "react";
export default async function Dashboard() { export default async function Dashboard() {