summaryrefslogtreecommitdiff
path: root/app/layout.tsx
blob: d56115b4088be2a9ca3f89156108b68d84e80bdb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
import type { Metadata } from "next";
import "./globals.css";
import { languages } from "@/i18n/settings";
import { Toaster } from "@/components/ui/toaster"
import { ThemeProvider } from "@/components/layout/providers"; // 기존 ThemeProvider 사용
import { cn } from "@/lib/utils"
import { META_THEME_COLORS, siteConfig } from "@/config/site"
import { LicenseInfo } from '@mui/x-license';
import { ToasterSonner } from "@/components/ui/toasterSonner";
import localFont from "next/font/local";

LicenseInfo.setLicenseKey(process.env.NEXT_PUBLIC_MUI_KEY as string);

const inter = localFont({
  src: [
    {
      path: '../public/fonts/Inter-Regular.woff2',
      weight: '400',
      style: 'normal',
    },
    {
      path: '../public/fonts/Inter-Medium.woff2',
      weight: '500',
      style: 'normal',
    },
    {
      path: '../public/fonts/Inter-Bold.woff2',
      weight: '700',
      style: 'normal',
    },
  ]
})

export const generateStaticParams = async () => {
  return languages.map((lng) => ({ lng }));
};

export const metadata: Metadata = {
  title: {
    default: siteConfig.name,
    template: `%s - ${siteConfig.name}`,
  },
  metadataBase: new URL(siteConfig.url),
  description: siteConfig.description,
  authors: [
    {
      name: "DTS",
      url: "https://dtsoution.io",
    },
  ],
  creator: "dujin",
};

export default async function RootLayout({
  children,
  params: { lng },
}: {
  children: React.ReactNode;
  params: { lng: string };
}) {
  return (
    <html lang={lng} suppressHydrationWarning>
      <head>
        <script
          dangerouslySetInnerHTML={{
            __html: `
            try {
              if (localStorage.theme === 'dark' || ((!('theme' in localStorage) || localStorage.theme === 'system') && window.matchMedia('(prefers-color-scheme: dark)').matches)) {
                document.querySelector('meta[name="theme-color"]').setAttribute('content', '${META_THEME_COLORS.dark}')
              }
            } catch (_) {}
          `,
          }}
        />
      </head>
      <body
        className={cn(
          "min-h-svh bg-slate-100 font-sans antialiased",
          inter.className,
        )}
      >
        {/* ✅ 기존 ThemeProvider에 lng prop 전달 */}
        <ThemeProvider
          attribute="class"
          defaultTheme="light"
          enableSystem
          disableTransitionOnChange
          enableColorScheme
          lng={lng} // ✅ lng 전달
        >
          <div vaul-drawer-wrapper="">
            <div className="relative flex min-h-svh flex-col bg-background">
              {children}
            </div>
          </div>
          
          {/* Toast Notifications */}
          <Toaster />
          <ToasterSonner />
        </ThemeProvider>
      </body>
    </html>
  );
}