Files
evidencija-rezija/web-app/app/[locale]/home/print/[year]/[month]/page.tsx
Knee Cola 57dcebd640 refactor: convert repository to monorepo with npm workspaces
Restructured the repository into a monorepo to better organize application code
and maintenance scripts.

## Workspace Structure
- web-app: Next.js application (all app code moved from root)
- housekeeping: Database backup and maintenance scripts

## Key Changes
- Moved all application code to web-app/ using git mv
- Moved database scripts to housekeeping/ workspace
- Updated Dockerfile for monorepo build process
- Updated docker-compose files (volume paths: ./web-app/etc/hosts/)
- Updated .gitignore for workspace-level node_modules
- Updated documentation (README.md, CLAUDE.md, CHANGELOG.md)

## Migration Impact
- Root package.json now manages workspaces
- Build commands delegate to web-app workspace
- All file history preserved via git mv
- Docker build process updated for workspace structure

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

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2025-12-25 12:13:04 +01:00

63 lines
2.0 KiB
TypeScript

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: {
year: string;
month: string;
locale: string;
};
}
export default async function PrintPage({ params }: PrintPageProps) {
const year = parseInt(params.year);
const month = parseInt(params.month);
// Validate year and month parameters
if (isNaN(year) || isNaN(month) || month < 1 || month > 12) {
notFound();
}
let printData;
try {
printData = await fetchBarcodeDataForPrint(year, month);
} catch (error) {
console.error('Error fetching print data:', error);
notFound();
}
// Get translations for the current locale
const t = await getTranslations("home-page.print-preview");
const yearMonth = `${year}-${month.toString().padStart(2, '0')}`;
const translations = {
title: t("title"),
barcodesFound: t("barcodes-found"),
barcodeSingular: t("barcode-singular"),
printButton: t("print-button"),
printFooter: t("print-footer", { date: new Date().toLocaleDateString() }),
tableHeaderIndex: t("table-header-index"),
tableHeaderBillInfo: t("table-header-bill-info"),
tableHeaderBarcode: t("table-header-barcode"),
emptyStateTitle: t("empty-state-title"),
emptyStateMessage: t("empty-state-message", { yearMonth })
};
// If no barcode data found, show empty state
if (!printData || printData.length === 0) {
return (
<div className="min-h-screen flex items-center justify-center">
<div className="text-center">
<h1 className="text-2xl font-bold mb-4">{translations.emptyStateTitle}</h1>
<p className="text-gray-600">
{translations.emptyStateMessage}
</p>
</div>
</div>
);
}
return <PrintPreview data={printData} year={year} month={month} translations={translations} />;
}