feat(core): update
This commit is contained in:
@@ -1,21 +1,12 @@
|
||||
import Image from 'next/image'
|
||||
import PicAbout from '../public/PicAbout.png'
|
||||
import Link from 'next/link'
|
||||
import { getPublicContent } from '@/lib/content'
|
||||
import { aboutImages } 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 About({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') {
|
||||
@@ -62,7 +53,7 @@ export default async function About({lang}) {
|
||||
</p>
|
||||
<Image alt="" src={PicAbout} className=''/>
|
||||
</div>
|
||||
<Image alt="" src={aboutImages.primary} width={800} height={800} className='row-span-3 h-full min-h-80 w-full object-cover rounded-xl'/>
|
||||
<Image alt="" src={aboutImages.primary} width={800} height={800} unoptimized className='row-span-3 h-full min-h-80 w-full object-cover rounded-xl'/>
|
||||
|
||||
<div className='row-span-2 flex flex-col justify-between py-10 px-8 bg-zinc-100 rounded-xl h-full'>
|
||||
<span className='font-[4] text-xl'>{ data.about2Head?.[0]?.body || '' }</span>
|
||||
@@ -77,7 +68,7 @@ export default async function About({lang}) {
|
||||
</div>
|
||||
</Link>
|
||||
</div>
|
||||
<Image alt="" src={aboutImages.secondary} width={800} height={800} className='max-h-56 min-h-48 object-cover rounded-xl w-full h-full'/>
|
||||
<Image alt="" src={aboutImages.secondary} width={800} height={800} unoptimized className='max-h-56 min-h-48 object-cover rounded-xl w-full h-full'/>
|
||||
</div>
|
||||
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user