---
import Layout from '@/layouts/AdminLayout.astro';
import ArticleList from '@/components/admin/seo/ArticleList';
import { getDirectusClient, readItems } from '@/lib/directus/client';

const directus = getDirectusClient();
const articles = await directus.request(readItems('generated_articles', {
  fields: ['*', 'campaign.name'],
  limit: 50,
  sort: ['-date_created']
})).catch(() => []);
---

<Layout title="Generated Articles">
  <div class="p-8">
    <div class="mb-6">
      <h1 class="text-3xl font-bold text-white mb-2">Generated Articles</h1>
      <p class="text-gray-400">Review and manage AI-generated SEO content.</p>
    </div>
    <ArticleList client:load initialArticles={articles} />
  </div>
</Layout>
