import LogoutButton from "@/app/logout-button"; import LanguageSwitcher from "@/app/language-switcher"; import { getItems } from "@/lib/items"; import { cookies } from "next/headers"; import { getLocale, LOCALE_COOKIE, t } from "@/lib/i18n"; export const dynamic = "force-dynamic"; export default async function ItemsPage() { const { items, error } = await getItems(); const locale = getLocale((await cookies()).get(LOCALE_COOKIE)?.value); return (
{/* Header */}

{t(locale, "articles.title")}

{t(locale, "articles.description")}

{/* KPI Card */}

{t(locale, "articles.count")}

{items.length}

{/* Main Card */}

{t(locale, "articles.heading")}

{/* Error */} {error && (
{t(locale, "articles.error")}
)} {/* Table */} {items.length > 0 && (
{items.map((item) => ( ))}
{t(locale, "articles.code")} {t(locale, "articles.descriptionColumn")}
{item.ItemCode} {item.ItemName}
)} {/* Empty State */} {items.length === 0 && !error && (
📦

{t(locale, "articles.emptyTitle")}

{t(locale, "articles.emptyDescription")}

)}
); }