diff --git a/app/teknav-en.jsx b/app/teknav-en.jsx new file mode 100644 index 0000000..4e11898 --- /dev/null +++ b/app/teknav-en.jsx @@ -0,0 +1,519 @@ +// teknav-en.jsx — English landing page (mirrors Persian homepage quality) +import { useState, useEffect, useRef } from 'react'; +import { TeknavData } from './teknav-data.js'; +import { useNav } from './teknav-ui.jsx'; +import { LazyDiagram } from './src/components/lazy-diagram.jsx'; +import { iconNode } from './src/lib/icon.jsx'; +import pencilIcon from './src/assets/icons/pencil.svg'; + +// ── English copy maps ──────────────────────────────────────────────────────── +const EN_TITLES = { + 'tekrag-persian-data-centric-rag-benchmark': 'TekRAG-Persian: A Data-Centric Benchmark for Persian Technical RAG', + 'mcp-model-context-protocol-2026': 'Model Context Protocol in 2026: Architecture, Tools, and Agentic AI', + 'ai-data-centric-2026': 'Data-Centric AI in 2026: Why Clean Data Beats Bigger Models', + 'cve-2026-41940-cpanel-zero-day-analysis': 'CVE-2026-41940: Technical Analysis of a cPanel Zero-Day', + 'agentic-ai-production-2026': 'Agentic AI in Production: Reliability, Tools, and Governance', + 'llm-security': 'LLM Security: Prompt Injection, RAG Attacks, and Defensive Design', + 'data-governance-2026': 'Data Governance in 2026: Metadata, Lineage, and AI-Ready Data', + 'open-source-ai-sovereignty': 'Open-Source AI and Digital Sovereignty', + 'deepseek-v4-engram': 'DeepSeek-V4 and Efficient Reasoning Architectures', + 'post-quantum-cryptography-qday': 'Post-Quantum Cryptography and the Road to Q-Day', +}; + +const EN_SUMMARIES = { + 'tekrag-persian-data-centric-rag-benchmark': 'A research-grade benchmark for Persian technical question answering, hallucination evaluation, citation grounding, and data-centric RAG — comparing raw, cleaned, and metadata-enriched corpus variants.', + 'mcp-model-context-protocol-2026': 'A technical deep-dive into the Model Context Protocol as the emerging standard connecting large language models to tools, resources, prompts, and autonomous agent workflows.', + 'ai-data-centric-2026': 'A practical examination of why data quality, labeling precision, provenance tracking, and pipeline hygiene matter more as frontier models become increasingly capable.', + 'cve-2026-41940-cpanel-zero-day-analysis': 'A security-focused breakdown of exploit surface, privilege escalation path, operational impact timeline, patching priorities, and defensive monitoring recommendations.', + 'agentic-ai-production-2026': 'A field guide to moving AI agents from controlled demos into production systems with proper telemetry, permission scoping, evaluation loops, and failure recovery.', + 'llm-security': 'Threat models and defensive controls for prompt injection, indirect instruction attacks, insecure tool use, retrieval poisoning, and multi-agent trust boundaries.', + 'data-governance-2026': 'How metadata management, data lineage, policy enforcement, quality gates, and semantic layers shape dependable AI systems and analytics infrastructure.', + 'open-source-ai-sovereignty': 'Why open model weights, transparent architectures, and local deployment matter for strategic control over AI infrastructure and long-term technology independence.', + 'deepseek-v4-engram': 'A close look at memory architecture, mixture-of-experts efficiency, inference cost pressures, and what efficient reasoning architectures reveal about the frontier.', + 'post-quantum-cryptography-qday': 'A clear explanation of quantum computing risk, NIST standardization, cryptographic migration strategy, and why organizations need post-quantum planning today.', +}; + +const EN_CATEGORIES = { + ai: { name: 'Artificial Intelligence', desc: 'LLMs, agents, model safety, and AI infrastructure' }, + data: { name: 'Data Science', desc: 'RAG, data-centric AI, governance, and benchmarks' }, + security: { name: 'Cybersecurity', desc: 'Vulnerabilities, LLM security, and defense' }, + hardware: { name: 'Hardware', desc: 'AI chips, semiconductors, and compute strategy' }, + software: { name: 'Software Engineering', desc: 'Architecture, systems design, and tooling' }, + startup: { name: 'Startups & Markets', desc: 'Technology markets, product strategy, and venture' }, + future: { name: 'Future of Technology', desc: 'Long-horizon trends and societal impact' }, +}; + +function enTitle(article) { + return EN_TITLES[article.slug] || article.seoTitle || article.ogTitle || article.title; +} +function enSummary(article) { + return EN_SUMMARIES[article.slug] || article.ogDescription || article.metaDescription || article.summary || ''; +} +function enCategory(article) { + return EN_CATEGORIES[article.category]?.name || article.categoryName || 'Technology'; +} +function enAuthor(article) { + const a = TeknavData.authors.find((x) => x.id === article.authorId); + return a?.nameEn || (a?.slug === 'arsam-sabbagh' ? 'Arsam Sabbagh' : article.authorName); +} + +function publishedArticles() { + return TeknavData.articles + .filter((a) => a.status !== 'پیش‌نویس' && a.status !== 'در انتظار بررسی') + .slice() + .sort((a, b) => String(b.dateEn || '').localeCompare(String(a.dateEn || ''))); +} + +// ── Animated neural background (same as Persian hero) ─────────────────────── +function HeroBg() { + const ref = useRef(); + useEffect(() => { + const canvas = ref.current; + if (!canvas) return; + const ctx = canvas.getContext('2d'); + let raf, t = 0; + const palette = ['rgba(15,107,115,', 'rgba(196,106,77,', 'rgba(47,143,107,']; + const nodes = Array.from({ length: 28 }, (_, i) => ({ + x: Math.random() * canvas.width, y: Math.random() * canvas.height, + vx: (Math.random() - 0.5) * 0.32, vy: (Math.random() - 0.5) * 0.32, + r: Math.random() * 3 + 1.5, + color: palette[i % palette.length], + phase: Math.random() * Math.PI * 2, + })); + const resize = () => { canvas.width = canvas.offsetWidth; canvas.height = canvas.offsetHeight; }; + resize(); + window.addEventListener('resize', resize); + const draw = () => { + t += 0.012; + ctx.clearRect(0, 0, canvas.width, canvas.height); + nodes.forEach((n) => { + n.x += n.vx; n.y += n.vy; + if (n.x < 0 || n.x > canvas.width) n.vx *= -1; + if (n.y < 0 || n.y > canvas.height) n.vy *= -1; + nodes.forEach((m) => { + const d = Math.hypot(n.x - m.x, n.y - m.y); + if (d < 120) { + ctx.beginPath(); ctx.moveTo(n.x, n.y); ctx.lineTo(m.x, m.y); + ctx.strokeStyle = `rgba(15,107,115,${0.15 * (1 - d / 120)})`; + ctx.lineWidth = 0.7; ctx.stroke(); + } + }); + const pulse = 0.45 + 0.18 * Math.sin(t + n.phase); + ctx.beginPath(); ctx.arc(n.x, n.y, n.r, 0, Math.PI * 2); + ctx.fillStyle = n.color + pulse + ')'; ctx.fill(); + }); + raf = requestAnimationFrame(draw); + }; + draw(); + return () => { cancelAnimationFrame(raf); window.removeEventListener('resize', resize); }; + }, []); + return ; +} + +// ── CountUp animation ──────────────────────────────────────────────────────── +function CountUp({ to, suffix = '', duration = 1400 }) { + const [n, setN] = useState(0); + const ref = useRef(); + const started = useRef(false); + useEffect(() => { + const obs = new IntersectionObserver(([e]) => { + if (e.isIntersecting && !started.current) { + started.current = true; + const start = performance.now(); + const tick = (now) => { + const p = Math.min((now - start) / duration, 1); + setN(Math.round(to * (1 - Math.pow(1 - p, 3)))); + if (p < 1) requestAnimationFrame(tick); + }; + requestAnimationFrame(tick); + } + }, { threshold: 0.4 }); + if (ref.current) obs.observe(ref.current); + return () => obs.disconnect(); + }, [to, duration]); + return {n.toLocaleString()}{suffix}; +} + +// ── Article card (English) ─────────────────────────────────────────────────── +function EnArticleCard({ article, delay = 0, featured = false }) { + const { navigate } = useNav(); + const [vis, setVis] = useState(false); + const ref = useRef(); + useEffect(() => { + const obs = new IntersectionObserver(([e]) => { if (e.isIntersecting) setVis(true); }, { threshold: 0.08 }); + if (ref.current) obs.observe(ref.current); + return () => obs.disconnect(); + }, []); + + return ( +
navigate('/article/' + article.slug)} + style={{ + background: '#fff', borderRadius: featured ? 16 : 12, + border: featured ? '1px solid #0F6B7340' : '1px solid #E4DDD2', + padding: featured ? 0 : 22, cursor: 'pointer', + opacity: vis ? 1 : 0, transform: vis ? 'translateY(0)' : 'translateY(20px)', + transition: `opacity 0.45s ${delay}ms, transform 0.45s ${delay}ms, box-shadow 0.2s`, + boxShadow: featured ? '0 4px 28px rgba(15,107,115,0.10)' : '0 2px 10px rgba(0,0,0,0.04)', + overflow: 'hidden', + display: featured ? 'grid' : 'flex', + gridTemplateColumns: featured ? '1fr 1fr' : undefined, + flexDirection: featured ? undefined : 'column', + }} + onMouseEnter={(e) => e.currentTarget.style.boxShadow = featured ? '0 10px 40px rgba(15,107,115,0.16)' : '0 6px 24px rgba(0,0,0,0.09)'} + onMouseLeave={(e) => e.currentTarget.style.boxShadow = featured ? '0 4px 28px rgba(15,107,115,0.10)' : '0 2px 10px rgba(0,0,0,0.04)'} + > + {featured ? ( + <> +
+
+ Featured Research + {enCategory(article)} + {article.readTime} min read +
+

+ {enTitle(article)} +

+

+ {enSummary(article).slice(0, 240)} +

+
+
+ {enAuthor(article)?.[0] || 'A'} +
+
+
{enAuthor(article)}
+
{article.dateEn} · Teknav
+
+
+
+
+ +
+ + ) : ( + <> +
+
+ +
+
+
+ {enCategory(article)} + {article.readTime} min +
+

+ {enTitle(article)} +

+

+ {enSummary(article).slice(0, 110)}… +

+
+ {enAuthor(article)} · {article.dateEn} +
+ + )} +
+ ); +} + +// ── Main page ──────────────────────────────────────────────────────────────── +function EnglishHomePage() { + const { navigate } = useNav(); + const articles = publishedArticles(); + const featured = articles.find((a) => a.slug === 'tekrag-persian-data-centric-rag-benchmark') || articles[0]; + const grid = articles.filter((a) => a.id !== featured?.id).slice(0, 6); + const popularArticles = [...articles].sort((a, b) => (b.views || 0) - (a.views || 0)).slice(0, 3); + + const stats = [ + { label: 'Articles published', to: 180, suffix: '+', icon: '◉' }, + { label: 'Active writers', to: 3, suffix: '', icon: pencilIcon }, + { label: 'Monthly readers', to: 45000, suffix: '+', icon: '◐' }, + { label: 'Avg. read time', to: 8, suffix: ' min', icon: '◷' }, + ]; + + const categories = TeknavData.categories.map((cat) => ({ + ...cat, + enName: EN_CATEGORIES[cat.id]?.name || cat.name, + enDesc: EN_CATEGORIES[cat.id]?.desc || cat.description, + })); + + const authors = TeknavData.authors.map((a) => ({ + ...a, + enName: a.nameEn || (a.slug === 'arsam-sabbagh' ? 'Arsam Sabbagh' : a.name), + enRole: a.specialtyEn || 'Technology writer and analyst', + enBio: a.bioEn || 'Teknav contributor covering technology, strategy, and applied engineering for Persian-speaking readers.', + })); + + return ( +
+ + {/* ── Own sticky header ─────────────────────────────────────────────── */} +
+ { e.preventDefault(); navigate('/en'); }} href="/en" style={{ display: 'flex', alignItems: 'baseline', gap: 10, textDecoration: 'none' }}> + Teknav + ENGLISH + + +
+ + {/* ── Hero ─────────────────────────────────────────────────────────── */} +
+
+
+
+ +
+
+
+ + Deep technology narratives from Iran +
+

