-
Notifications
You must be signed in to change notification settings - Fork 424
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: new dashboard layout (sidebar)
- Loading branch information
Showing
39 changed files
with
1,099 additions
and
449 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
import { notFound, redirect } from "next/navigation"; | ||
|
||
import { getCurrentUser } from "@/lib/session"; | ||
|
||
interface ProtectedLayoutProps { | ||
children: React.ReactNode; | ||
} | ||
|
||
export default async function Dashboard({ children }: ProtectedLayoutProps) { | ||
const user = await getCurrentUser(); | ||
if (!user || user.role !== "ADMIN") redirect("/login"); | ||
|
||
return <>{children}</>; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
import { Skeleton } from "@/components/ui/skeleton"; | ||
import { DashboardHeader } from "@/components/dashboard/header"; | ||
|
||
export default function AdminPanelLoading() { | ||
return ( | ||
<> | ||
<DashboardHeader | ||
heading="Admin Panel" | ||
text="Access only for users with ADMIN role." | ||
/> | ||
<div className="flex flex-col gap-5"> | ||
<div className="grid grid-cols-1 gap-4 sm:grid-cols-2 lg:grid-cols-4"> | ||
<Skeleton className="h-32 w-full rounded-lg" /> | ||
<Skeleton className="h-32 w-full rounded-lg" /> | ||
<Skeleton className="h-32 w-full rounded-lg" /> | ||
<Skeleton className="h-32 w-full rounded-lg" /> | ||
</div> | ||
<Skeleton className="h-[500px] w-full rounded-lg" /> | ||
<Skeleton className="h-[500px] w-full rounded-lg" /> | ||
</div> | ||
</> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
import { Skeleton } from "@/components/ui/skeleton"; | ||
import { DashboardHeader } from "@/components/dashboard/header"; | ||
|
||
export default function OrdersLoading() { | ||
return ( | ||
<> | ||
<DashboardHeader | ||
heading="Orders" | ||
text="Check and manage your latest orders." | ||
/> | ||
<Skeleton className="size-full rounded-lg" /> | ||
</> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
import { redirect } from "next/navigation"; | ||
|
||
import { getCurrentUser } from "@/lib/session"; | ||
import { constructMetadata } from "@/lib/utils"; | ||
import { Button } from "@/components/ui/button"; | ||
import { DashboardHeader } from "@/components/dashboard/header"; | ||
import { EmptyPlaceholder } from "@/components/shared/empty-placeholder"; | ||
|
||
export const metadata = constructMetadata({ | ||
title: "Orders – SaaS Starter", | ||
description: "Check and manage your latest orders.", | ||
}); | ||
|
||
export default async function OrdersPage() { | ||
// const user = await getCurrentUser(); | ||
// if (!user || user.role !== "ADMIN") redirect("/login"); | ||
|
||
return ( | ||
<> | ||
<DashboardHeader | ||
heading="Orders" | ||
text="Check and manage your latest orders." | ||
/> | ||
<EmptyPlaceholder> | ||
<EmptyPlaceholder.Icon name="package" /> | ||
<EmptyPlaceholder.Title>No orders listed</EmptyPlaceholder.Title> | ||
<EmptyPlaceholder.Description> | ||
You don't have any orders yet. Start ordering a product. | ||
</EmptyPlaceholder.Description> | ||
<Button>Buy Products</Button> | ||
</EmptyPlaceholder> | ||
</> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,11 @@ | ||
import { Skeleton } from "@/components/ui/skeleton"; | ||
import { DashboardHeader } from "@/components/dashboard/header"; | ||
import { DashboardShell } from "@/components/dashboard/shell"; | ||
|
||
export default function DashboardLoading() { | ||
return ( | ||
<DashboardShell> | ||
<DashboardHeader | ||
heading="Panel" | ||
text="Current Role :" | ||
/> | ||
<div className="divide-border-200 divide-y rounded-md border"> | ||
<Skeleton className="h-[400px] w-full rounded-lg" /> | ||
</div> | ||
</DashboardShell> | ||
<> | ||
<DashboardHeader heading="Dashboard" text="Current Role :" /> | ||
<Skeleton className="size-full rounded-lg" /> | ||
</> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,18 @@ | ||
import { DashboardHeader } from "@/components/dashboard/header"; | ||
import { DashboardShell } from "@/components/dashboard/shell"; | ||
import { CardSkeleton } from "@/components/shared/card-skeleton"; | ||
import { SkeletonSection } from "@/components/shared/section-skeleton"; | ||
|
||
export default function DashboardSettingsLoading() { | ||
return ( | ||
<DashboardShell> | ||
<> | ||
<DashboardHeader | ||
heading="Settings" | ||
text="Manage account and website settings." | ||
/> | ||
<div className="grid gap-6"> | ||
<CardSkeleton /> | ||
<CardSkeleton /> | ||
<CardSkeleton /> | ||
<div className="divide-y divide-muted pb-10"> | ||
<SkeletonSection /> | ||
<SkeletonSection /> | ||
<SkeletonSection card /> | ||
</div> | ||
</DashboardShell> | ||
</> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.