Skip to main content

max / makenotwork

3.7 KB · 98 lines History Blame Raw
1 {%- import "partials/_ui.html" as ui -%}
2 <div class="tab-docs"><a href="/docs/analytics">Docs: Analytics &rarr;</a> <a href="/dashboard/export" class="analytics-export-link">Export data &rarr;</a></div>
3
4 <div class="analytics-range-bar">
5 <h2 class="analytics-range-heading">{% if active_range == "7d" %}Last 7 days{% else if active_range == "30d" %}Last 30 days{% else if active_range == "90d" %}Last 90 days{% else %}All time{% endif %}</h2>
6 <div class="time-selector">
7 <button class="{% if active_range == "7d" %}is-selected{% endif %}"
8 hx-get="/dashboard/tabs/analytics?range=7d"
9 hx-target="#tab-content"
10 hx-swap="innerHTML">7d</button>
11 <button class="{% if active_range == "30d" %}is-selected{% endif %}"
12 hx-get="/dashboard/tabs/analytics?range=30d"
13 hx-target="#tab-content"
14 hx-swap="innerHTML">30d</button>
15 <button class="{% if active_range == "90d" %}is-selected{% endif %}"
16 hx-get="/dashboard/tabs/analytics?range=90d"
17 hx-target="#tab-content"
18 hx-swap="innerHTML">90d</button>
19 <button class="{% if active_range == "all" %}is-selected{% endif %}"
20 hx-get="/dashboard/tabs/analytics?range=all"
21 hx-target="#tab-content"
22 hx-swap="innerHTML">All</button>
23 </div>
24 </div>
25
26 <div class="stats-grid">
27 {% for stat in stats %}
28 <div class="card-muted">
29 <div class="stat-label">{{ stat.label }}</div>
30 <div class="stat-value">{{ stat.value }}</div>
31 {% if let Some(change) = stat.change %}
32 <div class="stat-change{% if stat.is_positive %} positive{% endif %}">{{ change }}</div>
33 {% endif %}
34 </div>
35 {% endfor %}
36 </div>
37
38 <div class="chart-container">
39 <div class="chart-header">
40 <h2 class="subsection-title">Revenue Over Time</h2>
41 </div>
42 {% if bars.is_empty() %}
43 {% call ui::empty_state_chart("Once you publish items and make sales, revenue data will appear here.") %}{% endcall %}
44 {% else %}
45 {% include "partials/chart_bars.html" %}
46 {% endif %}
47 </div>
48
49 {% if project_comparisons.len() > 1 %}
50 <div class="chart-container analytics-section--comparison">
51 <h2 class="subsection-title">Project Comparison</h2>
52 <div class="analytics-table-wrap">
53 <table class="data-table analytics-table">
54 <thead>
55 <tr>
56 <th>Project</th>
57 <th>Revenue</th>
58 <th>Sales</th>
59 <th>Views</th>
60 <th>Conversion</th>
61 </tr>
62 </thead>
63 <tbody>
64 {% for p in project_comparisons %}
65 <tr>
66 <td>{{ p.title }}</td>
67 <td>
68 <div class="analytics-revenue-cell">
69 <div class="analytics-revenue-bar" style="--fill: {{ p.revenue_pct }}%;"></div>
70 {{ p.revenue }}
71 </div>
72 </td>
73 <td>{{ p.sales }}</td>
74 <td>{{ p.views }}</td>
75 <td>{{ p.conversion }}</td>
76 </tr>
77 {% endfor %}
78 </tbody>
79 </table>
80 </div>
81 </div>
82 {% endif %}
83
84 <div class="analytics-grid">
85 <div class="card-muted">
86 <h3>Top Projects by Revenue</h3>
87 {% if top_projects.is_empty() %}
88 {% call ui::empty_state_compact("No revenue data yet. Sales across your projects will appear here.") %}{% endcall %}
89 {% else %}
90 <ul class="analytics-list">
91 {% for project in top_projects %}
92 <li><span>{{ project.title }}</span><span>{{ project.revenue }}</span></li>
93 {% endfor %}
94 </ul>
95 {% endif %}
96 </div>
97 </div>
98