import React from 'react'
import { Metadata } from 'next';
import { getAboutData } from '@/lib/api/info/getAboutData';

export type AboutPageProps = { name: string }

type Params = { name: string };

export const revalidate = 60

export const dynamicParams = false // or false, to 404 on unknown paths

export async function generateMetadata({ params }: { params: Promise<Params> }): Promise<Metadata> {
    const { name } = await params;
    const data = await getAboutData(name);

    return {
        title: data.metadata.title || `About | ${name}`,
        description: data.metadata.description || `This is the about-us page for ${name}.`,
    };
}

export async function generateStaticParams() {
    return [
        { name: 'zhivan' }, 
        { name: 'boote' }, 
    ];
}

async function layout({ children }: Readonly<{ children: React.ReactNode; params: Promise<Params> }>) {
    return (
        <>{children}</>
    )
}

export default layout