+6
-6
src/server/dashboard.zig
+6
-6
src/server/dashboard.zig
···
127
127
\\</head>
128
128
\\<body>
129
129
\\ <div class="container">
130
-
\\ <h1>music atmosphere</h1>
130
+
\\ <h1>music atmosphere by <a href="https://bsky.app/profile/zzstoatzz.io">plyr.fm</a></h1>
131
131
\\ <p class="tagline">bluesky feeds for music links</p>
132
132
\\
133
133
\\ <div class="feeds">
···
189
189
};
190
190
191
191
for (platform_list) |p| {
192
-
const pct = (p.count * 100) / total;
193
-
const bar_width = if (p.count > 0 and pct == 0) @as(u64, 1) else pct; // min 1% width if non-zero
192
+
const pct: f64 = @as(f64, @floatFromInt(p.count * 100)) / @as(f64, @floatFromInt(total));
193
+
const bar_width: u64 = if (p.count > 0 and pct < 1.0) 1 else @intFromFloat(pct);
194
194
try w.print(
195
195
\\ <div class="platform-row"><span class="platform-name">{s}</span><div class="bar"><div class="bar-fill" style="width:{d}%;background:{s}"></div></div><span class="platform-pct">
196
196
, .{ p.name, bar_width, p.color });
197
-
if (p.count > 0 and pct == 0) {
198
-
try w.writeAll("<1%");
197
+
if (p.count > 0 and pct < 0.1) {
198
+
try w.writeAll("<0.1%");
199
199
} else {
200
-
try w.print("{d}%", .{pct});
200
+
try w.print("{d:.1}%", .{pct});
201
201
}
202
202
try w.writeAll("</span></div>\n");
203
203
}