'use client'; // نقشه نشان (Neshan) — از Static Map API استفاده می‌کند. تا وقتی کلید API خالی باشد، // به‌جای نقشه یک پیام راهنما نشان داده می‌شود (نه تصویر خراب). import { useState } from 'react'; import { EnvironmentOutlined } from '@ant-design/icons'; import { useLanguage } from '@/app/context/LanguageContext'; import { useTheme } from '@/app/context/ThemeContext'; import { mapLocations } from '@/data/content'; // --------------------------------------------------------------------------- // Neshan (نشان) map integration. // // TODO: put your Neshan API key here, or (preferred) set it as an environment // variable in `.env.local`: // NEXT_PUBLIC_NESHAN_API_KEY=your-key-here // Get a key from https://platform.neshan.org // --------------------------------------------------------------------------- const NESHAN_API_KEY = process.env.NEXT_PUBLIC_NESHAN_API_KEY || ''; // Neshan's Static Map API — a plain image, no JS SDK/script tag needed. // Verify query param names/values against the current Neshan docs // (https://platform.neshan.org/api/static-map/) if this ever needs updating — // `type` accepts their day/night map styles, e.g. "standard-day" / "standard-night". function staticMapUrl({ lat, lng }, mapStyle) { const params = new URLSearchParams({ key: NESHAN_API_KEY, type: mapStyle, center: `${lat},${lng}`, zoom: '15', size: '600x400', marker: `${lat},${lng}`, }); return `https://api.neshan.org/v5/static?${params.toString()}`; } function neshanViewUrl({ lat, lng }) { return `https://neshan.org/maps/@${lat},${lng},15z`; } function MapThumb({ coords, mapStyle, alt }) { const [errored, setErrored] = useState(false); const { t } = useLanguage(); if (!NESHAN_API_KEY || errored) { return (

{t.map.configNotice}

); } return ( // eslint-disable-next-line @next/next/no-img-element {alt} setErrored(true)} className="w-full h-full object-cover" /> ); } export default function MapSection() { const { t } = useLanguage(); const { theme } = useTheme(); const mapStyle = theme === 'dark' ? 'standard-night' : 'standard-day'; const pins = [ { key: 'factory', label: t.map.factoryLabel, coords: mapLocations.factory, address: t.contactInfo.factoryAddress }, { key: 'sales', label: t.map.salesLabel, coords: mapLocations.salesOffice, address: t.contactInfo.salesOfficeAddress }, ]; return (
{t.map.eyebrow}

{t.map.title}

{pins.map((pin) => (

{pin.label}

{pin.address}

{t.map.openInMaps} ↗
))}
); }