Skip to main content

max / makenotwork

2.2 KB · 49 lines History Blame Raw
1 {%- import "partials/_ui.html" as ui -%}
2 <div class="stats-grid">
3 {% for stat in stats %}
4 <div class="card-muted">
5 <div class="stat-label">{{ stat.label }}</div>
6 <div class="stat-value">{{ stat.value }}</div>
7 {% if let Some(change) = stat.change %}
8 <div class="stat-change{% if stat.is_positive %} positive{% endif %}">{{ change }}</div>
9 {% endif %}
10 </div>
11 {% endfor %}
12 </div>
13
14 <div class="chart-container">
15 <div class="chart-header">
16 <h2 class="subsection-title">Revenue Over Time</h2>
17 <div class="time-selector">
18 <button class="{% if active_range == "7d" %}is-selected{% endif %}"
19 hx-get="/dashboard/item/{{ item_id }}/analytics?range=7d"
20 hx-target="#item-analytics"
21 hx-swap="innerHTML">7d</button>
22 <button class="{% if active_range == "30d" %}is-selected{% endif %}"
23 hx-get="/dashboard/item/{{ item_id }}/analytics?range=30d"
24 hx-target="#item-analytics"
25 hx-swap="innerHTML">30d</button>
26 <button class="{% if active_range == "90d" %}is-selected{% endif %}"
27 hx-get="/dashboard/item/{{ item_id }}/analytics?range=90d"
28 hx-target="#item-analytics"
29 hx-swap="innerHTML">90d</button>
30 <button class="{% if active_range == "all" %}is-selected{% endif %}"
31 hx-get="/dashboard/item/{{ item_id }}/analytics?range=all"
32 hx-target="#item-analytics"
33 hx-swap="innerHTML">All</button>
34 </div>
35 </div>
36 {% if bars.is_empty() %}
37 {% call ui::empty_state_chart("No revenue data yet. Sales will appear here once fans purchase this item.") %}
38 {% else %}
39 <div class="chart-bars">
40 {% for bar in bars %}
41 <div class="chart-bar-col" data-tooltip="{{ bar.value }} / {{ bar.count }} sale{% if bar.count != 1 %}s{% endif %}">
42 <div class="chart-bar" style="height: {{ bar.height_pct }}%;"></div>
43 <div class="chart-bar-label">{{ bar.label }}</div>
44 </div>
45 {% endfor %}
46 </div>
47 {% endif %}
48 </div>
49