From ac40c7d949e9ad593a92dea0c3d889721bf5ca1f Mon Sep 17 00:00:00 2001 From: patrickzerhusen Date: Wed, 13 May 2026 14:21:05 +0200 Subject: [PATCH] updatet sidebar styling and texts, included statistics in category-filter --- public/index.php | 85 ++++++++++++++++++++++------------------------- public/js/app.js | 57 +++++++++++-------------------- public/styles.css | 1 + 3 files changed, 60 insertions(+), 83 deletions(-) diff --git a/public/index.php b/public/index.php index e39fac9..f1e7224 100644 --- a/public/index.php +++ b/public/index.php @@ -131,9 +131,9 @@ $news_items = $stmt->fetchAll();
@@ -148,17 +148,12 @@ $news_items = $stmt->fetchAll(); @@ -176,9 +171,44 @@ $news_items = $stmt->fetchAll(); + + + +
+

+ Neuigkeiten + +

+
- +

Hilfe @@ -206,44 +236,7 @@ $news_items = $stmt->fetchAll();

Gerne können Sie Ihre Meinung zu bestehenden Beiträgen auch durch die Kommentarfunktion äußern.

Suchen

-

Verwenden Sie die Adresssuche rechts, um schnell den richtigen Ort auf der Mitmachkarte zu finden.

- - -
- - - -
-

- Neuigkeiten - -

-
diff --git a/public/js/app.js b/public/js/app.js index 89fb140..f68997b 100644 --- a/public/js/app.js +++ b/public/js/app.js @@ -346,7 +346,7 @@ function loadContributions() { layerControl.addOverlay(contributionsLayer, ' Beiträge'); // Update Sidebar List and Statistics updateContributionsList(); - updateStatistics(); + buildCategoryFilter(); }); } @@ -766,7 +766,7 @@ function updateContributionsList() { // Builds HTML if (filtered.length === 0) { - container.innerHTML = '

Keine Beiträge gefunden.

'; + container.innerHTML = '

Keine Beiträge gefunden.

'; return; } @@ -830,22 +830,33 @@ document.getElementById('list-search-input').addEventListener('input', function // Block 12: Sidebar Category Filter and Statistics // ===================================================================== -// Builds Category Filter Checkboxes +// Builds Category Filter Checkboxes with Counts function buildCategoryFilter() { const container = document.getElementById('category-filter'); + + const counts = {}; + contributionsData.forEach(function (f) { + const cat = f.properties.category; + counts[cat] = (counts[cat] || 0) + 1; + }); + + const total = contributionsData.length; let html = ''; for (const key in CATEGORIES) { const cat = CATEGORIES[key]; const checked = activeFilters.indexOf(key) !== -1 ? 'checked' : ''; + const count = counts[key] || 0; - html += '' + - ''; + html += ''; } + html += '

' + total + ' Beiträge insgesamt

'; + container.innerHTML = html; } @@ -892,34 +903,6 @@ function toggleCategoryFilter(checkbox) { updateContributionsList(); } -// Updates Statistics in Home Tab -function updateStatistics() { - const container = document.getElementById('stats-container'); - const total = contributionsData.length; - - // Counts per Category - const counts = {}; - contributionsData.forEach(function (f) { - const cat = f.properties.category; - counts[cat] = (counts[cat] || 0) + 1; - }); - - let html = '

' + total + ' Beiträge insgesamt

'; - - for (const key in CATEGORIES) { - const cat = CATEGORIES[key]; - const count = counts[key] || 0; - if (count > 0) { - html += '
' + - categoryIcon(cat) + ' ' + - cat.label + ': ' + count + - '
'; - } - } - - container.innerHTML = html; -} - // ===================================================================== // Block 13: Modals — Welcome, Login, Info, Privacy, Imprint @@ -1034,7 +1017,7 @@ function escapeHtml(text) { // Returns a colored Font Awesome Icon HTML String for a Category function categoryIcon(cat) { - return ''; + return ''; } // Reverse Geocodes Coordinates and saves Address to Contribution via API diff --git a/public/styles.css b/public/styles.css index 1772fe7..efa3990 100644 --- a/public/styles.css +++ b/public/styles.css @@ -464,6 +464,7 @@ select.form-input { cursor: pointer; } margin-bottom: var(--space-sm); line-height: 1.5; color: var(--color-text-secondary); + font-size: 0.85rem; }