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>
|
||||
|
||||
)
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import Crown from '@/components/Crown'
|
||||
import { getPublicContent } from '@/lib/content'
|
||||
|
||||
export function RMGPSVG (){
|
||||
return (
|
||||
@@ -21,19 +22,8 @@ export function RMGPSVG (){
|
||||
)
|
||||
}
|
||||
|
||||
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 Footer({ 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') {
|
||||
|
||||
@@ -54,12 +54,12 @@ export default function Header({ lang = 'fa' }){
|
||||
const pathname = usePathname()
|
||||
const [isOpen, setIsOpen] = useState(false)
|
||||
const isFa = lang === 'fa'
|
||||
const basePath = `/${lang}`
|
||||
const basePath = `/${lang}/home`
|
||||
const items = [
|
||||
{ href: `${basePath}#about`, label: isFa ? 'درباره ما' : 'About' },
|
||||
{ href: `${basePath}#products`, label: isFa ? 'محصولات' : 'Products' },
|
||||
{ href: `${basePath}#production`, label: isFa ? 'تجهیزات' : 'Equipment' },
|
||||
{ href: `${basePath}/management`, label: isFa ? 'مدیریت' : 'Management' },
|
||||
{ href: `/${lang}/management`, label: isFa ? 'مدیریت' : 'Management' },
|
||||
]
|
||||
|
||||
return (
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import Image from 'next/image'
|
||||
import bg from '../public/bg.webp'
|
||||
import MG from '@/components/MG'
|
||||
import { getPublicContent } from '@/lib/content'
|
||||
|
||||
export function RMGPSVG (){
|
||||
return (
|
||||
@@ -56,20 +57,9 @@ const circles = (
|
||||
|
||||
)
|
||||
|
||||
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 Hero({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') {
|
||||
|
||||
@@ -4,7 +4,7 @@ export default function ProductCard({ image, desc }) {
|
||||
return (
|
||||
<div className="flex w-[230px] shrink-0 flex-col overflow-hidden rounded-lg bg-red-950 sm:w-[270px] lg:w-[300px]" style={{boxShadow : "0px 32px 40px 0px rgba(0, 0, 0, 0.16)"}}>
|
||||
<div className="flex aspect-square w-full items-center justify-center bg-white p-4">
|
||||
<Image alt="" src={image} width={500} height={500} className="h-full w-full object-contain object-center"/>
|
||||
<Image alt="" src={image} width={500} height={500} unoptimized className="h-full w-full object-contain object-center"/>
|
||||
</div>
|
||||
<div className="flex min-h-24 items-center bg-red-950 p-4 text-sm text-white sm:p-6 sm:text-md">
|
||||
<p className="line-clamp-3">{ desc }</p>
|
||||
|
||||
@@ -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>
|
||||
|
||||
|
||||
@@ -1,20 +1,11 @@
|
||||
import Image from 'next/image'
|
||||
import productbg from '../public/productbg.webp'
|
||||
import ProductCard from '@/components/ProductCard'
|
||||
import { getPublicContent } from '@/lib/content'
|
||||
import { productImages } 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 Products({ 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') {
|
||||
@@ -33,7 +24,7 @@ export default async function Products({ lang }){
|
||||
<div className="z-10 flex gap-4 overflow-x-auto px-6 py-16 sm:px-10 lg:flex-wrap lg:justify-center lg:gap-6 lg:px-28">
|
||||
{
|
||||
productImages.map((image, index) => (
|
||||
<ProductCard key={image} image={image} desc={data.productDescs?.[index]?.body || ''} />
|
||||
<ProductCard key={image.src} image={image} desc={data.productDescs?.[index]?.body || ''} />
|
||||
))
|
||||
}
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user