feat(web): polish commission flow and default public navigation
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
import { listPublicNavigation } from "@cms/db"
|
||||
import { getLocale } from "next-intl/server"
|
||||
import { getLocale, getTranslations } from "next-intl/server"
|
||||
|
||||
import { Link } from "@/i18n/navigation"
|
||||
|
||||
@@ -7,7 +7,33 @@ import { LanguageSwitcher } from "./language-switcher"
|
||||
|
||||
export async function PublicSiteHeader() {
|
||||
const locale = await getLocale()
|
||||
const navItems = await listPublicNavigation("header", locale)
|
||||
const [navItems, t] = await Promise.all([
|
||||
listPublicNavigation("header", locale),
|
||||
getTranslations("Layout.nav"),
|
||||
])
|
||||
const fallbackNavItems = [
|
||||
{
|
||||
id: "fallback-home",
|
||||
href: "/",
|
||||
label: t("home"),
|
||||
},
|
||||
{
|
||||
id: "fallback-portfolio",
|
||||
href: "/portfolio",
|
||||
label: t("portfolio"),
|
||||
},
|
||||
{
|
||||
id: "fallback-news",
|
||||
href: "/news",
|
||||
label: t("news"),
|
||||
},
|
||||
{
|
||||
id: "fallback-commissions",
|
||||
href: "/commissions",
|
||||
label: t("commissions"),
|
||||
},
|
||||
]
|
||||
const resolvedNavItems = navItems.length > 0 ? navItems : fallbackNavItems
|
||||
|
||||
return (
|
||||
<header className="border-b border-neutral-200 bg-white/80 backdrop-blur">
|
||||
@@ -20,24 +46,15 @@ export async function PublicSiteHeader() {
|
||||
</Link>
|
||||
|
||||
<nav className="flex flex-wrap items-center gap-2">
|
||||
{navItems.length === 0 ? (
|
||||
{resolvedNavItems.map((item) => (
|
||||
<Link
|
||||
href="/"
|
||||
key={item.id}
|
||||
href={item.href}
|
||||
className="rounded-md border border-neutral-300 px-3 py-1.5 text-sm font-medium text-neutral-700 hover:bg-neutral-100"
|
||||
>
|
||||
Home
|
||||
{item.label}
|
||||
</Link>
|
||||
) : (
|
||||
navItems.map((item) => (
|
||||
<Link
|
||||
key={item.id}
|
||||
href={item.href}
|
||||
className="rounded-md border border-neutral-300 px-3 py-1.5 text-sm font-medium text-neutral-700 hover:bg-neutral-100"
|
||||
>
|
||||
{item.label}
|
||||
</Link>
|
||||
))
|
||||
)}
|
||||
))}
|
||||
</nav>
|
||||
|
||||
<LanguageSwitcher />
|
||||
|
||||
Reference in New Issue
Block a user