steelforesight/src/data/media.ts

198 lines
12 KiB
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

// ─────────────────────────────────────────────────────────────
// Home media content layer (videocast + podcast items)
// Mock/seed data. Replaced at runtime by bootstrapMedia() which
// reuses the EXISTING articles API (type='video' / type='podcast').
// No dedicated table — see articleToVideo / articleToPodcast below.
// ─────────────────────────────────────────────────────────────
export interface MediaLangText {
title: string;
guest: string;
body: string;
}
export interface VideoItem {
id: number | string;
fa: MediaLangText;
en: MediaLangText;
ep: string;
duration: string;
date: string;
thumb: string;
}
export interface PodcastItem {
id: number | string;
epNum: string;
date: string;
rating: string;
duration: string;
cover: string;
fa: MediaLangText & { ep: string };
en: MediaLangText & { ep: string };
}
export const videos: VideoItem[] = [
{
id: 1,
fa: { title: 'نگاهی به آن سوی مرزهای تولید', guest: 'مهندس سیامک فجری',
body: 'فراتر از داده‌های خام قیمت و تناژ، به سراغ مهندسی تغییر و معماری آینده صنعت می‌رویم.' },
en: { title: 'Beyond the Frontiers of Production', guest: 'Eng. Siamak Fajri',
body: 'Going beyond raw price and tonnage data to the engineering of change.' },
ep: 'EP.12', duration: '۴۲ دقیقه', date: '۲۵ خرداد ۱۴۰۵', thumb: '/news/photo-1504307651254-35680f356dfd.jpg',
},
{
id: 2,
fa: { title: 'تحلیل بازار جهانی فلزات پایه', guest: 'دکتر نیلوفر احمدی',
body: 'نوسانات قیمت مس، آلومینیوم و روی و تأثیر آن بر زنجیره ارزش فولاد.' },
en: { title: 'Global Base Metals Analysis', guest: 'Dr. Niloofar Ahmadi',
body: 'Price volatility in copper, aluminum and zinc and its steel-chain impact.' },
ep: 'EP.11', duration: '۳۸ دقیقه', date: '۱۸ خرداد ۱۴۰۵', thumb: '/news/photo-1558618666-fcd25c85cd64.jpg',
},
{
id: 3,
fa: { title: 'ژئوپلیتیک و صادرات فولاد ایران', guest: 'مهندس فرید تهرانی',
body: 'تأثیر تحولات منطقه‌ای بر بازارهای صادراتی فولاد ایران و فرصت‌های پیش رو.' },
en: { title: 'Geopolitics & Iran Steel Exports', guest: 'Eng. Farid Tehrani',
body: 'How regional developments shape Iran\'s steel export markets and opportunities ahead.' },
ep: 'EP.10', duration: '۵۱ دقیقه', date: '۱۱ خرداد ۱۴۰۵', thumb: '/news/photo-1504328345606-18bbc8c9d7d1.jpg',
},
{
id: 4,
fa: { title: 'سرمایه‌گذاری در زنجیره ارزش فولاد', guest: 'دکتر آرش کریمی',
body: 'فرصت‌ها و چالش‌های سرمایه‌گذاری در بخش‌های مختلف زنجیره ارزش فولاد.' },
en: { title: 'Investing in the Steel Value Chain', guest: 'Dr. Arash Karimi',
body: 'Opportunities and challenges across the steel value chain segments.' },
ep: 'EP.09', duration: '۴۵ دقیقه', date: '۴ خرداد ۱۴۰۵', thumb: '/news/photo-1611273426858-450d8e3c9fce.jpg',
},
{
id: 5,
fa: { title: 'آینده فولاد سبز در ایران', guest: 'مهندس کاوه رستمی',
body: 'مسیر گذار به فولاد کم‌کربن در ایران؛ چالش‌ها، فرصت‌ها و ضرورت سرمایه‌گذاری.' },
en: { title: 'The Future of Green Steel in Iran', guest: 'Eng. Kaveh Rostami',
body: 'The road to low-carbon steel in Iran: challenges, opportunities and investment needs.' },
ep: 'EP.08', duration: '۳۶ دقیقه', date: '۲۸ اردیبهشت ۱۴۰۵', thumb: '/news/photo-1566873535350-6586b0b7a1f2.jpg',
},
{
id: 6,
fa: { title: 'هوش مصنوعی و تحول کارخانه‌های فولاد', guest: 'دکتر رضا محمدی',
body: 'چگونه یادگیری ماشین کارایی خطوط تولید فولاد را متحول می‌کند.' },
en: { title: 'AI and the Steel Plant Revolution', guest: 'Dr. Reza Mohammadi',
body: 'How machine learning is transforming the efficiency of steel production lines.' },
ep: 'EP.07', duration: '۴۹ دقیقه', date: '۲۱ اردیبهشت ۱۴۰۵', thumb: '/news/photo-1578662996442-48f60103fc96.jpg',
},
]
export const podcasts: PodcastItem[] = [
{
id: 1,
epNum: 'اپیزود ۷۷', date: '۲۵ / خرداد / ۱۴۰۵', rating: '۴.۸/۵', duration: '۵۶:۱۲', cover: '/news/photo-1540575467063-178a50c2df87.jpg',
fa: { title: 'کالبدشکافی عقلانی پیچیدگی‌های صنعتی', ep: 'قسمت ۷۷', guest: 'مهندس سیامک شجاعی',
body: 'صنعت فولاد در عصر حاضر، در پیچیده‌ترین چرخه حیات خود قرار گرفته است؛ جایی که همگرایی هوش مصنوعی، الزامات زیست‌محیطی و تنش‌های ژئواکونومیک، قواعد کلاسیک تولید و تجارت را به‌کلی بازنویسی کرده‌اند.' },
en: { title: 'A Rational Dissection of Industrial Complexity', ep: 'Episode 77', guest: 'Eng. Siamak Shojaei',
body: 'Steel today is in its most complex cycle yet — where AI, environmental mandates and geo-economic tension rewrite the classic rules of production and trade.' },
},
{
id: 2,
epNum: 'اپیزود ۷۶', date: '۱۸ / خرداد / ۱۴۰۵', rating: '۴.۶/۵', duration: '۱:۰۴:۳۳', cover: '/news/photo-1566873535350-6586b0b7a1f2.jpg',
fa: { title: 'آزمایشگاه کوره؛ فناوری‌های نوین فولادسازی', ep: 'قسمت ۷۶', guest: 'دکتر رضا محمدی',
body: 'در این اپیزود با نگاهی موشکافانه به چالش‌های فنی گذار از کوره‌های بلند به فولادسازی پاک می‌پردازیم.' },
en: { title: 'The Foundry Lab: New Steelmaking Technologies', ep: 'Episode 76', guest: 'Dr. Reza Mohammadi',
body: 'A meticulous look at the technical challenges of transitioning from blast furnaces to clean steelmaking.' },
},
{
id: 3,
epNum: 'اپیزود ۷۵', date: '۱۱ / خرداد / ۱۴۰۵', rating: '۴.۵/۵', duration: '۴۸:۵۷', cover: '/news/photo-1578662996442-48f60103fc96.jpg',
fa: { title: 'معمار فولاد؛ رهبری در عصر تحول', ep: 'قسمت ۷۵', guest: 'مهندس کاوه رستمی',
body: 'داستان ساختن فولاد فردا؛ روایت رهبرانی که مدل‌های سنتی کسب‌وکار را به چالش کشیده‌اند.' },
en: { title: 'Steel Architect: Leadership in the Age of Change', ep: 'Episode 75', guest: 'Eng. Kaveh Rostami',
body: 'The story of building tomorrow\'s steel — leaders challenging traditional business models.' },
},
{
id: 4,
epNum: 'اپیزود ۷۴', date: '۴ / خرداد / ۱۴۰۵', rating: '۴.۷/۵', duration: '۵۲:۱۸', cover: '/news/photo-1504328345606-18bbc8c9d7d1.jpg',
fa: { title: 'فولاد سبز؛ رویا یا واقعیت؟', ep: 'قسمت ۷۴', guest: 'دکتر نیلوفر احمدی',
body: 'بررسی مسیر دشوار و پرهزینه گذار به تولید فولاد با کمترین انتشار کربن و آنچه صنعت ایران باید بداند.' },
en: { title: 'Green Steel: Dream or Reality?', ep: 'Episode 74', guest: 'Dr. Niloofar Ahmadi',
body: 'Examining the costly and challenging road to near-zero carbon steel production and what Iranian industry must know.' },
},
{
id: 5,
epNum: 'اپیزود ۷۳', date: '۲۸ / اردیبهشت / ۱۴۰۵', rating: '۴.۴/۵', duration: '۱:۱۲:۴۴', cover: '/news/photo-1558618666-fcd25c85cd64.jpg',
fa: { title: 'بازی بزرگ؛ چین، هند و آینده بازار فولاد', ep: 'قسمت ۷۳', guest: 'مهندس فرید تهرانی',
body: 'چگونه رقابت دو غول آسیایی مسیر بازار جهانی فولاد را در دهه پیش رو تغییر خواهد داد.' },
en: { title: 'The Great Game: China, India & the Future of Steel', ep: 'Episode 73', guest: 'Eng. Farid Tehrani',
body: 'How competition between two Asian giants will reshape the global steel market in the decade ahead.' },
},
{
id: 6,
epNum: 'اپیزود ۷۲', date: '۲۱ / اردیبهشت / ۱۴۰۵', rating: '۴.۳/۵', duration: '۴۴:۰۲', cover: '/news/photo-1611273426858-450d8e3c9fce.jpg',
fa: { title: 'هوش مصنوعی در خط تولید فولاد', ep: 'قسمت ۷۲', guest: 'دکتر آرش کریمی',
body: 'کاربردهای عملی یادگیری ماشین در بهینه‌سازی فرآیند ذوب، کنترل کیفیت و نگهداری پیش‌گیرانه.' },
en: { title: 'AI on the Steel Production Line', ep: 'Episode 72', guest: 'Dr. Arash Karimi',
body: 'Practical applications of machine learning in melt optimization, quality control and predictive maintenance.' },
},
]
// ── article → media item mappers ───────────────────────────────
// The articles API has no per-language fields, so we put the same
// title/summary in both fa/en and let the component pick by lang.
function articleToVideo(a: Record<string, unknown>, i: number): VideoItem {
const title = String(a.title ?? '')
const guest = String(a.author ?? '')
const body = String(a.summary ?? '')
return {
id: String(a.id ?? i),
fa: { title, guest, body },
en: { title, guest, body },
ep: `EP.${i + 1}`,
duration: '',
date: String(a.publishDate ?? ''),
thumb: String(a.coverImage ?? '') || '/news/photo-1504307651254-35680f356dfd.jpg',
}
}
function articleToPodcast(a: Record<string, unknown>, i: number): PodcastItem {
const title = String(a.title ?? '')
const guest = String(a.author ?? '')
const body = String(a.summary ?? '')
const ep = `قسمت ${i + 1}`
return {
id: String(a.id ?? i),
epNum: `اپیزود ${i + 1}`,
date: String(a.publishDate ?? ''),
rating: '۵/۵',
duration: '',
cover: String(a.coverImage ?? '') || '/news/photo-1540575467063-178a50c2df87.jpg',
fa: { title, guest, body, ep },
en: { title, guest, body, ep },
}
}
const PANEL_API = (import.meta as ImportMeta & { env?: Record<string, string> }).env?.VITE_PANEL_API || ''
export async function bootstrapMedia(): Promise<void> {
try {
const [videoRes, podRes] = await Promise.all([
fetch(`${PANEL_API}/api/articles?type=video&limit=50`),
fetch(`${PANEL_API}/api/articles?type=podcast&limit=50`),
])
if (videoRes.ok) {
const fetched = await videoRes.json()
if (Array.isArray(fetched) && fetched.length > 0) {
videos.length = 0
videos.push(...fetched.map((a: Record<string, unknown>, i: number) => articleToVideo(a, i)))
}
}
if (podRes.ok) {
const fetched = await podRes.json()
if (Array.isArray(fetched) && fetched.length > 0) {
podcasts.length = 0
podcasts.push(...fetched.map((a: Record<string, unknown>, i: number) => articleToPodcast(a, i)))
}
}
} catch { /* panel offline → keep static fallback */ }
}