+ Teknav tracks AI, data,
security & the future
+ of technology. +

+

+ Independent editorial research for engineers, founders, and analysts. Persian-first publication — this page gives international readers an English overview of Teknav's analysis and research. +

+
+ + +
+
+ {/* Hero card */} + {featured && ( +
navigate('/article/' + featured.slug)} style={{ background: '#fff', border: '1px solid #E4DDD2', borderRadius: 14, padding: '22px 24px', cursor: 'pointer', boxShadow: '0 12px 38px rgba(15,42,46,0.08)', position: 'relative', overflow: 'hidden', animation: 'enReveal 0.7s 1.05s both', transition: 'box-shadow 0.2s' }} + onMouseEnter={(e) => e.currentTarget.style.boxShadow = '0 18px 50px rgba(15,42,46,0.13)'} + onMouseLeave={(e) => e.currentTarget.style.boxShadow = '0 12px 38px rgba(15,42,46,0.08)'}> +
+
✦ FEATURED ARTICLE
+
+ {enTitle(featured)} +
+
+ {enAuthor(featured)} + · + {featured.readTime} min read + · + {enCategory(featured)} +
+
+ )} +
+ + + +
+ + {/* ── Stats bar ─────────────────────────────────────────────────────── */} +
+
+ {stats.map((s, i) => ( +
+
{iconNode(s.icon)}
+
+ +
+
{s.label}
+ {i < stats.length - 1 &&
} +
+ ))} +
+
+ +
+ + {/* ── Featured article ───────────────────────────────────────────── */} + {featured && ( +
+
+
+

Featured

+

Latest research

+
+
+ +
+ )} + + {/* ── Article grid ───────────────────────────────────────────────── */} +
+
+
+

