import { Link } from 'react-router-dom';
import SEOHead from '../components/seo/SEOHead';
import { useLanguage } from '../contexts/LanguageContext';

const posts = [
  {
    slug: 'introducing-texpixel',
    title: 'Introducing TexPixel',
    titleZh: 'TexPixel 介绍',
    description: 'Meet TexPixel — your AI-powered formula recognition tool',
    descriptionZh: '认识 TexPixel — 你的 AI 公式识别工具',
    date: '2026-03-25',
  },
];

export default function BlogListPage() {
  const { language } = useLanguage();
  return (
    <>
      <SEOHead title="Blog" description="TexPixel blog — updates, tutorials, and insights" path="/blog" />
      <div className="max-w-4xl mx-auto py-16 px-6">
        <h1 className="text-3xl font-bold text-gray-900 mb-8">{language === 'en' ? 'Blog' : '博客'}</h1>
        <div className="space-y-6">
          {posts.map((post) => (
            <Link key={post.slug} to={`/blog/${post.slug}`} className="block p-6 bg-gray-50 rounded-lg hover:bg-gray-100 transition-colors">
              <div className="text-xs text-gray-400 mb-2">{post.date}</div>
              <h2 className="text-lg font-semibold text-gray-900">{language === 'en' ? post.title : post.titleZh}</h2>
              <p className="text-gray-600 mt-1 text-sm">{language === 'en' ? post.description : post.descriptionZh}</p>
            </Link>
          ))}
        </div>
      </div>
    </>
  );
}
