sarlink-portal/components/auth/application-layout.tsx
i701 bdf3729b0d Implement new features and enhance existing components for improved user experience
- Added a new `bun.lockb` file for dependency management.
- Updated `next.config.ts` to set output to "standalone" for better deployment options.
- Removed `package-lock.json` to streamline package management.
- Modified `package.json` to update dependencies, including `@prisma/client` and `sonner`, and adjusted build scripts for improved functionality.
- Enhanced Tailwind CSS configuration to include new animations and color schemes.
- Refactored various dashboard components to improve UI consistency, including adding a new `My Wallet` page and updating existing pages to use a unified styling approach.
- Introduced a new `BlockDeviceDialog` component for managing device blocking with user-defined reasons.
- Improved logging and error handling in payment verification and device management functions.

These changes enhance the overall functionality, maintainability, and user experience of the application.
2024-12-26 20:25:59 +05:00

52 lines
1.5 KiB
TypeScript

import { DeviceCartDrawer } from "@/components/device-cart";
import { Wallet } from "@/components/wallet";
import { ModeToggle } from "@/components/theme-toggle";
import { AppSidebar } from "@/components/ui/app-sidebar";
import { Separator } from "@/components/ui/separator";
import {
SidebarInset,
SidebarProvider,
SidebarTrigger,
} from "@/components/ui/sidebar";
import { auth } from "@/lib/auth";
import prisma from "@/lib/db";
import { headers } from "next/headers";
import { AccountPopover } from "./account-popver";
export async function ApplicationLayout({
children,
}: { children: React.ReactNode }) {
const session = await auth.api.getSession({
headers: await headers()
});
const billFormula = await prisma.billFormula.findFirst();
const user = await prisma.user.findFirst({
where: {
id: session?.user?.id,
},
});
return (
<SidebarProvider>
<AppSidebar role={session?.user?.role || "USER"} />
<DeviceCartDrawer billFormula={billFormula || null} />
<SidebarInset>
<header className="flex justify-between sticky top-0 bg-background h-16 shrink-0 items-center gap-2 border-b px-4 z-10">
<div className="flex items-center gap-2 ">
<SidebarTrigger className="-ml-1" />
<Separator orientation="vertical" className="mr-2 h-4" />
</div>
<div className="flex items-center gap-2">
<Wallet walletBalance={user?.walletBalance || 0} />
<ModeToggle />
<AccountPopover />
</div>
</header>
<div className="p-4">{children}</div>
</SidebarInset>
</SidebarProvider>
);
}