Move scrobble rank from firstlast partial to view.

Eventually moving this to its own partial (probably)
This commit is contained in:
mitteneer 2025-05-31 13:37:34 -04:00
parent 62590fee37
commit d81681e698
5 changed files with 25 additions and 17 deletions

View file

@ -9,8 +9,10 @@
</head>
<body>
@partial partials/header
<h1>{{.album}}</h1>
@partial partials/firstlast_listens(scrobbles: .album.scrobbles, rank: .album.rank, firstlast: .firstlast)
<h1>{{.album.name}}</h1>
<div>{{.album.scrobbles}} scrobbles ({{.album.rank}} place)</div>
<div>{{.album.song_num}} songs</div>
@partial partials/firstlast_listens(firstlast: .firstlast)
<h3>Yearly Performance</h3>
@partial partials/timescale(range: .yearly)
<h2>Songs</h2>

View file

@ -10,9 +10,14 @@
<body>
@partial partials/header
<h1>{{.artist.name}}</h1>
@partial partials/firstlast_listens(scrobbles: .artist.scrobbles, rank: .artist.rank, firstlast: .firstlast)
<h3>Yearly Performance</h3>
<div>
<div>{{.artist.scrobbles}} scrobbles ({{.artist.rank}} place)</div>
<div>{{.artist.song_num}} songs</div>
<div>{{.artist.album_num}} albums</div>
</div>
@partial partials/timescale(range: .yearly)
<br>
@partial partials/firstlast_listens(firstlast: .firstlast)
<h2>Albums</h2>
@partial partials/newtable(T: ColumnChoices, table_data: .albums, columns: columns)

View file

@ -1,12 +1,10 @@
@args scrobbles: i64, rank: []const u8, firstlast: *ZmplValue
@args firstlast: *ZmplValue
@zig {
const songs = firstlast.items(.array);
}
<div>
{{scrobbles}} scrobbles ({{rank}} place)
<br>
First listen: <a href="/songs/{{songs[0].song.id}}">{{songs[0].song.name}}</a> ({{songs[0].date}})
<br>
Most recent listen: <a href="/songs/{{songs[1].song.id}}">{{songs[1].song.name}}</a> ({{songs[1].date}})

View file

@ -1,5 +1,6 @@
@args range: *ZmplValue
<div>
<table>
<thead>
<tr>
@ -8,11 +9,12 @@
</tr>
</thead>
<tbody>
@for (range) |itm| {
<tr>
<td>{{itm.date}}:</td>
<td>{{itm.scrobbles}}</td>
</tr>
}
</tbody>
</table>
@for (range) |itm| {
<tr>
<td>{{itm.date}}:</td>
<td>{{itm.scrobbles}}</td>
</tr>
}
</tbody>
</table>
</div>

View file

@ -9,8 +9,9 @@
</head>
<body>
@partial partials/header
<h1>{{.song}}</h1>
@partial partials/firstlast_listens(scrobbles: .song.scrobbles, rank: .song.rank, firstlast: .firstlast)
<h1>{{.song.name}}</h1>
<div>{{.song.scrobbles}} scrobbles ({{.song.rank}} place)</div>
@partial partials/firstlast_listens(firstlast: .firstlast)
<h3>Yearly Performance</h3>
@partial partials/timescale(range: .yearly)
<h2>Scrobbles</h2>