import React, { Suspense } from 'react'; import type { Metadata } from 'next'; import { unstable_setRequestLocale } from 'next-intl/server'; import { notFound } from 'next/navigation'; import { getExpertById, getExpertsList } from '../../../../actions/experts'; import { ExpertCard, ExpertCertificate, ExpertInformation, ExpertPractice } from '../../../../components/Experts/ExpertDetails'; import { Details } from '../../../../types/experts'; import { BackButton } from '../../../../components/view/BackButton'; import { i18nText } from '../../../../i18nKeys'; export const metadata: Metadata = { title: 'Bbuddy - Experts item', description: 'Bbuddy desc experts' }; export async function generateStaticParams({ params: { locale }, }: { params: { locale: string } }) { unstable_setRequestLocale(locale); const result: { locale: string, expertId: string }[] = []; const experts = await getExpertsList(locale, { themesTagIds: [] }); experts?.coaches?.forEach(({ id }) => { result.push({ locale, expertId: id.toString() }); }); return result; } export default async function ExpertItem({ params: { expertId = '', locale } }: { params: { expertId: string, locale: string } }) { if (!expertId) notFound(); const expert = await getExpertById(expertId, locale); console.log(expert); const getAssociationLevel = (accLevelId?: number) => { if (accLevelId) { const [cur] = (expert?.associationLevels || []).filter(({ id }) => id === accLevelId) || []; return cur?.name || ''; } return ''; }; const getAssociation = (accLevelId?: number) => { if (accLevelId) { const [curLevel] = (expert?.associationLevels || []).filter(({ id }) => id === accLevelId) || []; if (curLevel) { const [cur] = (expert?.associations || []).filter(({ id }) => id === curLevel.associationId) || []; return cur?.name || ''; } } return ''; }; const generateDescription = ({ id, title, description, document }: Details) => (

{title}

{description}

{document && (
)}
); return (
{i18nText('backToExperts', locale)}

{i18nText('expertBackground', locale)}

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nullam aliquet, lectus nec viverra malesuada, ligula sem tempor risus, non posuere urna diam a libero.

{expert?.publicCoachDetails?.educations && expert.publicCoachDetails.educations?.map(generateDescription)} {expert?.publicCoachDetails?.certificates && expert.publicCoachDetails.certificates.length > 0 && (

{i18nText('profCertification', locale)}

{expert.publicCoachDetails.certificates?.map((cert) => (

{`${getAssociationLevel(cert?.associationLevelId)} ${getAssociation(cert?.associationLevelId)}`}

{cert.document && (
)}
))}
)} {expert?.publicCoachDetails?.trainings && expert.publicCoachDetails.trainings?.map(generateDescription)} {expert?.publicCoachDetails?.mbas && expert.publicCoachDetails.mbas?.map(generateDescription)} {expert?.publicCoachDetails?.experiences && expert.publicCoachDetails.experiences?.map(generateDescription)} {/*

All Offers by this Expert

Engineering & Data
Engineering & Data
+6
Senior Software Engineer
Auth0
I have worked across a variety of organizations, lead teams, and delivered quality software for 8 years. In that time I've worked as an independent consultant, at agencies as a team lead, and as a senior engineer at Auth0. I also host a podcast https://anchor.fm/work-in-programming where I break down how …
Engineering & Data
Engineering & Data
+6
Senior Software Engineer
Auth0
I have worked across a variety of organizations, lead teams, and delivered quality software for 8 years. In that time I've worked as an independent consultant, at agencies as a team lead, and as a senior engineer at Auth0. I also host a podcast https://anchor.fm/work-in-programming where I break down how …
*/}
); };