From f5e319ce0330d737b3e98d02df4c1811416a9d72 Mon Sep 17 00:00:00 2001 From: Jon Seager Date: Sun, 8 Feb 2026 16:10:32 +0000 Subject: [PATCH] feat(ui): add empty states for stats and data sections Show blurred placeholder cards with "No stats yet" / "No data yet" labels when no data exists, instead of hiding the sections entirely. --- src/application/routes/app/stats.rs | 5 +++ templates/pages/home.html | 36 +++++++++++++++++-- templates/pages/stats.html | 56 +++++++++++++++++++++++++++++ 3 files changed, 95 insertions(+), 2 deletions(-) diff --git a/src/application/routes/app/stats.rs b/src/application/routes/app/stats.rs index a2ec796..2f53af3 100644 --- a/src/application/routes/app/stats.rs +++ b/src/application/routes/app/stats.rs @@ -117,6 +117,10 @@ pub(crate) async fn stats_page( .collect(); let max_grinder_weight = cached.brewing_summary.max_grinder_weight; + let has_data = cached.consumption.brews_all_time > 0 + || cached.roast_summary.unique_origins > 0 + || !cached.brewing_summary.brewer_counts.is_empty(); + let template = StatsPageTemplate { nav_active: "stats", is_authenticated, @@ -137,6 +141,7 @@ pub(crate) async fn stats_page( consumption_30d_weight, consumption_all_time_weight, cache_age, + has_data, }; render_html(template).map(IntoResponse::into_response) diff --git a/templates/pages/home.html b/templates/pages/home.html index abeaa7e..8c28881 100644 --- a/templates/pages/home.html +++ b/templates/pages/home.html @@ -258,7 +258,6 @@ is_authenticated %} -{% if !stat_cards.is_empty() %}

Stats

@@ -266,6 +265,7 @@ is_authenticated %} >View all stats →
+ {% if !stat_cards.is_empty() %}
-{% endif %}
@@ -300,6 +315,7 @@ is_authenticated %} >View all data → + {% if !stats.is_empty() %}
{% endblock %} diff --git a/templates/pages/stats.html b/templates/pages/stats.html index 3a8bb33..50063a4 100644 --- a/templates/pages/stats.html +++ b/templates/pages/stats.html @@ -10,6 +10,7 @@

Aggregated coffee data across origins, consumption, and brewing.

+{% if has_data %}
{% include "partials/tab_bar.html" %} @@ -120,4 +121,59 @@ {% endif %}
+{% else %} +
+ +
+ No stats yet +
+
+{% endif %} {% endblock %}