+
{ data.aboutSuper?.[0]?.body || '' }
@@ -64,7 +62,7 @@ export default async function About({lang}) {
-
+
{ data.about2Head?.[0]?.body || '' }
@@ -79,7 +77,7 @@ export default async function About({lang}) {
-
+
)
diff --git a/components/Header.js b/components/Header.js
old mode 100755
new mode 100644
index 7ae231d..bfdc4f1
--- a/components/Header.js
+++ b/components/Header.js
@@ -1,48 +1,112 @@
-import Link from 'next/link';
+"use client"
-export default function Header(){
+import Link from 'next/link'
+import { usePathname } from 'next/navigation'
+import { useState } from 'react'
+const locales = ['fa', 'en']
+
+function getLocalizedPath(pathname, nextLocale) {
+ const parts = pathname.split('/').filter(Boolean)
+
+ if (locales.includes(parts[0])) {
+ parts[0] = nextLocale
+ return `/${parts.join('/')}`
+ }
+
+ return `/${nextLocale}${pathname === '/' ? '' : pathname}`
+}
+
+function MenuIcon({ open }) {
return (
-
-
-
-
-
-
-
- English
-
- /
-
- فارسی
-
-
-
+
)
}
+function Logo() {
+ return (
+
+ )
+}
+
+export default function Header({ lang = 'fa' }){
+ const pathname = usePathname()
+ const [isOpen, setIsOpen] = useState(false)
+ const isFa = lang === 'fa'
+ const basePath = `/${lang}`
+ 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' },
+ ]
+
+ return (
+
+ )
+}
diff --git a/components/ProductCard.js b/components/ProductCard.js
index fccc095..615eb51 100755
--- a/components/ProductCard.js
+++ b/components/ProductCard.js
@@ -1,15 +1,14 @@
import Image from 'next/image'
-import productpic from '../public/productpic.webp'
export default function ProductCard({ image, desc }) {
return (
-
-
-
+
+
+
-
)
-}
\ No newline at end of file
+}
diff --git a/components/Production.js b/components/Production.js
index e9beb70..9bcb503 100755
--- a/components/Production.js
+++ b/components/Production.js
@@ -1,7 +1,6 @@
import Image from 'next/image'
-
-import CategoryImage from '../public/img.png'
+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}`)
@@ -24,7 +23,7 @@ export default async function Production({ lang }){
}
return(
-
+
{ data.equipmentSuper?.[0]?.body || '' }
@@ -63,34 +62,34 @@ export default async function Production({ lang }){
{ data.equipmentDesc?.[0]?.body || '' }
-
-
-
-
-
{ data.equipment3Title?.[0]?.body || '' }
-
{ data.equipment3Desc?.[0]?.body || '' }
+
+
+
+
+
{ data.equipment3Title?.[0]?.body || '' }
+
{ data.equipment3Desc?.[0]?.body || '' }
-
-
-
-
{ data.equipment3Title?.[1]?.body || '' }
-
{ data.equipment3Desc?.[1]?.body || '' }
+
+
+
+
{ data.equipment3Title?.[1]?.body || '' }
+
{ data.equipment3Desc?.[1]?.body || '' }
-
-
-
{ data.equipment3Title?.[2]?.body || '' }
-
{ data.equipment3Desc?.[2]?.body || '' }
+
+
+
{ data.equipment3Title?.[2]?.body || '' }
+
{ data.equipment3Desc?.[2]?.body || '' }
-
+
-
-
-
{ data.equipment3Title?.[3]?.body || '' }
-
{ data.equipment3Desc?.[3]?.body || '' }
+
+
+
{ data.equipment3Title?.[3]?.body || '' }
+
{ data.equipment3Desc?.[3]?.body || '' }
-
+
diff --git a/components/Products.js b/components/Products.js
index c240c53..3d7ca74 100755
--- a/components/Products.js
+++ b/components/Products.js
@@ -1,6 +1,7 @@
import Image from 'next/image'
import productbg from '../public/productbg.webp'
import ProductCard from '@/components/ProductCard'
+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}`)
@@ -22,18 +23,18 @@ export default async function Products({ lang }){
}
return(
-
-
+
+
{data.productsSuper?.[0]?.body || ''}
{data.productsHead?.[0]?.body || ''}
{data.productsDesc?.[0]?.body || ''}
-
+
{
- data.productImages?.map((image, index) => (
-
- )) || []
+ productImages.map((image, index) => (
+
+ ))
}
diff --git a/lib/localImages.js b/lib/localImages.js
new file mode 100644
index 0000000..7de9a9d
--- /dev/null
+++ b/lib/localImages.js
@@ -0,0 +1,20 @@
+export const aboutImages = {
+ primary: "/images/about-production.jpg",
+ secondary: "/images/about-magnesium-rock.jpg",
+}
+
+export const productImages = [
+ "/images/product-ingot-stack.jpg",
+ "/images/product-plates.jpg",
+ "/images/product-anode-bars.jpg",
+ "/images/product-cnc-parts.jpg",
+ "/images/product-machined-anodes.jpg",
+ "/images/product-sacrificial-anodes.jpg",
+]
+
+export const equipmentImages = [
+ "/images/equipment-furnace.jpg",
+ "/images/equipment-electrotherm-line.jpg",
+ "/images/equipment-casting-machine.jpg",
+ "/images/equipment-press-machine.jpg",
+]
diff --git a/middleware.js b/middleware.js
index 14e1b34..fbb1e41 100755
--- a/middleware.js
+++ b/middleware.js
@@ -40,9 +40,9 @@ export function middleware(request) {
export const config = {
matcher: [
- // Skip all internal paths (_next)
- '/((?!_next).*)',
+ // Skip internal Next.js paths and public files.
+ '/((?!_next|.*\\..*).*)',
// Optional: only run on root (/) URL
// '/'
],
-}
\ No newline at end of file
+}