This commit is contained in:
ryan
2026-07-13 15:08:40 +08:00
parent 08e8eea932
commit 1eff7878a1
441 changed files with 26491 additions and 18405 deletions
+27 -23
View File
@@ -1,47 +1,51 @@
"use client"
import {motion} from "motion/react"
import {usePathname} from "next/navigation"
import {useState} from "react"
import {AppSidebar} from "@/components/layout/sidebar"
import {SiteHeader} from "@/components/layout/header"
import {SidebarInset, SidebarProvider} from "@/components/ui/sidebar"
import {useAuthRedirect} from "@/hooks/use-auth-redirect"
'use client';
import { motion } from 'motion/react';
import { usePathname } from 'next/navigation';
import { useState } from 'react';
import { AppSidebar } from '@/components/layout/sidebar';
import { SiteHeader } from '@/components/layout/header';
import { SidebarInset, SidebarProvider } from '@/components/ui/sidebar';
import { useAuthRedirect } from '@/hooks/use-auth-redirect';
export default function MainLayout({
children,
}: {
children: React.ReactNode
children: React.ReactNode;
}) {
const pathname = usePathname()
const [isFullWidth, setIsFullWidth] = useState(false)
const pathname = usePathname();
const [isFullWidth, setIsFullWidth] = useState(false);
useAuthRedirect()
useAuthRedirect();
return (
<SidebarProvider
className="h-screen"
className='h-screen'
style={
{
"--header-height": "60px",
'--header-height': '60px',
} as React.CSSProperties
}
>
<AppSidebar />
<SidebarInset className="flex flex-col min-w-0 h-screen">
<SiteHeader isFullWidth={isFullWidth} onToggleFullWidth={setIsFullWidth} />
<div className="flex flex-1 flex-col bg-background overflow-y-auto overflow-x-hidden min-w-0 hide-scrollbar">
<div className={`w-full mx-auto px-4 sm:px-6 md:px-8 lg:px-12 min-w-0 transition-all duration-300 ease-in-out ${!isFullWidth ? "max-w-[1320px]" : "max-w-full"}`}>
<SidebarInset className='flex flex-col min-w-0 h-screen'>
<SiteHeader
isFullWidth={isFullWidth}
onToggleFullWidth={setIsFullWidth}
/>
<div className='flex flex-1 flex-col bg-background overflow-y-auto overflow-x-hidden min-w-0 hide-scrollbar'>
<div
className={`w-full mx-auto px-4 sm:px-6 md:px-8 lg:px-12 min-w-0 transition-all duration-300 ease-in-out ${!isFullWidth ? 'max-w-[1320px]' : 'max-w-full'}`}
>
<motion.div
key={pathname}
initial={{ opacity: 0 }}
animate={{ opacity: 1 }}
transition={{
duration: 0.5,
ease: "easeOut",
ease: 'easeOut',
}}
className="w-full"
className='w-full'
>
{children}
</motion.div>
@@ -49,5 +53,5 @@ export default function MainLayout({
</div>
</SidebarInset>
</SidebarProvider>
)
}
);
}