x
This commit is contained in:
1 parent
04987eebac
commit
b641acbeb7
3 files changed
+22
-35
No files matched your search
@@ -4,7 +4,6 @@ import { generateSeoMetadata } from '@/lib/seo'
|
||||
|
||||
import DynamicPageRenderer from '@/components/dynamic/DynamicPageRenderer'
|
||||
import { getCategoriesResult, getCmsPageResult } from '@/lib/cms'
|
||||
import { splitCmsLayoutSections } from '@/lib/cms-sections'
|
||||
|
||||
// lang is extracted from params
|
||||
const reservedSlugs = new Set([
|
||||
@@ -88,28 +87,14 @@ export default async function CmsCustomPage({ params }: { params: Promise<{ slug
|
||||
if (!page.isPublished) notFound()
|
||||
|
||||
const categories = categoriesResult.ok ? categoriesResult.data : []
|
||||
const sections = page.sections?.filter((section) => section.isActive) ?? []
|
||||
|
||||
if (!categoriesResult.ok) {
|
||||
console.error(`[website-cms] categories unavailable for CMS page "${slug}": ${categoriesResult.error}`)
|
||||
}
|
||||
|
||||
const { announcementSections, heroSections, bottomSections } = splitCmsLayoutSections(sections)
|
||||
const sections = (page.sections ?? [])
|
||||
.filter((section) => section.isActive)
|
||||
.sort((a, b) => (a.order ?? 0) - (b.order ?? 0))
|
||||
|
||||
return (
|
||||
<main className="min-h-[70vh] bg-surface-page text-text-main">
|
||||
{sections.length > 0 ? (
|
||||
<>
|
||||
{announcementSections.length > 0 && (
|
||||
<DynamicPageRenderer sections={announcementSections} categories={categories} lang={lang} />
|
||||
)}
|
||||
{heroSections.length > 0 && (
|
||||
<DynamicPageRenderer sections={heroSections} categories={categories} lang={lang} />
|
||||
)}
|
||||
{bottomSections.length > 0 && (
|
||||
<DynamicPageRenderer sections={bottomSections} categories={categories} lang={lang} />
|
||||
)}
|
||||
</>
|
||||
<DynamicPageRenderer sections={sections} categories={categories} lang={lang} />
|
||||
) : (
|
||||
<div className="mx-auto max-w-4xl px-6 py-24 text-center">
|
||||
<p className="text-xs font-bold uppercase tracking-[0.28em] text-brand-primary"></p>
|
||||
|
||||
@@ -2,7 +2,6 @@ import type { Metadata } from 'next'
|
||||
import { generateSeoMetadata } from '@/lib/seo'
|
||||
import DynamicPageRenderer from '@/components/dynamic/DynamicPageRenderer'
|
||||
import { getCategories, getCmsPage, getStoreSettings } from '@/lib/cms'
|
||||
import { splitCmsLayoutSections } from '@/lib/cms-sections'
|
||||
|
||||
type Props = {
|
||||
params: Promise<{ lang: string }>
|
||||
@@ -46,23 +45,14 @@ export default async function HomePage({ params }: Props) {
|
||||
getCmsPage('home', lang),
|
||||
])
|
||||
|
||||
const sections = page?.sections ?? []
|
||||
const { announcementSections, heroSections, bottomSections } = splitCmsLayoutSections(sections)
|
||||
const sections = (page?.sections ?? [])
|
||||
.filter((section) => section.isActive)
|
||||
.sort((a, b) => (a.order ?? 0) - (b.order ?? 0))
|
||||
|
||||
return (
|
||||
<div className="min-h-screen bg-surface-page text-text-main">
|
||||
{sections.length > 0 ? (
|
||||
<>
|
||||
{announcementSections.length > 0 && (
|
||||
<DynamicPageRenderer sections={announcementSections} categories={categories} lang={lang} />
|
||||
)}
|
||||
{heroSections.length > 0 && (
|
||||
<DynamicPageRenderer sections={heroSections} categories={categories} lang={lang} />
|
||||
)}
|
||||
{bottomSections.length > 0 && (
|
||||
<DynamicPageRenderer sections={bottomSections} categories={categories} lang={lang} />
|
||||
)}
|
||||
</>
|
||||
<DynamicPageRenderer sections={sections} categories={categories} lang={lang} />
|
||||
) : (
|
||||
<section className="mx-auto flex min-h-[70vh] max-w-5xl flex-col items-center justify-center px-6 text-center">
|
||||
<p className="mb-4 ui-eyebrow">
|
||||
|
||||
Reference in new issue
Block a user