import { useState, useEffect } from 'react' import { useLang } from '@/context/LangContext' import SnapshotBar from '@/pages/Home/sections/SnapshotBar' const STATS = { fa: [ { label: 'تولید فولاد خام', value: '۳۱.۲', unit: 'میلیون تن', delta: '+۴.۱٪' }, { label: 'صادرات فولاد', value: '۸.۷', unit: 'میلیون تن', delta: '+۱.۸٪' }, { label: 'واردات سنگ‌آهن', value: '۱۲.۴', unit: 'میلیون تن', delta: '-۲.۳٪' }, { label: 'ظرفیت نصب‌شده', value: '۳۸', unit: 'میلیون تن', delta: '—' }, ], en: [ { label: 'Crude Steel Production', value: '31.2', unit: 'Million tons', delta: '+4.1%' }, { label: 'Steel Exports', value: '8.7', unit: 'Million tons', delta: '+1.8%' }, { label: 'Iron Ore Imports', value: '12.4', unit: 'Million tons', delta: '-2.3%' }, { label: 'Installed Capacity', value: '38', unit: 'Million tons', delta: '—' }, ], } const T = { fa: { overline: 'MARKET & STEEL CHAIN', heading: 'بازار و زنجیره فولاد', sub: 'سامانه جامع آمار و اطلاعات صنعت فولاد ایران — داده‌های لحظه‌ای تولید، صادرات، واردات و قیمت‌ها', statsLabel: 'آمار کلیدی صنعت · ۱۴۰۳', gateAccess: 'دسترسی اعضا', gateHeading: 'دسترسی کامل به سامانه بازار و زنجیره فولاد', gateSub: 'اعضای اندیشکده به پایگاه داده جامع فولاد ایران شامل آمار لحظه‌ای تولید، صادرات، واردات، قیمت‌های داخلی و بین‌المللی و ۵۰۰+ شاخص صنعتی دسترسی دارند.', features: [ 'داده‌های لحظه‌ای تولید کارخانه‌های بزرگ', 'آمار صادرات تفکیک‌شده بر اساس کشور مقصد', 'نمودارهای تعاملی و قابل دانلود', 'گزارش‌های تحلیلی ماهانه اختصاصی', ], cta: 'درخواست عضویت سازمانی ←', ctaDone: '✓ درخواست شما ثبت شد. تیم ما ظرف ۴۸ ساعت با شما تماس می‌گیرد.', }, en: { overline: 'MARKET & STEEL CHAIN', heading: 'Market & Steel Chain', sub: 'Comprehensive statistics and data platform for Iran\'s steel industry — live production, export, import, and price data', statsLabel: 'KEY INDUSTRY STATS · 1403', gateAccess: 'MEMBERS ONLY', gateHeading: 'Full Access to Market & Steel Chain', gateSub: 'Institute members have access to Iran\'s comprehensive steel database including live production stats, export/import data, domestic and international prices, and 500+ industrial indicators.', features: [ 'Real-time production data from major plants', 'Export statistics broken down by destination country', 'Interactive downloadable charts', 'Exclusive monthly analytical reports', ], cta: 'Request Organizational Membership →', ctaDone: '✓ Your request has been received. Our team will contact you within 48 hours.', }, } const TX = { fa: { tableHeaders: ['عنوان', 'بیشترین', 'کمترین', 'آخرین', '۳۰ روز', '۶۰ روز', '۹۰ روز', '۱۸۰ روز', '۳۶۰ روز'], paywallCta: 'برای مشاهده کامل، عضویت سازمانی دریافت کنید ←', coverageTitle: 'پوشش قیمتی زنجیره فولاد', productLabel: 'محصول', indexLabel: 'شاخص', sourceLabel: 'منبع داده', membersOnly: 'MEMBERS ONLY', coverageDesc: 'دسترسی کامل به قیمت‌های لحظه‌ای، تاریخی و گزارش‌های تحلیلی هفتگی برای تمام محصولات.', coverageFeatures: ['قیمت‌های لحظه‌ای و تاریخی', 'گزارش‌های هفتگی اختصاصی', 'نمودارهای تعاملی دانلودی', 'پشتیبانی تحلیلی'], sectionsLabel: 'حوزه‌های پوشش', contentSections: ['صنعت فولاد', 'بازار سرمایه', 'فلزات و کامودیتی', 'ارزهای دیجیتال', 'بازار ارز و طلا', 'اقتصاد کلان'], dsTitle: 'دسترسی به گزارش‌های Platts، Fastmarkets و منابع برتر جهانی', dsBody: 'بیشتر سازمان‌های ایرانی به این منابع دسترسی ندارند — اشتراک جداگانه‌شان چندین هزار دلار در سال هزینه دارد. اعضای اندیشکده از گزارش‌های روزانه و هفتگی Platts، Fastmarkets، Bainfo China و Dlpibica بهره‌مند می‌شوند؛ داده‌هایی که مستقیماً قیمت‌گذاری، خرید و تصمیمات صادراتی را تغییر می‌دهند.', requestBtn: 'درخواست عضویت سازمانی ←', contactNote: 'تیم ما ظرف ۴۸ ساعت تماس می‌گیرد', }, en: { tableHeaders: ['Title', 'High', 'Low', 'Last', '30D', '60D', '90D', '180D', '360D'], paywallCta: 'Subscribe for full access →', coverageTitle: 'Steel Chain Price Coverage', productLabel: 'Products', indexLabel: 'Indicators', sourceLabel: 'Data Sources', membersOnly: 'MEMBERS ONLY', coverageDesc: 'Full access to real-time, historical prices and weekly analytical reports for all products.', coverageFeatures: ['Real-time & historical prices', 'Exclusive weekly reports', 'Interactive downloadable charts', 'Dedicated analytical support'], sectionsLabel: 'Coverage Areas', contentSections: ['Steel Industry', 'Capital Markets', 'Metals & Commodities', 'Digital Assets', 'FX & Gold', 'Macro Economy'], dsTitle: 'Access to Platts, Fastmarkets and Top Global Data Sources', dsBody: 'Most Iranian organizations lack direct access to these sources — individual subscriptions cost thousands of dollars per year. Institute members benefit from daily and weekly reports from Platts, Fastmarkets, Bainfo China, and Dlpibica; data that directly impacts pricing, procurement, and export decisions.', requestBtn: 'Request Organizational Membership →', contactNote: 'Our team will contact you within 48 hours', }, } const SLIDES = Array.from({ length: 13 }, (_, i) => `/${i + 1}.jpg`) /* ─── price table data ───────────────────────────────────── */ const PRICE_TABLE_ROWS = [ { title: 'سنگ نیکل - Carbonate, Mn ۱۳%min EXW China', high: 855.06, low: 898.57, last: 739.35, d30: 9.99, d60: 7.89, d90: 5.23, d180: -6.92, d360: 7.88 }, { title: 'فرو نیکل - S.A. ۳۶%min In Qinzhou Port', high: 892.53, low: 826.70, last: 751.05, d30: -6.31, d60: 8.48, d90: 2.43, d180: 5.13, d360: 3.89 }, { title: 'کاند نیکل - Carbonate, Mn ۱۳%min EXW China', high: 804.93, low: 801.05, last: 961.74, d30: -6.35, d60: 0.12, d90: 4.44, d180: 6.81, d360: 5.95 }, { title: 'سنگ نیکل - S.A. ۳۷%min In Qinzhou Port', high: 774.65, low: 759.59, last: 742.73, d30: -6.03, d60: -5.78, d90: 1.21, d180: 5.82, d360: 5.47 }, { title: 'سولفات نیکل - Gabonese ۴۴%min In Qinzhou Port', high: 873.00, low: 895.82, last: 720.87, d30: -9.57, d60: 5.91, d90: 8.58, d180: 9.15, d360: -2.43 }, { title: 'کاند نیکل - Carbonate, Mn ۱۳%min EXW China', high: 926.83, low: 825.50, last: 745.22, d30: -5.03, d60: -1.54, d90: -0.53, d180: -5.85, d360: 5.54 }, { title: 'فرو نیکل - min FOB S.A.%۳۸', high: 885.21, low: 753.25, last: 753.76, d30: 3.45, d60: 1.07, d90: 8.25, d180: -7.04, d360: -1.44 }, { title: 'فرو نیکل - Carbonate, Mn ۱۳%min EXW China', high: 786.10, low: 739.25, last: 939.99, d30: 8.78, d60: -0.53, d90: 8.58, d180: -9.65, d360: 2.88 }, ] function PctCell({ v }: { v: number }) { const pos = v > 0 const zero = v === 0 return ( {v > 0 ? '+' : ''}{v.toFixed(2)} ) } function PriceTable({ blurFrom, lang }: { blurFrom: number; lang: 'fa' | 'en' }) { const tx = TX[lang] return (
{tx.tableHeaders.map((h, i) => ( ))} {PRICE_TABLE_ROWS.map((row, i) => { const shouldBlur = i >= blurFrom return ( ) })}
{h}
{row.title} {row.high.toFixed(2)} {row.low.toFixed(2)} {row.last.toFixed(2)}
{/* paywall overlay over blurred rows */}
{tx.paywallCta}
) } function ImageSlider() { const [current, setCurrent] = useState(0) useEffect(() => { const id = setInterval(() => setCurrent(c => (c + 1) % SLIDES.length), 3500) return () => clearInterval(id) }, []) return (
{/* Slides */} {SLIDES.map((src, i) => ( ))} {/* Radial blur overlay */}
{/* Vignette */}
{/* Dot indicators */}
{SLIDES.map((_, i) => (
) } function MembershipForm({ lang }: { lang: 'fa' | 'en' }) { const [name, setName] = useState('') const [phone, setPhone] = useState('') const [email, setEmail] = useState('') const [status, setStatus] = useState<'idle'|'sending'|'done'|'error'>('idle') const lbl = lang === 'fa' ? { name: 'نام و نام‌خانوادگی', phone: 'شماره همراه', email: 'آدرس ایمیل', btn: 'ارسال درخواست', sending: 'در حال ارسال...', done: '✓ درخواست شما ثبت شد. به‌زودی با شما تماس می‌گیریم.', error: 'خطا در ارسال. لطفاً مجدد تلاش کنید.' } : { name: 'Full Name', phone: 'Phone Number', email: 'Email Address', btn: 'Send Request', sending: 'Sending...', done: '✓ Request received. We will contact you soon.', error: 'Send failed. Please try again.' } async function submit() { if (!name || !phone) return setStatus('sending') const PANEL_API = import.meta.env.VITE_PANEL_API || 'http://localhost:3001' try { const res = await fetch(`${PANEL_API}/api/contact`, { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify({ name, phone, email }), }) setStatus(res.ok ? 'done' : 'error') } catch { setStatus('error') } } if (status === 'done') return (
{lbl.done}
) return (
{(['name','phone','email'] as const).map(field => ( field === 'name' ? setName(e.target.value) : field === 'phone' ? setPhone(e.target.value) : setEmail(e.target.value)} style={{ border: '1px solid var(--rule-thin)', padding: '11px 14px', fontSize: 13, fontFamily: 'inherit', background: 'var(--paper)', color: 'var(--ink)', outline: 'none', width: '100%', direction: lang === 'fa' ? 'rtl' : 'ltr', }} /> ))} {status === 'error' &&
{lbl.error}
}
) } /* ─── product coverage section ──────────────────────────── */ const PRODUCT_CATEGORIES = [ { title: 'محصولات فولادی', items: ['مفتول', 'میلگرد', 'مقاطع', 'لوله', 'کویل نورد گرم', 'ورق', 'پوشش‌دار', 'نوار'], }, { title: 'فروآلیاژ فولاد', items: ['فروبور', 'فروکروم', 'فرو منگنز', 'فرونیوبیوم', 'فروفسفر', 'فروسیلیکون', 'فروتیتانیوم', 'فرووتنگستن', 'فروواناديوم', 'کروم-سیلیکون', 'کلسیم-سیلیکون', 'سنگ کروم', 'سنگ منگنز'], }, { title: 'صنعت فولاد', items: ['میله استیل', 'کویل استیل', 'لوله استیل', 'ضایعات استیل', 'فولاد بلبرینگ', 'فولاد سرد هیدینگ', 'فولاد چرخدنده', 'فولاد سیلیکون', 'فولاد سازه‌ای'], }, { title: 'مواد اولیه', items: ['زغال سنگ', 'کک', 'آهن', 'سنگ آهن', 'بیلت فولادی', 'ضایعات فولادی'], }, ] const CONTENT_SECTIONS = [ 'صنعت فولاد', 'بازار سرمایه', 'فلزات و کامودیتی', 'ارزهای دیجیتال', 'بازار ارز و طلا', 'اقتصاد کلان', ] const DATA_SOURCES = ['Platts', 'Fastmarkets', 'Bainfo China', 'Dlpibica'] function CategoryColumn({ cat }: { cat: typeof PRODUCT_CATEGORIES[0] }) { return (
{cat.title}
{cat.items.map((item, ii) => ( {item} ))}
) } function ProductCoverage({ lang }: { lang: 'fa' | 'en' }) { const tx = TX[lang] const totalCount = PRODUCT_CATEGORIES.reduce((acc, c) => acc + c.items.length, 0) return (
{/* ── top header ── */}
PRICE COVERAGE
{tx.coverageTitle}
{[{ n: `${totalCount}+`, l: tx.productLabel }, { n: '۵۰۰+', l: tx.indexLabel }, { n: '۴', l: tx.sourceLabel }].map(s => (
{s.n}
{s.l}
))}
{/* ── main body: 2-col products + CTA sidebar ── */}
{/* left: 2×2 product grid */}
{PRODUCT_CATEGORIES.map((cat, ci) => (
))}
{/* right: CTA sidebar */}
MEMBERS ONLY

{tx.coverageDesc}

{tx.coverageFeatures.map(f => (
{f}
))}
{tx.sectionsLabel}
{tx.contentSections.map(s => ( {s} ))}
{/* ── full-width DATA SOURCES bar ── */}
DATA SOURCES

{tx.dsTitle}

{tx.dsBody}

{DATA_SOURCES.map(src => (
{src}
))}
) } export default function Pulse() { const { lang } = useLang() const t = T[lang] const stats = STATS[lang] return (
{t.overline}

{t.heading}

{t.sub}

{t.statsLabel}
{stats.map((s, i) => (
= 2 ? 'blur(4px)' : 'none', userSelect: i >= 2 ? 'none' : 'auto', pointerEvents: i >= 2 ? 'none' : 'auto', }}>
{s.value}
{s.label}
{s.unit}
{s.delta}
))}
{/* Live market snapshot */}
{/* Price table with paywall blur */} {/* Slider + form side by side on desktop — form on RIGHT (col-1 in RTL) */}
MEMBERS ONLY ACCESS

{t.gateHeading}

{t.gateSub}

{t.features.map(f => (
{f}
))}
{/* Product coverage */}
) }