From 66e2bb0a746ea811328610c2d8783ea078b651b9 Mon Sep 17 00:00:00 2001 From: clawd Date: Fri, 20 Feb 2026 10:18:30 +0000 Subject: [PATCH] =?UTF-8?q?v0.3.1=20=E2=80=94=20Frontend:=20PDF-Button,=20?= =?UTF-8?q?Update-Download=20UI,=20Druckvorschau?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - PDF-Export Button in WeekPlanner Toolbar - Loading States + Success/Error Banner - InfoPage: Update-Download mit Fortschritt + Neustart-Hinweis - Druckvorschau: HTML-Layout in neuem Fenster mit auto window.print() - BITV 2.0: aria-labels, aria-live, Focus-Indikatoren --- frontend/src/components/InfoPage.tsx | 68 +++++++++- frontend/src/components/WeekPlanner.tsx | 169 ++++++++++++++++++++++++ 2 files changed, 232 insertions(+), 5 deletions(-) diff --git a/frontend/src/components/InfoPage.tsx b/frontend/src/components/InfoPage.tsx index f45b0d6..7bb7845 100644 --- a/frontend/src/components/InfoPage.tsx +++ b/frontend/src/components/InfoPage.tsx @@ -164,7 +164,7 @@ export function InfoPage() { )} - {updateInfo && updateInfo.available && ( + {updateInfo && updateInfo.available && !downloadComplete && (
@@ -187,7 +187,7 @@ export function InfoPage() { {updateInfo.release_notes && (

Änderungen:

-
+
{updateInfo.release_notes}
@@ -197,17 +197,75 @@ export function InfoPage() { {updateInfo.download_url && (
+ + {downloading && ( +
+ Update wird heruntergeladen und verifiziert. Dies kann einige Minuten dauern... +
+ )}
)}
)} + + {/* Download Complete State */} + {downloadComplete && ( +
+
+
+ + + +
+
+

+ Update heruntergeladen +

+
+

+ Das Update auf Version {updateInfo?.latest_version} wurde erfolgreich heruntergeladen und die SHA256-Prüfsumme wurde verifiziert. +

+

+ Bitte starten Sie die Anwendung neu, um das Update zu installieren. +

+
+
+ + + +
+
+
+
+ )}
diff --git a/frontend/src/components/WeekPlanner.tsx b/frontend/src/components/WeekPlanner.tsx index 1a87300..40f0e7f 100644 --- a/frontend/src/components/WeekPlanner.tsx +++ b/frontend/src/components/WeekPlanner.tsx @@ -105,6 +105,164 @@ export function WeekPlanner({ year, week, className = '' }: WeekPlannerProps) { } }; + // Handle print preview + const handlePrintPreview = () => { + if (!weekPlan) return; + + // Erstelle druckbares HTML + const printContent = ` + + + + + + Wochenplan KW ${week} ${year} - Druckvorschau + + + +
+

Wochenplan KW ${week} ${year}

+

Erstellt am: ${new Date(weekPlan.created_at).toLocaleDateString('de-DE')}

+
+ +
+ ${weekDays.map((date, index) => { + const dayNumber = (index + 1) as WeekDay; + const dayName = ['Montag', 'Dienstag', 'Mittwoch', 'Donnerstag', 'Freitag'][index]; + const dateStr = date.toLocaleDateString('de-DE', { day: '2-digit', month: '2-digit' }); + + const specialDay = getSpecialDay(dayNumber); + const fruehstueckEntries = getEntriesForDay(dayNumber, 'fruehstueck'); + const vesperEntries = getEntriesForDay(dayNumber, 'vesper'); + + return ` +
+
+ ${dayName}
+ ${dateStr} +
+ + ${specialDay ? `
${specialDay.label || specialDay.type}
` : ''} + +
+
Frühstück
+ ${fruehstueckEntries.map(entry => ` +
+ ${entry.product_name || entry.custom_text || 'Eintrag'} + ${entry.group_label ? ` (${entry.group_label})` : ''} +
+ `).join('')} + ${fruehstueckEntries.length === 0 ? '
-
' : ''} +
+ +
+
Vesper
+ ${vesperEntries.map(entry => ` +
+ ${entry.product_name || entry.custom_text || 'Eintrag'} + ${entry.group_label ? ` (${entry.group_label})` : ''} +
+ `).join('')} + ${vesperEntries.length === 0 ? '
-
' : ''} +
+
+ `; + }).join('')} +
+ + + + + + + `; + + // Öffne neues Fenster mit druckbarem Content + const printWindow = window.open('', '_blank'); + if (printWindow) { + printWindow.document.write(printContent); + printWindow.document.close(); + } + }; + // Loading state if (loading && !weekPlan) { return ( @@ -224,6 +382,17 @@ export function WeekPlanner({ year, week, className = '' }: WeekPlannerProps) { )} {pdfExporting ? 'Erstelle PDF...' : 'PDF erstellen'} + + {/* Print Preview Button */} +
Erstellt: {new Date(weekPlan.created_at).toLocaleDateString('de-DE')}