import { marketPrices, globalComparison } from '@/data/market'; import type { MarketPrice } from '@/data/market'; const riskAlerts = [ { title: 'فشار صادرات چین', desc: 'افزایش ۱۸٪ صادرات ارزان چین فشار قیمتی روی بازار آسیا', level: 'high', }, { title: 'محدودیت انرژی داخلی', desc: 'کاهش تولید زمستانی به دلیل محدودیت گاز صنعتی', level: 'medium', }, { title: 'فرصت بازار عراق', desc: 'کاهش واردات ترکیه، فرصت افزایش سهم بازار برای ایران', level: 'low', }, ] as const; type AlertLevel = 'high' | 'medium' | 'low'; const alertBorderColor: Record = { high: 'var(--red)', medium: 'var(--amber)', low: 'var(--green-ink)', }; const alertLabelColor: Record = { high: 'var(--red)', medium: 'var(--amber)', low: 'var(--green-ink)', }; const alertLabel: Record = { high: 'بالا', medium: 'متوسط', low: 'فرصت', }; function formatNumber(n: number): string { return n.toLocaleString('fa-IR'); } function PriceTicker({ item }: { item: MarketPrice }) { const isUp = item.trend === 'up'; const isDown = item.trend === 'down'; const trendArrow = isUp ? '▲' : isDown ? '▼' : '—'; const trendColor = isUp ? 'var(--green-ink)' : isDown ? 'var(--red)' : 'var(--ink-5)'; const changePrefix = item.change > 0 ? '+' : ''; return (
{/* Product name */}
{item.name}
{/* Price */}
{formatNumber(item.value)}
{/* Unit */}
{item.unit}
{/* Change + trend */}
{trendArrow} {changePrefix}{formatNumber(item.change)} {changePrefix}{item.changePercent.toFixed(1)}٪
); } export default function Scanner() { // Use first 6 prices for the grid const gridPrices = marketPrices.slice(0, 6); // For CSS bar chart: find max price in globalComparison for proportional width // Filter to USD-only for a fair comparison (exclude IRR) const usdPrices = globalComparison.filter((g) => g.currency === 'USD'); const maxUSD = Math.max(...usdPrices.map((g) => g.price)); return (
{/* Page Header */}
اندیشکده فولاد آینده — داده‌های بازار

اسکنر بازار جهانی فولاد

داده‌های لحظه‌ای قیمت‌های بازار داخلی و جهانی

به‌روز شده: بهمن ۱۴۰۳
{/* Price Ticker Grid */}

قیمت‌های لحظه‌ای بازار

{gridPrices.map((item) => ( ))}
{/* Global Comparison Bar Chart */}

مقایسه جهانی — قیمت میلگرد

دلار / تن — بازار صادراتی
{usdPrices.map((entry) => { const barPct = Math.round((entry.price / maxUSD) * 100); return (
{/* Flag + Country */}
{entry.flag} {entry.country}
{/* Bar */}
{/* Value */}
${entry.price} /تن
); })}
{/* Active Risk Cards */}

ریسک‌های بازار فعال

هشدارهای جاری
{riskAlerts.map((alert) => { const level = alert.level as AlertLevel; return (

{alert.title}

{alertLabel[level]}

{alert.desc}

); })}
); }