From fd89040c4af54caae6ab8b262dae826522674ab6 Mon Sep 17 00:00:00 2001 From: Alexander Schmidt Date: Sat, 31 Jan 2026 17:28:43 +0100 Subject: [PATCH] improve listing --- css/components.css | 8 +++ js/components/pages/page-listing.js | 80 ++++++++++++++++++++++++++--- js/services/directus.js | 40 +++++++++++---- 3 files changed, 110 insertions(+), 18 deletions(-) diff --git a/css/components.css b/css/components.css index 5ac8765..3057346 100644 --- a/css/components.css +++ b/css/components.css @@ -394,6 +394,14 @@ app-shell main { margin-bottom: var(--space-md); } +.empty-state p { + margin-bottom: var(--space-lg); +} + +.empty-state .btn { + margin-top: var(--space-md); +} + /* Dropdown */ .dropdown { position: relative; diff --git a/js/components/pages/page-listing.js b/js/components/pages/page-listing.js index 954753e..9d02de5 100644 --- a/js/components/pages/page-listing.js +++ b/js/components/pages/page-listing.js @@ -53,9 +53,12 @@ class PageListing extends HTMLElement { return } - const images = this.listing.images || [] + const images = (this.listing.images || []).slice(0, 5) const hasImages = images.length > 0 - const firstImage = hasImages ? this.getImageUrl(images[0]) : null + const firstImage = hasImages ? this.getImageUrl(images[0], 800) : null + this.currentImageIndex = 0 + this.allImages = images + const placeholderSvg = /* html */` @@ -65,7 +68,6 @@ class PageListing extends HTMLElement { ` const categoryName = this.listing.category?.name || this.listing.category?.slug || '' - const locationName = this.listing.location?.name || '' const price = this.formatPrice(this.listing.price, this.listing.currency) const createdDate = this.listing.date_created ? new Date(this.listing.date_created).toLocaleDateString() @@ -74,16 +76,16 @@ class PageListing extends HTMLElement { this.innerHTML = /* html */`