feat: improve album track list ui

This commit is contained in:
Araozu 2024-10-08 19:33:18 -05:00
parent 3e4fd28ccf
commit 50bd94dfc0
2 changed files with 13 additions and 6 deletions

View File

@ -3,6 +3,7 @@ package album
import ( import (
"acide/src/utils" "acide/src/utils"
"fmt" "fmt"
"strconv"
) )
templ albumTempl(albumId string, album *utils.Album, songs []utils.Song) { templ albumTempl(albumId string, album *utils.Album, songs []utils.Song) {
@ -15,10 +16,10 @@ templ albumTempl(albumId string, album *utils.Album, songs []utils.Song) {
<p> <p>
{ album.Artist } { album.Artist }
</p> </p>
<div class="text-left"> <div>
for _, song := range songs { for _, song := range songs {
<p <button
class="py-2 px-4" class="inline-block py-2 pl-2 pr-4 w-full cursor-pointer text-left hover:bg-sky-100 whitespace-nowrap overflow-hidden overflow-ellipsis"
_={ fmt.Sprintf("on click playSong('%s', '%s', '%s', '%s')", _={ fmt.Sprintf("on click playSong('%s', '%s', '%s', '%s')",
utils.EscapeSingle(song.Title), utils.EscapeSingle(song.Title),
utils.EscapeSingle(song.Artist), utils.EscapeSingle(song.Artist),
@ -26,8 +27,11 @@ templ albumTempl(albumId string, album *utils.Album, songs []utils.Song) {
song.ID, song.ID,
) } ) }
> >
<span class="inline-block w-6 text-right opacity-75 pr-2">
{ strconv.Itoa(song.TrackNumber) }
</span>
{ song.Title } { song.Title }
</p> </button>
} }
</div> </div>
</div> </div>

View File

@ -39,11 +39,14 @@ templ MusicPlayer() {
<p id="music-player-title" class="overflow-hidden overflow-ellipsis whitespace-nowrap w-full">-</p> <p id="music-player-title" class="overflow-hidden overflow-ellipsis whitespace-nowrap w-full">-</p>
<p id="music-player-artist" class="text-sm opacity-75 overflow-hidden overflow-ellipsis whitespace-nowrap w-full">-</p> <p id="music-player-artist" class="text-sm opacity-75 overflow-hidden overflow-ellipsis whitespace-nowrap w-full">-</p>
</div> </div>
<div class="flex items-center justify-center" _="on click togglePlaying()"> <div
class="flex items-center justify-center cursor-pointer"
_="on click togglePlaying()"
>
@playIcon(26) @playIcon(26)
@pauseIcon(26) @pauseIcon(26)
</div> </div>
<button class="flex items-center justify-center" _="on click log $sound"> <button class="flex items-center justify-center">
@skipForwardIcon(24) @skipForwardIcon(24)
</button> </button>
</div> </div>