|
1 | 1 | "use client"; |
2 | | -import React, { Suspense } from "react"; |
| 2 | +import React from "react"; |
3 | 3 | import { useFilterStore } from "@/store/useFilterStore"; |
4 | 4 | import { useShowSidebar } from "@/store/useShowSidebar"; |
| 5 | +import { DashboardHeader } from "@/components/dashboard/DashboardHeader"; |
| 6 | +import Sidebar from "@/components/dashboard/Sidebar"; |
| 7 | +import FiltersContainer from "@/components/ui/FiltersContainer"; |
5 | 8 |
|
6 | | -const wait = (ms: number) => new Promise((resolve) => setTimeout(resolve, ms)); |
7 | | -import { Skeleton } from "@/components/ui/skeleton"; |
8 | | - |
9 | | -const DashboardHeader = React.lazy(() => |
10 | | - import("@/components/dashboard/DashboardHeader").then((m) => ({ |
11 | | - default: m.DashboardHeader, |
12 | | - })) |
13 | | - ); |
14 | | -const Sidebar = React.lazy(() => import("@/components/dashboard/Sidebar")); |
15 | | -const FiltersContainer = React.lazy(() => import("@/components/ui/FiltersContainer")); |
16 | | - |
17 | | -export default function DashboardLayout({ |
18 | | - children, |
19 | | -}: { |
20 | | - children: React.ReactNode; |
21 | | -}) { |
| 9 | +export default function DashboardLayout({ children }: { children: React.ReactNode }) { |
22 | 10 | const { showFilters } = useFilterStore(); |
23 | 11 | const { showSidebar } = useShowSidebar(); |
| 12 | + |
24 | 13 | return ( |
25 | 14 | <div className="flex flex-col md:gap-3"> |
26 | 15 | <div className="flex w-full h-16"> |
27 | | - <Suspense |
28 | | - fallback={ |
29 | | - <div className="py-20 text-center text-lg text-neutral-400"> |
30 | | - <div className="mx-auto flex w-full max-w-md flex-col items-center gap-4 px-6"> |
31 | | - <Skeleton className="h-6 w-40" /> |
32 | | - <Skeleton className="h-4 w-72" /> |
33 | | - <Skeleton className="h-4 w-64" /> |
34 | | - <Skeleton className="h-4 w-56" /> |
35 | | - </div> |
36 | | - </div> |
37 | | - } |
38 | | - > |
39 | | - <DashboardHeader></DashboardHeader> |
40 | | - </Suspense> |
| 16 | + <DashboardHeader /> |
41 | 17 | </div> |
42 | | - <div className="flex flex-row w-full"> |
43 | | - {showFilters && ( |
44 | | - <Suspense |
45 | | - fallback={ |
46 | | - <div className="py-20 text-center text-lg text-neutral-400"> |
47 | | - <div className="mx-auto flex w-full max-w-md flex-col items-center gap-4 px-6"> |
48 | | - <Skeleton className="h-6 w-40" /> |
49 | | - <Skeleton className="h-4 w-72" /> |
50 | | - <Skeleton className="h-4 w-64" /> |
51 | | - <Skeleton className="h-4 w-56" /> |
52 | | - </div> |
53 | | - </div> |
54 | | - } |
55 | | - > |
56 | | - <FiltersContainer></FiltersContainer> |
57 | | - </Suspense> |
58 | | - )} |
| 18 | + <div className="flex flex-row w-full overflow-hidden"> |
| 19 | + {showFilters && <FiltersContainer />} |
59 | 20 | <aside |
60 | | - className={`w-48 md:w-[40%] xl:w-[20%] ${showSidebar ? "block relative" : "hidden"} xl:block`} |
| 21 | + className={`flex-shrink-0 w-48 md:w-[40%] xl:w-[20%] ${showSidebar ? "block relative" : "hidden"} xl:block overflow-y-auto`} |
61 | 22 | > |
62 | | - <Suspense |
63 | | - fallback={ |
64 | | - <div className="py-20 text-center text-lg text-neutral-400"> |
65 | | - <div className="mx-auto flex w-full max-w-md flex-col items-center gap-4 px-6"> |
66 | | - <Skeleton className="h-6 w-40" /> |
67 | | - <Skeleton className="h-4 w-72" /> |
68 | | - <Skeleton className="h-4 w-64" /> |
69 | | - <Skeleton className="h-4 w-56" /> |
70 | | - </div> |
71 | | - </div> |
72 | | - } |
73 | | - > |
74 | | - <Sidebar></Sidebar> |
75 | | - </Suspense> |
| 23 | + <Sidebar /> |
76 | 24 | </aside> |
77 | | - <main className="flex-grow">{children}</main> |
| 25 | + <main className="flex-grow overflow-y-auto">{children}</main> |
78 | 26 | </div> |
79 | 27 | </div> |
80 | 28 | ); |
|
0 commit comments