Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
PxlSyl authored and PxlSyl committed Dec 16, 2024
1 parent 412c12c commit 9acdd0d
Show file tree
Hide file tree
Showing 7 changed files with 28 additions and 48 deletions.
16 changes: 8 additions & 8 deletions app/[locale]/about/[...authors]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,33 +8,33 @@ import { createTranslation } from 'app/[locale]/i18n/server'
import { LocaleTypes } from 'app/[locale]/i18n/settings'
import { notFound } from 'next/navigation'

type AboutProps = {
params: {
interface PageProps {
params: Promise<{
authors: string[]
locale: LocaleTypes
}
locale: LocaleTypes
}>
}

export async function generateMetadata({
params
}: AboutProps): Promise<Metadata | undefined> {
}: PageProps): Promise<Metadata | undefined> {
const { authors, locale } = await params
const authorSlug = decodeURI(authors.join('/'))
const author = allAuthors.find((a) => a.slug === authorSlug && a.language === locale) as Authors
if (!author) {
return
}
const { t } = await createTranslation(locale, 'about')

return genPageMetadata({
title: author.name,
description: author.occupation,
title: `${t('about')} ${author.name}`,
params: { locale },
})
}

export default async function Page({
params
}: AboutProps) {
}: PageProps) {
const { authors, locale } = await params
const authorSlug = decodeURI(authors.join('/'))
const author = allAuthors.find((a) => a.slug === authorSlug && a.language === locale) as Authors
Expand Down
18 changes: 8 additions & 10 deletions app/[locale]/blog/[...slug]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@ import { notFound } from 'next/navigation'
import { LocaleTypes } from 'app/[locale]/i18n/settings'

interface BlogPageProps {
params: {
params: {
slug: string[]
locale: LocaleTypes
locale: LocaleTypes
}
}

Expand Down Expand Up @@ -56,9 +56,7 @@ async function getPostFromParams({ params: { slug, locale } }: BlogPageProps): P
return post
}

export async function generateMetadata({
params
}: BlogPageProps): Promise<Metadata | undefined> {
export async function generateMetadata({ params }: BlogPageProps): Promise<Metadata | undefined> {
const { slug, locale } = await params
const dslug = decodeURI(slug.join('/'))
const post = allBlogs.find((p) => p.slug === dslug && p.language === locale) as Blog
Expand Down Expand Up @@ -116,14 +114,14 @@ export const generateStaticParams = async () => {
return paths
}

export default async function Page({
params
}: {
params: { slug: string[], locale: LocaleTypes }
export default async function Page({
params,
}: {
params: { slug: string[]; locale: LocaleTypes }
}) {
const { slug, locale } = await params
const dslug = decodeURI(slug.join('/'))

const sortedCoreContents = allCoreContent(
sortPosts(allBlogs.filter((p) => p.language === locale))
)
Expand Down
8 changes: 2 additions & 6 deletions app/[locale]/blog/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,19 +10,15 @@ type BlogPageProps = {
params: { locale: LocaleTypes }
}

export async function generateMetadata({
params
}: BlogPageProps): Promise<Metadata> {
export async function generateMetadata({ params }: BlogPageProps): Promise<Metadata> {
const locale = (await params).locale
return genPageMetadata({
title: 'Blog',
params: { locale },
})
}

export default async function BlogPage({
params
}: BlogPageProps) {
export default async function BlogPage({ params }: BlogPageProps) {
const locale = (await params).locale
const { t } = await createTranslation(locale, 'home')
const posts = allCoreContent(sortPosts(allBlogs))
Expand Down
4 changes: 2 additions & 2 deletions app/[locale]/layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ export async function generateMetadata({
params: { locale: LocaleTypes }
}): Promise<Metadata> {
const locale = (await params).locale

return {
metadataBase: new URL(siteMetadata.siteUrl),
title: {
Expand Down Expand Up @@ -84,7 +84,7 @@ export default async function RootLayout({
params: { locale: LocaleTypes }
}) {
const locale = (await params).locale

return (
<html
lang={locale}
Expand Down
8 changes: 2 additions & 6 deletions app/[locale]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,9 @@ import FeaturedLayout from '@/layouts/FeaturedLayout'
import HomeLayout from '@/layouts/HomeLayout'
import { LocaleTypes } from './i18n/settings'

export default async function Page({
params,
}: {
params: { locale: LocaleTypes }
}) {
export default async function Page({ params }: { params: { locale: LocaleTypes } }) {
const locale = (await params).locale

const sortedPosts = sortPosts(allBlogs)
const posts = allCoreContent(sortedPosts)
const filteredPosts = posts.filter((p) => p.language === locale)
Expand Down
14 changes: 4 additions & 10 deletions app/[locale]/projects/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,20 +8,16 @@ type ProjectsProps = {
params: { locale: LocaleTypes }
}

export async function generateMetadata({
params
}: ProjectsProps): Promise<Metadata> {
export async function generateMetadata({ params }: ProjectsProps): Promise<Metadata> {
const locale = (await params).locale
const { t } = await createTranslation(locale, 'projects')
return genPageMetadata({
title: t('title'),
params: { locale }
params: { locale },
})
}

export default async function Projects({
params
}: ProjectsProps) {
export default async function Projects({ params }: ProjectsProps) {
const locale = (await params).locale
const { t } = await createTranslation(locale, 'projects')
return (
Expand All @@ -31,9 +27,7 @@ export default async function Projects({
<h1 className="text-3xl font-extrabold leading-9 tracking-tight text-gray-900 dark:text-gray-100 sm:text-4xl sm:leading-10 md:text-6xl md:leading-14">
{t('title')}
</h1>
<p className="text-lg leading-7 text-gray-500 dark:text-gray-400">
{t('description')}
</p>
<p className="text-lg leading-7 text-gray-500 dark:text-gray-400">{t('description')}</p>
</div>
<div className="container py-12">
<div className="-m-4 flex flex-wrap">
Expand Down
8 changes: 2 additions & 6 deletions app/[locale]/tags/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,7 @@ type TagsProps = {
params: { locale: LocaleTypes }
}

export async function generateMetadata({
params
}: TagsProps): Promise<Metadata> {
export async function generateMetadata({ params }: TagsProps): Promise<Metadata> {
const locale = (await params).locale
const { t } = await createTranslation(locale, 'SEO')
return genPageMetadata({
Expand All @@ -21,9 +19,7 @@ export async function generateMetadata({
})
}

export default async function Page({
params
}: TagsProps) {
export default async function Page({ params }: TagsProps) {
const locale = (await params).locale
const tagCounts = tagData[locale]
const tagKeys = Object.keys(tagCounts)
Expand Down

0 comments on commit 9acdd0d

Please sign in to comment.