feat: implement US-3 - enhance print layout with professional table design

- Add comprehensive i18n support for all print preview content
- Fix next-intl context error by moving translations to server component
- Implement professional 3-column table layout with proper styling
- Add multilingual table headers (EN: #, Bill Information, 2D Barcode | HR: #, Informacije o Računu, 2D Barkod)
- Center-align index column header and optimize barcode sizing
- Hide print button and header from actual print output
- Fix hydration errors with proper date handling
- Enhanced barcode display with proper padding and sizing

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
2025-09-14 21:16:33 +02:00
parent 493c2f62fa
commit b205a61cf9
4 changed files with 117 additions and 48 deletions

View File

@@ -1,6 +1,7 @@
import { fetchBarcodeDataForPrint } from '@/app/lib/actions/printActions';
import { notFound } from 'next/navigation';
import { PrintPreview } from '@/app/ui/PrintPreview';
import { getTranslations } from 'next-intl/server';
interface PrintPageProps {
params: {
@@ -20,7 +21,7 @@ export default async function PrintPage({ params }: PrintPageProps) {
}
let printData;
try {
printData = await fetchBarcodeDataForPrint(year, month);
} catch (error) {
@@ -28,6 +29,19 @@ export default async function PrintPage({ params }: PrintPageProps) {
notFound();
}
// Get translations for the current locale
const t = await getTranslations("home-page.print-preview");
const translations = {
title: t("title"),
barcodesFound: t("barcodes-found"),
barcodeSingular: t("barcode-singular"),
printButton: t("print-button"),
printFooter: t("print-footer"),
tableHeaderIndex: t("table-header-index"),
tableHeaderBillInfo: t("table-header-bill-info"),
tableHeaderBarcode: t("table-header-barcode")
};
// If no barcode data found, show empty state
if (!printData || printData.length === 0) {
return (
@@ -42,5 +56,5 @@ export default async function PrintPage({ params }: PrintPageProps) {
);
}
return <PrintPreview data={printData} year={year} month={month} />;
return <PrintPreview data={printData} year={year} month={month} translations={translations} />;
}