* feat: use next-intl * feat: set next-intl localePrefix to never * chore: add next-intl * chore: fix lock file * feat: use [locale] * fix: the custom rewrite conflict with next-intl rewrite in middleware * fix: getTranslations function name * fix: remove comma in translation key * fix: next-intl dev error * feat: update tran text * feat: transaction for about page * feat: i18n for server components * feat: i18n for client components * feat: i18n for client components and provider * feat: i18n for language switch * feat: remove i18next * feat: custom intl error, ignore MISSING_MESSAGE error * feat: use useLocale * fix: unstable_setRequestLocale for middleware error
62 lines
1.6 KiB
TypeScript
62 lines
1.6 KiB
TypeScript
import { useTranslations } from "next-intl"
|
|
import { useParams } from "next/navigation"
|
|
import React from "react"
|
|
|
|
import { useXSettingsModal } from "@crossbell/connect-kit"
|
|
|
|
import { Tabs, type TabItem } from "../ui/Tabs"
|
|
import { DashboardMain } from "./DashboardMain"
|
|
|
|
export const SettingsLayout = ({
|
|
title,
|
|
children,
|
|
}: {
|
|
title: string
|
|
children: React.ReactNode
|
|
}) => {
|
|
const t = useTranslations()
|
|
const xSettingsModal = useXSettingsModal()
|
|
|
|
const params = useParams()
|
|
const subdomain = params?.subdomain as string
|
|
const tabItems: TabItem[] = [
|
|
{ text: "General", href: `/dashboard/${subdomain}/settings/general` },
|
|
{
|
|
text: "Social Platforms",
|
|
href: `/dashboard/${subdomain}/settings/social-platforms`,
|
|
},
|
|
{
|
|
text: "Navigation",
|
|
href: `/dashboard/${subdomain}/settings/navigation`,
|
|
},
|
|
{ text: "Domains", href: `/dashboard/${subdomain}/settings/domains` },
|
|
{ text: "Custom CSS", href: `/dashboard/${subdomain}/settings/css` },
|
|
{
|
|
text: "Operators",
|
|
href: `/dashboard/${subdomain}/settings/operator`,
|
|
},
|
|
{
|
|
text: "xSettings",
|
|
onClick: () => xSettingsModal.show(),
|
|
},
|
|
{
|
|
text: "Export data",
|
|
href: `https://export.crossbell.io/?handle=${subdomain}`,
|
|
},
|
|
]
|
|
|
|
return (
|
|
<DashboardMain>
|
|
<div className="">
|
|
<header className="mb-8">
|
|
<h2 className="text-2xl font-bold">{t(title)}</h2>
|
|
</header>
|
|
<div>
|
|
<Tabs items={tabItems} />
|
|
<div className="max-w-screen-md">{children}</div>
|
|
</div>
|
|
</div>
|
|
</DashboardMain>
|
|
)
|
|
}
|