From 6b55c1358318087686e0c260164eb9328d400dd0 Mon Sep 17 00:00:00 2001 From: Laura Dolibois Date: Mon, 2 Jun 2025 23:32:30 +0200 Subject: [PATCH] added a message "no items found" --- 01-frontend/public/locales/de/translation.json | 1 + 01-frontend/public/locales/en/translation.json | 1 + 01-frontend/src/pages/Home.tsx | 10 +++++++--- 01-frontend/src/pages/pages.css | 5 +++++ 4 files changed, 14 insertions(+), 3 deletions(-) diff --git a/01-frontend/public/locales/de/translation.json b/01-frontend/public/locales/de/translation.json index 60e74d9..ebc8068 100644 --- a/01-frontend/public/locales/de/translation.json +++ b/01-frontend/public/locales/de/translation.json @@ -43,6 +43,7 @@ "name": "Name", "next": "Weiter", "noActiveOrders": "Keine laufenden Bestellungen.", + "noItemsFound": "Keine Artikel gefunden.", "noPreviousOrders": "Keine vergangenen Bestellungen.", "openSettings": "Einstellungen öffnen", "order": "Bestellung", diff --git a/01-frontend/public/locales/en/translation.json b/01-frontend/public/locales/en/translation.json index 36d73f1..27824d2 100644 --- a/01-frontend/public/locales/en/translation.json +++ b/01-frontend/public/locales/en/translation.json @@ -43,6 +43,7 @@ "name": "Name", "next": "Next", "noActiveOrders": "No active orders.", + "noItemsFound": "No Items found.", "noPreviousOrders": "No previous orders.", "openSettings": "Open settings", "order": "Order", diff --git a/01-frontend/src/pages/Home.tsx b/01-frontend/src/pages/Home.tsx index 501aee7..00d5299 100644 --- a/01-frontend/src/pages/Home.tsx +++ b/01-frontend/src/pages/Home.tsx @@ -538,9 +538,13 @@ export default function Home() {
- {visibleItems.map((item) => ( - - ))} + {visibleItems.length === 0 ? ( +

{t('noItemsFound')}

+ ) : ( + visibleItems.map((item) => ( + + )) + )}
{/* Loader für Intersection Observer */} diff --git a/01-frontend/src/pages/pages.css b/01-frontend/src/pages/pages.css index 9710020..89c2cd6 100644 --- a/01-frontend/src/pages/pages.css +++ b/01-frontend/src/pages/pages.css @@ -142,4 +142,9 @@ display: flex; justify-content: center; margin-top: 24px; +} + +.no-results { + text-align: center; + font-size: 1rem; } \ No newline at end of file