feat: localize dashboard shell

This commit is contained in:
poyrazavsever
2026-07-19 03:07:10 +03:00
parent 5d3e720280
commit c7a4f3de51
11 changed files with 303 additions and 77 deletions
+26 -13
View File
@@ -1,13 +1,20 @@
"use client";
import { AppShell, type AppShellBranding } from "@/components/layout/app-shell";
import { sidebarData } from "@/config/sidebar";
import { I18nProvider } from "@/components/i18n/i18n-provider";
import { AppShell, type AppShellBranding, type AppShellLabels } from "@/components/layout/app-shell";
import { localizeSidebarData } from "@/config/sidebar";
import type { ColorMode } from "@/lib/color-mode";
import { createTranslatorFromMessages } from "@/lib/i18n";
type DashboardShellProps = {
branding: AppShellBranding;
children: React.ReactNode;
colorMode: ColorMode;
i18n: {
locale: string;
messages: Record<string, string>;
};
labels: AppShellLabels;
user: {
email: string;
displayName: string;
@@ -16,17 +23,23 @@ type DashboardShellProps = {
};
};
export function DashboardShell({ branding, children, colorMode, user }: DashboardShellProps) {
export function DashboardShell({ branding, children, colorMode, i18n, labels, user }: DashboardShellProps) {
const translator = createTranslatorFromMessages(i18n.locale, i18n.messages);
const navGroups = localizeSidebarData(translator.t);
return (
<AppShell
branding={branding}
colorMode={colorMode}
homeHref="/"
navGroups={sidebarData}
settingsHref="/settings"
user={user}
>
{children}
</AppShell>
<I18nProvider locale={i18n.locale} messages={i18n.messages}>
<AppShell
branding={branding}
colorMode={colorMode}
homeHref="/"
labels={labels}
navGroups={navGroups}
settingsHref="/settings"
user={user}
>
{children}
</AppShell>
</I18nProvider>
);
}