feat(i18n): wire page translation editor and locale rendering
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import { getPublishedPageBySlug } from "@cms/db"
|
||||
import { getPublishedPageBySlugForLocale } from "@cms/db"
|
||||
import { notFound } from "next/navigation"
|
||||
|
||||
import { PublicPageView } from "@/components/public-page-view"
|
||||
@@ -6,12 +6,12 @@ import { PublicPageView } from "@/components/public-page-view"
|
||||
export const dynamic = "force-dynamic"
|
||||
|
||||
type PageProps = {
|
||||
params: Promise<{ slug: string }>
|
||||
params: Promise<{ locale: string; slug: string }>
|
||||
}
|
||||
|
||||
export default async function CmsPageRoute({ params }: PageProps) {
|
||||
const { slug } = await params
|
||||
const page = await getPublishedPageBySlug(slug)
|
||||
const { locale, slug } = await params
|
||||
const page = await getPublishedPageBySlugForLocale(slug, locale)
|
||||
|
||||
if (!page) {
|
||||
notFound()
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { getPublishedPageBySlug, listPosts } from "@cms/db"
|
||||
import { getPublishedPageBySlugForLocale, listPosts } from "@cms/db"
|
||||
import { Button } from "@cms/ui/button"
|
||||
import { getTranslations } from "next-intl/server"
|
||||
import { PublicAnnouncements } from "@/components/public-announcements"
|
||||
@@ -6,9 +6,15 @@ import { PublicPageView } from "@/components/public-page-view"
|
||||
|
||||
export const dynamic = "force-dynamic"
|
||||
|
||||
export default async function HomePage() {
|
||||
type HomePageProps = {
|
||||
params: Promise<{ locale: string }>
|
||||
}
|
||||
|
||||
export default async function HomePage({ params }: HomePageProps) {
|
||||
const { locale } = await params
|
||||
|
||||
const [homePage, posts, t] = await Promise.all([
|
||||
getPublishedPageBySlug("home"),
|
||||
getPublishedPageBySlugForLocale("home", locale),
|
||||
listPosts(),
|
||||
getTranslations("Home"),
|
||||
])
|
||||
|
||||
Reference in New Issue
Block a user