feat: monthly stats panel in rotating insight banner (closes #100)

- Add PHP action 'monthly_stats' + getMonthlyStats() function:
  items consumed/added/wasted this month, trend vs prev month,
  top 5 categories and top 3 products by transaction count
- Expand insight rotation from 2 → 3 phases (waste → nutrition → monthly)
- Add _renderMonthlyStatsSection() following nutrition section styling:
  large indigo number, trend arrow with %, horizontal category bars
  animated on show, badges for added/wasted/top-product
- Add ms-* CSS classes (bar chart layout matching nutr-* design)
- Add stats_monthly translations in it/en/de/fr/es (10 keys each)
This commit is contained in:
dadaloop82
2026-05-26 17:19:54 +00:00
parent 695c23fc21
commit b985247b95
9 changed files with 347 additions and 27 deletions
+12
View File
@@ -1424,5 +1424,17 @@
"retry": "Erneut versuchen",
"syncing_local": "Lokale Daten synchronisieren...",
"sync_done": "Lokale Daten aktualisiert"
},
"stats_monthly": {
"title": "Monatsstatistik",
"consumed": "Produkte verbraucht",
"trend_up": "+{pct}% vs. {prev}",
"trend_down": "-{pct}% vs. {prev}",
"trend_same": "gleiches Tempo wie letzten Monat",
"added": "hinzugefügt",
"wasted": "verschwendet",
"top_used": "meistbenutzt",
"top_cats": "Hauptkategorien",
"source": "Transaktionsverlauf · aktueller Monat"
}
}
+12
View File
@@ -1424,5 +1424,17 @@
"retry": "Retry",
"syncing_local": "Syncing local data...",
"sync_done": "Local data synced"
},
"stats_monthly": {
"title": "Monthly Stats",
"consumed": "products used",
"trend_up": "+{pct}% vs {prev}",
"trend_down": "-{pct}% vs {prev}",
"trend_same": "same pace as last month",
"added": "added",
"wasted": "wasted",
"top_used": "top used",
"top_cats": "Top categories",
"source": "Transaction history · current month"
}
}
+12
View File
@@ -1367,5 +1367,17 @@
"retry": "Reintentar",
"syncing_local": "Sincronizando datos locales...",
"sync_done": "Datos locales sincronizados"
},
"stats_monthly": {
"title": "Estadísticas Mensuales",
"consumed": "productos usados",
"trend_up": "+{pct}% vs {prev}",
"trend_down": "-{pct}% vs {prev}",
"trend_same": "mismo ritmo que el mes pasado",
"added": "añadidos",
"wasted": "desperdiciados",
"top_used": "más usado",
"top_cats": "Categorías principales",
"source": "Historial de transacciones · mes actual"
}
}
+12
View File
@@ -1367,5 +1367,17 @@
"retry": "Réessayer",
"syncing_local": "Synchronisation des données locales...",
"sync_done": "Données locales synchronisées"
},
"stats_monthly": {
"title": "Statistiques Mensuelles",
"consumed": "produits utilisés",
"trend_up": "+{pct}% vs {prev}",
"trend_down": "-{pct}% vs {prev}",
"trend_same": "même rythme que le mois dernier",
"added": "ajoutés",
"wasted": "gaspillés",
"top_used": "le plus utilisé",
"top_cats": "Catégories principales",
"source": "Historique des transactions · mois en cours"
}
}
+12
View File
@@ -1424,5 +1424,17 @@
"retry": "Riprova",
"syncing_local": "Sincronizzazione dati locali...",
"sync_done": "Dati locali aggiornati"
},
"stats_monthly": {
"title": "Statistiche Mensili",
"consumed": "prodotti usati",
"trend_up": "+{pct}% rispetto a {prev}",
"trend_down": "-{pct}% rispetto a {prev}",
"trend_same": "stesso ritmo del mese scorso",
"added": "aggiunti",
"wasted": "sprecati",
"top_used": "più usato",
"top_cats": "Categorie principali",
"source": "Storico transazioni · mese corrente"
}
}