import React from 'react';
import type { Metadata } from 'next';
import { draftMode } from 'next/headers'
import {unstable_setRequestLocale} from "next-intl/server";
import Link from "next/link";
import {fetchBlogPosts} from "../../../../../lib/contentful/blogPosts";
import {fetchBlogPostCategories} from "../../../../../lib/contentful/blogPostsCategories";
import {BlogPosts} from "../../../../../components/BlogPosts/BlogPosts";

export const metadata: Metadata = {
    title: 'Bbuddy - Blog',
    description: 'Bbuddy desc blog'
};

interface BlogPostPageParams {
    slug: string
    locale: string
}
interface BlogPostPageProps {
    params: BlogPostPageParams
}

export default async function Blog({params, searchParams}: { params: BlogPostPageParams, searhParams?: {page: number}  }) {
    unstable_setRequestLocale(params.locale);
    const page = searchParams.page || undefined
    return (
        <BlogPosts basePath={'/'+params.locale+'/blog/'} locale={params.locale} currentCat={params.slug} page={page}/>
    );
}
