import Link from 'next/link'; import { Plus } from 'lucide-react'; import { getTranslations } from 'next-intl/server'; interface SitePost { id: string; title: string; status: string; created_at: string | null; } import { formatDate } from '@kit/shared/dates'; import { createSiteBuilderApi } from '@kit/site-builder/api'; import { getSupabaseServerClient } from '@kit/supabase/server-client'; import { Badge } from '@kit/ui/badge'; import { Button } from '@kit/ui/button'; import { AccountNotFound } from '~/components/account-not-found'; import { CmsPageShell } from '~/components/cms-page-shell'; import { EmptyState } from '~/components/empty-state'; interface Props { params: Promise<{ account: string }>; } export default async function PostsManagerPage({ params }: Props) { const { account } = await params; const client = getSupabaseServerClient(); const t = await getTranslations('siteBuilder'); const { data: acct } = await client .from('accounts') .select('id') .eq('slug', account) .single(); if (!acct) return ; const api = createSiteBuilderApi(client); const posts = await api.listPosts(acct.id); return ( {t('posts.newPost')} {posts.length === 0 ? ( ) : ( {t('posts.colTitle')} {t('posts.colStatus')} {t('posts.colCreated')} {(posts as SitePost[]).map((post) => ( {post.title} {post.status} {formatDate(post.created_at)} ))} )} ); }