Skip to content

Commit 74aaa63

Browse files
committed
Feat(finalize for triggering build for more enhanced and advanced functionality dashboard with dedicated section for viewing , displaying and replying important stuffs like mails right from dashboard ) 🚀: Implemented comprehensive updates: refactor data fetching, revamp DataTable component for improved usability, and introduce StickyDynamicNav with resizable panels for enhanced mail client functionality with all the changes realtime updated from backend and populate on dashboard as state changes and status on table changes as stripe payment occurs in realtime like successfull for paid and processing for unpaid , everything is from db and updation in realtime including stripe payments.
1 parent 52d888c commit 74aaa63

File tree

4 files changed

+301
-3956
lines changed

4 files changed

+301
-3956
lines changed

app/(dashboard)/[storeId]/layout.tsx

+26-6
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,13 @@
1-
import { redirect } from "next/navigation";
2-
import { auth } from "@clerk/nextjs";
1+
import { redirect } from 'next/navigation';
2+
import { auth } from '@clerk/nextjs';
33

4-
import Navbar from "@/components/navbar";
5-
import prismadb from "@/lib/prismadb";
4+
import Navbar from '@/components/navbar';
5+
import prismadb from '@/lib/prismadb';
6+
7+
import { accounts, mails } from '@/lib/data';
8+
import { cookies } from 'next/headers';
9+
10+
import { StickyDynamicNav } from '@/components/dynamic-sticky-nav';
611

712
export default async function DashboardLayout({
813
children,
@@ -12,9 +17,14 @@ export default async function DashboardLayout({
1217
params: { storeId: string };
1318
}) {
1419
const { userId } = auth();
20+
const layout = cookies().get('react-resizable-panels:layout');
21+
const collapsed = cookies().get('react-resizable-panels:collapsed');
22+
23+
const defaultLayout = layout ? JSON.parse(layout.value) : undefined;
24+
const defaultCollapsed = collapsed ? JSON.parse(collapsed.value) : undefined;
1525

1626
if (!userId) {
17-
redirect("/sign-in");
27+
redirect('/sign-in');
1828
}
1929

2030
// Checking if the store exists and belongs to the user before rendering the page
@@ -26,13 +36,23 @@ export default async function DashboardLayout({
2636
});
2737

2838
if (!store) {
29-
redirect("/");
39+
redirect('/');
3040
}
3141

3242
return (
3343
<>
3444
<Navbar />
45+
3546
{children}
47+
<div className="hidden flex-col md:flex">
48+
<StickyDynamicNav
49+
accounts={accounts}
50+
mails={mails}
51+
defaultLayout={defaultLayout}
52+
defaultCollapsed={defaultCollapsed}
53+
navCollapsedSize={4}
54+
/>
55+
</div>
3656
</>
3757
);
3858
}

components/navbar.tsx

+7-7
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
1-
import { UserButton, auth } from "@clerk/nextjs";
2-
import { redirect } from "next/navigation";
1+
import { UserButton, auth } from '@clerk/nextjs';
2+
import { redirect } from 'next/navigation';
33

4-
import StoreSwitcher from "@/components/store-switcher";
4+
import StoreSwitcher from '@/components/store-switcher';
55

6-
import prismadb from "@/lib/prismadb";
6+
import prismadb from '@/lib/prismadb';
77

8-
import { MainNav } from "./main-nav";
9-
import { ThemeToggle } from "./theme-toggle";
8+
import { MainNav } from './main-nav';
9+
import { ThemeToggle } from './theme-toggle';
1010

1111
const Navbar = async () => {
1212
const { userId } = auth();
1313

1414
if (!userId) {
15-
redirect("/sign-in");
15+
redirect('/sign-in');
1616
}
1717

1818
const stores = await prismadb.store.findMany({

0 commit comments

Comments
 (0)