Analysis

+

Recent articles

+
+ +
+
+ {grid.map((a, i) => )} +
+
+ + {/* ── Most read ─────────────────────────────────────────────────── */} +
+
+
+

Popular

+

Most read

+
+
+
+ {popularArticles.map((a, i) => ( +
navigate('/article/' + a.slug)} style={{ display: 'flex', gap: 20, padding: '18px 0', borderBottom: '1px solid #E4DDD2', cursor: 'pointer', alignItems: 'flex-start', transition: 'background 0.15s', borderRadius: 4 }} + onMouseEnter={(e) => e.currentTarget.style.background = '#F4EFE630'} + onMouseLeave={(e) => e.currentTarget.style.background = 'transparent'}> +
0{i + 1}
+
+
+ {enCategory(a)} + {a.readTime} min +
+

{enTitle(a)}

+
{enAuthor(a)} · {(a.views || 0).toLocaleString()} views
+
+
+
+ +
+
+
+ ))} +
+
+ + {/* ── Categories ────────────────────────────────────────────────── */} +
+
+

Site map

+

Topics we cover

+
+
+ {categories.map((cat) => ( +
navigate('/category/' + cat.slug)} style={{ background: '#fff', border: `1px solid ${cat.color}30`, borderLeft: `3px solid ${cat.color}`, borderRadius: 10, padding: '18px 16px', cursor: 'pointer', transition: 'all 0.2s' }} + onMouseEnter={(e) => e.currentTarget.style.background = cat.color + '0A'} + onMouseLeave={(e) => e.currentTarget.style.background = '#fff'}> +
{cat.enName}
+
{cat.enDesc}
+
{cat.articleCount} articles →
+
+ ))} +
+
+ + {/* ── Authors ───────────────────────────────────────────────────── */} +
+
+
+

