feat(core): update
This commit is contained in:
@@ -1,20 +1,11 @@
|
||||
|
||||
import Image from 'next/image'
|
||||
import { getPublicContent } from '@/lib/content'
|
||||
import { equipmentImages } from '@/lib/localImages'
|
||||
|
||||
async function getData(id) {
|
||||
const res = await fetch(`${process.env.NEXT_PUBLIC_API_BASE_URL}/api/public/content/index/${id}`)
|
||||
|
||||
if (!res.ok) {
|
||||
throw new Error('Failed to fetch data')
|
||||
}
|
||||
|
||||
return res.json()
|
||||
}
|
||||
|
||||
export default async function Production({ lang }){
|
||||
|
||||
const data = await getData(lang === 'fa' ? 1 : 2);
|
||||
const data = await getPublicContent(lang);
|
||||
|
||||
// Add safety checks for data structure
|
||||
if (!data || typeof data !== 'object') {
|
||||
@@ -64,14 +55,14 @@ export default async function Production({ lang }){
|
||||
</div>
|
||||
<div className="grid grid-cols-1 bg-zinc-100 font-[5] lg:grid-cols-2">
|
||||
<div className="flex min-h-[220px] w-full overflow-hidden">
|
||||
<Image alt="" src={equipmentImages[0]} width={500} height={500} className="min-h-[220px] w-1/2 object-cover"/>
|
||||
<Image alt="" src={equipmentImages[0]} width={500} height={500} unoptimized className="min-h-[220px] w-1/2 object-cover"/>
|
||||
<div className="flex w-1/2 flex-col justify-center p-4 text-sm sm:p-6 sm:text-base lg:p-10">
|
||||
<span className="pb-4 font-[4] text-xl text-black-1 lg:text-2xl"> { data.equipment3Title?.[0]?.body || '' }</span>
|
||||
<p className="font-[5] text-black-1">{ data.equipment3Desc?.[0]?.body || '' }</p>
|
||||
</div>
|
||||
</div>
|
||||
<div className="flex min-h-[220px] w-full flex-row-reverse overflow-hidden lg:flex-row">
|
||||
<Image alt="" src={equipmentImages[1]} width={500} height={500} className="min-h-[220px] w-1/2 object-cover"/>
|
||||
<Image alt="" src={equipmentImages[1]} width={500} height={500} unoptimized className="min-h-[220px] w-1/2 object-cover"/>
|
||||
<div className="flex w-1/2 flex-col justify-center p-4 text-sm sm:p-6 sm:text-base lg:p-10">
|
||||
<span className="pb-4 font-[4] text-xl text-black-1 lg:text-2xl"> { data.equipment3Title?.[1]?.body || '' }</span>
|
||||
<p className="font-[5] text-black-1">{ data.equipment3Desc?.[1]?.body || '' }</p>
|
||||
@@ -82,14 +73,14 @@ export default async function Production({ lang }){
|
||||
<span className="pb-4 font-[4] text-xl text-black-1 lg:text-2xl"> { data.equipment3Title?.[2]?.body || '' }</span>
|
||||
<p className="font-[5] text-black-1">{ data.equipment3Desc?.[2]?.body || '' }</p>
|
||||
</div>
|
||||
<Image alt="" src={equipmentImages[2]} width={500} height={500} className="min-h-[220px] w-1/2 object-cover"/>
|
||||
<Image alt="" src={equipmentImages[2]} width={500} height={500} unoptimized className="min-h-[220px] w-1/2 object-cover"/>
|
||||
</div>
|
||||
<div className="flex min-h-[220px] w-full overflow-hidden">
|
||||
<div className="flex w-1/2 flex-col justify-center p-4 text-sm sm:p-6 sm:text-base lg:p-10">
|
||||
<span className="pb-4 font-[4] text-xl text-black-1 lg:text-2xl"> { data.equipment3Title?.[3]?.body || '' }</span>
|
||||
<p className="font-[5] text-black-1">{ data.equipment3Desc?.[3]?.body || '' }</p>
|
||||
</div>
|
||||
<Image alt="" src={equipmentImages[3]} width={500} height={500} className="min-h-[220px] w-1/2 object-cover"/>
|
||||
<Image alt="" src={equipmentImages[3]} width={500} height={500} unoptimized className="min-h-[220px] w-1/2 object-cover"/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user