2026-01-09 11:58:08 +08:00
|
|
|
"use client"
|
|
|
|
|
|
|
|
|
|
import { usePathname } from "next/navigation"
|
2026-01-21 15:49:12 +08:00
|
|
|
import { useEffect, useState } from "react"
|
2026-01-09 11:58:08 +08:00
|
|
|
import { BottomNav } from "@/components/bottom-nav"
|
|
|
|
|
import { ConfigLoader } from "@/components/config-loader"
|
|
|
|
|
|
|
|
|
|
export function LayoutWrapper({ children }: { children: React.ReactNode }) {
|
|
|
|
|
const pathname = usePathname()
|
2026-01-21 15:49:12 +08:00
|
|
|
const [mounted, setMounted] = useState(false)
|
2026-01-09 11:58:08 +08:00
|
|
|
const isAdmin = pathname?.startsWith("/admin")
|
|
|
|
|
|
2026-01-21 15:49:12 +08:00
|
|
|
useEffect(() => {
|
|
|
|
|
setMounted(true)
|
|
|
|
|
}, [])
|
|
|
|
|
|
|
|
|
|
// 服务端渲染时先返回通用布局
|
|
|
|
|
if (!mounted) {
|
|
|
|
|
return (
|
|
|
|
|
<div className="mx-auto max-w-[430px] min-h-screen bg-black shadow-2xl relative font-sans antialiased">
|
|
|
|
|
<ConfigLoader />
|
|
|
|
|
{children}
|
|
|
|
|
</div>
|
|
|
|
|
)
|
|
|
|
|
}
|
|
|
|
|
|
2026-01-09 11:58:08 +08:00
|
|
|
if (isAdmin) {
|
|
|
|
|
return (
|
|
|
|
|
<div className="min-h-screen bg-gray-100 text-gray-900 font-sans">
|
|
|
|
|
<ConfigLoader />
|
|
|
|
|
{children}
|
|
|
|
|
</div>
|
|
|
|
|
)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return (
|
2026-01-21 15:49:12 +08:00
|
|
|
<div className="mx-auto max-w-[430px] min-h-screen bg-black shadow-2xl relative font-sans antialiased">
|
2026-01-09 11:58:08 +08:00
|
|
|
<ConfigLoader />
|
|
|
|
|
{children}
|
|
|
|
|
<BottomNav />
|
|
|
|
|
</div>
|
|
|
|
|
)
|
|
|
|
|
}
|