Team

+

Writers & analysts

+
+ +
+
+ {authors.map((a) => ( +
navigate(a.username ? `/profile/@${a.username}` : `/author/${a.slug}`)} style={{ background: '#fff', border: '1px solid #E4DDD2', borderRadius: 12, padding: '22px', cursor: 'pointer', transition: 'all 0.2s' }} + onMouseEnter={(e) => { e.currentTarget.style.transform = 'translateY(-3px)'; e.currentTarget.style.boxShadow = '0 8px 24px rgba(0,0,0,0.07)'; }} + onMouseLeave={(e) => { e.currentTarget.style.transform = 'translateY(0)'; e.currentTarget.style.boxShadow = 'none'; }}> +
+
+ {a.enName?.[0] || 'A'} +
+
+
{a.enName}
+
{a.enRole}
+
+
+

+ {a.enBio?.slice(0, 160)}… +

+
{a.articleCount} articles published
+
+ ))} +
+
+ + {/* ── Newsletter CTA ─────────────────────────────────────────────── */} +
+
+
+
+
Newsletter
+

Weekly technology signals from Teknav

+

+ The Persian newsletter covers AI, cybersecurity, software, hardware, startups, and data — published weekly for Iranian engineering teams. +

+
+
+ +
+
+
+
+ + {/* ── Footer ───────────────────────────────────────────────────────── */} +
+
+
+
Teknav
+
Deep technology narratives from Iran's Persian-language tech media.
+
+ +
© 2025 Teknav · teknav.ir
+
+
+ + +
+ ); +} + +export { EnglishHomePage };