bsky feeds about music music-atmosphere-feed.plyr.fm/
bsky feed zig

dashboard: sort platforms by percentage descending

+8 -2
+8 -2
src/server/dashboard.zig
··· 179 179 const total = platforms.soundcloud + platforms.bandcamp + platforms.spotify + platforms.plyr; 180 180 181 181 if (total > 0) { 182 - // helper to format percentage - shows "<1%" for non-zero values that round to 0 183 182 const PlatformData = struct { name: []const u8, count: u64, color: []const u8 }; 184 - const platform_list = [_]PlatformData{ 183 + var platform_list = [_]PlatformData{ 185 184 .{ .name = "soundcloud", .count = platforms.soundcloud, .color = "#ff5500" }, 186 185 .{ .name = "bandcamp", .count = platforms.bandcamp, .color = "#1da0c3" }, 187 186 .{ .name = "spotify", .count = platforms.spotify, .color = "#1db954" }, 188 187 .{ .name = "plyr.fm", .count = platforms.plyr, .color = "#7c3aed" }, 189 188 }; 189 + 190 + // sort by count descending 191 + std.mem.sort(PlatformData, &platform_list, {}, struct { 192 + fn cmp(_: void, a: PlatformData, b: PlatformData) bool { 193 + return a.count > b.count; 194 + } 195 + }.cmp); 190 196 191 197 for (platform_list) |p| { 192 198 const pct: f64 = @as(f64, @floatFromInt(p.count)) / @as(f64, @floatFromInt(total)) * 100.0;