feat: persist portal invitation locales

This commit is contained in:
poyrazavsever
2026-07-19 03:07:35 +03:00
parent c1c473469a
commit 0158f2f25a
10 changed files with 249 additions and 46 deletions
+27 -13
View File
@@ -1,8 +1,11 @@
"use client";
import type { ComponentProps } from "react";
import { AppShell, type AppShellBranding } from "@/components/layout/app-shell";
import { portalSidebarData } from "@/config/portal-sidebar";
import { I18nProvider } from "@/components/i18n/i18n-provider";
import { localizePortalSidebarData } from "@/config/portal-sidebar";
import type { ColorMode } from "@/lib/color-mode";
import { createTranslatorFromMessages } from "@/lib/i18n";
type PortalShellProps = {
branding: AppShellBranding;
@@ -15,20 +18,31 @@ type PortalShellProps = {
avatarUrl: string | null;
};
progress?: number;
i18n: {
locale: string;
messages: Record<string, string>;
};
labels?: ComponentProps<typeof AppShell>["labels"];
};
export function PortalShell({ branding, children, colorMode, user, progress }: PortalShellProps) {
export function PortalShell({ branding, children, colorMode, user, progress, i18n, labels }: PortalShellProps) {
const translator = createTranslatorFromMessages(i18n.locale, i18n.messages);
const navGroups = localizePortalSidebarData(translator.t);
return (
<AppShell
branding={branding}
colorMode={colorMode}
homeHref="/portal"
navGroups={portalSidebarData}
settingsHref="/portal/settings"
user={user}
progress={progress}
>
{children}
</AppShell>
<I18nProvider locale={i18n.locale} messages={i18n.messages}>
<AppShell
branding={branding}
colorMode={colorMode}
homeHref="/portal"
navGroups={navGroups}
settingsHref="/portal/settings"
user={user}
progress={progress}
labels={labels}
>
{children}
</AppShell>
</I18nProvider>
);
}