I only tested it on small datasets, and it wasn't so bad, but with my whole LastFM dataset, it is very bad
59 lines
No EOL
2.1 KiB
Text
59 lines
No EOL
2.1 KiB
Text
@zig {
|
|
const ColumnChoices = []const enum{song, album, artist, artistlist, scrobbles, date};
|
|
const columns: ColumnChoices = &.{.song, .artistlist, .album, .date};
|
|
const dis_columns: ColumnChoices = &.{.song, .album, .artistlist, .scrobbles};
|
|
}
|
|
|
|
<html>
|
|
<head>
|
|
<script src="https://cdn.jsdelivr.net/npm/htmx.org@2.0.5/dist/htmx.min.js" integrity="sha384-t4DxZSyQK+0Uv4jzy5B0QyHyWQD2GFURUmxKMBVww9+e2EJ0ei/vCvv7+79z0fkr" crossorigin="anonymous"></script>
|
|
<meta charset="UTF-8">
|
|
</head>
|
|
<body>
|
|
@partial partials/header
|
|
@if ($.disambiguation)
|
|
<h1>{{.name}} (disambiguation)</h1>
|
|
@partial partials/newtable(T: ColumnChoices, table_data: .songs, columns: dis_columns)
|
|
@else
|
|
|
|
@zig {
|
|
const reviews = try zmpl.coerceArray(".reviews");
|
|
}
|
|
<div style="text-align:center">
|
|
<h1>{{.song.song_name}}</h1>
|
|
</div>
|
|
|
|
<div style="display:flex;flex-direction:row;justify-content:space-evenly">
|
|
<div style="display:flex;flex-direction:column;align-self:left">
|
|
@if ($.song.is_tie)
|
|
<div>{{.song.scrobbles}} scrobbles ({{.song.rank}} place, tied)</div>
|
|
@else
|
|
<div>{{.song.scrobbles}} scrobbles ({{.song.rank}} place)</div>
|
|
@end
|
|
@partial partials/firstlast_listens(firstlast: .firstlast)
|
|
<h3>Yearly Performance</h3>
|
|
@partial partials/timescale(range: .yearly)
|
|
<h2>Scrobbles</h2>
|
|
@partial partials/newtable(T: ColumnChoices, table_data: .scrobbles, columns: columns)
|
|
</div>
|
|
<div style="display:flex;flex-direction:column;align-self:right">
|
|
<h2>Rating</h2>
|
|
<div id="review-container">
|
|
@zig {
|
|
if (reviews.len == 0) {
|
|
<form>
|
|
<input type="number" name="score" id="score" style="width:50px;height:30px">
|
|
<textarea name="review" id="review" style="width:350px;height:100px"></textarea>
|
|
<button hx-post="/ratings/songs" hx-vals='{"song_id":"{{.song.song_id}}"}' hx-target="#review-container" style="width:50px;height:30px">Post</button>
|
|
</form>
|
|
} else {
|
|
for (reviews) |review| {
|
|
<b>{{review.score}}</b>: {{review.review}} ({{review.date}})
|
|
}
|
|
}
|
|
}
|
|
</div>
|
|
</div>
|
|
@end
|
|
</body>
|
|
</html> |