11import React from "react" ;
22import projectsData from "@/db/static/projects" ;
3+ import { getProjectImageBlurData } from "@/db/static/projectImageBlurData" ;
34import ProjectCard from "@/features/Projects/Cards/ProjectCard" ;
45import { Metadata } from "next" ;
5- import { getBase64 } from "@/lib/getBase64ImageUrl" ;
66import { getTranslations , setRequestLocale } from "next-intl/server" ;
77import { notFound } from "next/navigation" ;
88import { locales } from "@/navigation" ;
9+
10+ export const dynamic = "force-static" ;
11+ export const dynamicParams = false ;
12+
913export async function generateMetadata ( {
1014 params,
1115} : {
1216 params : Promise < { endpoint : string ; locale : string } > ;
1317} ) : Promise < Metadata > {
1418 const { locale, endpoint } = await params ;
15- const project = projectsData . filter (
19+ const project = projectsData . find (
1620 ( project ) => project . endpoint === endpoint
17- ) [ 0 ] ;
21+ ) ;
22+ if ( ! project ) notFound ( ) ;
23+
1824 return {
19- title : project ? .title [ locale as "en" | "tr" ] ,
20- description : project ? .description [ locale as "en" | "tr" ] ,
25+ title : project . title [ locale as "en" | "tr" ] ,
26+ description : project . description [ locale as "en" | "tr" ] ,
2127 openGraph : {
2228 type : "website" ,
2329 locale : locale ,
24- url : `/projects/${ project ? .endpoint } ` ,
25- title : `${ project ? .title [ locale as "en" | "tr" ] } | Furkan Cengiz` ,
26- description : project ? .description [ locale as "en" | "tr" ] ,
30+ url : `/projects/${ project . endpoint } ` ,
31+ title : `${ project . title [ locale as "en" | "tr" ] } | Furkan Cengiz` ,
32+ description : project . description [ locale as "en" | "tr" ] ,
2733 images : [
2834 {
29- url : project ? .images [ 0 ] . src ,
30- alt : project ? .images [ 0 ] . alt ,
35+ url : project . images [ 0 ] . src ,
36+ alt : project . images [ 0 ] . alt ,
3137 } ,
3238 ] ,
3339 } ,
3440 alternates : {
35- canonical : `/projects/${ project ? .endpoint } ` ,
41+ canonical : `/projects/${ project . endpoint } ` ,
3642 languages : {
37- en : `/projects/${ project ? .endpoint } ` ,
38- tr : `/tr/projeler/${ project ? .endpoint } ` ,
43+ en : `/projects/${ project . endpoint } ` ,
44+ tr : `/tr/projeler/${ project . endpoint } ` ,
3945 } ,
4046 } ,
4147 } ;
@@ -54,18 +60,17 @@ export default async function Project({
5460} ) {
5561 const { endpoint, locale } = await params ;
5662 setRequestLocale ( locale ) ;
57- const project = projectsData . filter (
63+ const project = projectsData . find (
5864 ( project ) => project . endpoint === endpoint
59- ) [ 0 ] ;
65+ ) ;
6066
6167 if ( ! project ) notFound ( ) ;
6268 const t = await getTranslations ( "Project" ) ;
63- const blurredImage = await getBase64 ( project . images [ 0 ] . src ) ;
6469 return (
6570 < section className = "relative z-20 mx-auto mb-auto w-full max-w-7xl px-4 py-10 sm:px-6 sm:py-14 lg:px-8" >
6671 < ProjectCard
6772 project = { project }
68- blurredImage = { blurredImage }
73+ blurredImage = { getProjectImageBlurData ( project . endpoint ) }
6974 repoLinkText = {
7075 endpoint === "Turkish-Dictionary"
7176 ? t ( "repo-link.contribute" )
0 commit comments