Skip to content

Commit

Permalink
fix(playlist): popup loading delay
Browse files Browse the repository at this point in the history
  • Loading branch information
mbaraa committed Jun 3, 2024
1 parent 7f82057 commit b219a58
Showing 1 changed file with 7 additions and 8 deletions.
15 changes: 7 additions & 8 deletions app/views/components/playlist/popup.templ
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import (
)

templ PlaylistsPopup(index int, songId string) {
@menus.Popup(fmt.Sprint(index), "Add to playlist", popupButton(songId), playlistSelector(songId))
@menus.Popup(fmt.Sprint(index), "Add to playlist", popupButton(), playlistSelector(songId))
}

templ playlistSelector(songId string) {
Expand All @@ -19,11 +19,14 @@ templ playlistSelector(songId string) {
"min-w-[350px]", "bg-accent-trans-30", "backdrop-blur-xl", "p-3", "text-secondary",
"rounded-b-[10px]", "rounded-l-[10px]",
}
hx-get={ "/api/playlist/all?song-id=" + songId }
hx-swap="outerHTML"
hx-trigger="intersect"
>
<div id="playlist-loading" class={ "w-full", "flex", "justify-center" }>
<div id="playlist-loading" class={ "w-full", "flex", "flex-col", "items-center", "justify-center" }>
<div class={ "loader", "!h-20", "!w-20" }></div>
<span class={ "text-secondary", "text-xl" }>Loading playlists...</span>
</div>
<span class={ "text-secondary", "text-xl" }>Loading playlists...</span>
</div>
}

Expand Down Expand Up @@ -84,13 +87,9 @@ templ PlaylistsSelector(songId string, playlists []entities.Playlist, songsInPla
</div>
}

templ popupButton(songId string) {
templ popupButton() {
<div
class={ "flex", "gap-x-2", "items-center", "p-2", "w-full" }
hx-get={ "/api/playlist/all?song-id=" + songId }
hx-swap="outerHTML"
hx-trigger="click"
hx-target={ "#playlists-" + songId }
>
@icons.AddToPlaytlist()
<span>Save to a playlist</span>
Expand Down

0 comments on commit b219a58

Please sign in to comment.