Skip to content

Commit

Permalink
chore(playlist): organize options
Browse files Browse the repository at this point in the history
  • Loading branch information
mbaraa committed Jun 3, 2024
1 parent f995001 commit 3fa05dc
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 23 deletions.
24 changes: 12 additions & 12 deletions app/views/components/playlist/options.templ
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,18 @@ templ playlistOptions(playlist entities.Playlist) {
<h3 class={ "text-lg", "font-medium" }>Playlist's Options</h3>
<hr/>
@publicPlaylistToggle(playlist.PublicId, playlist.IsPublic)
<button
class={
"popover-trigger", "p-2", "rounded-md", "hover:bg-accent-trans-20",
"flex", "items-center", "gap-x-2", "w-full",
}
title="Copy link to this playlist"
type="button"
onClick={ copyLink(playlist.IsPublic, playlist.PublicId) }
>
@icons.ShareLink()
<span>Share playlist</span>
</button>
if len(playlist.Songs) != 0 {
<button
class={
Expand All @@ -40,18 +52,6 @@ templ playlistOptions(playlist entities.Playlist) {
<span>Play next</span>
</button>
}
<button
class={
"popover-trigger", "p-2", "rounded-md", "hover:bg-accent-trans-20",
"flex", "items-center", "gap-x-2", "w-full",
}
title="Copy link to this playlist"
type="button"
onClick={ copyLink(playlist.IsPublic, playlist.PublicId) }
>
@icons.ShareLink()
<span>Share playlist</span>
</button>
if perm, ok := ctx.Value("playlist-permission").(models.PlaylistPermissions); ok && (perm & models.JoinerPermission) != 0 {
<button
class={
Expand Down
22 changes: 11 additions & 11 deletions app/views/pages/playlist.templ
Original file line number Diff line number Diff line change
Expand Up @@ -19,20 +19,20 @@ templ playlistHeader(pl entities.Playlist) {
<div class={ "mb-4", "flex", "justify-between", "items-center" }>
@navlink.LinkContainer("/playlists", "Playlists", backButton())
<div class={ "flex", "gap-x-2", "items-center" }>
<button
class={
"popover-trigger", "p-2", "rounded-md", "hover:bg-accent-trans-20",
"flex", "justify-center", "items-center",
}
title="Copy link to this playlist"
type="button"
onClick={ copyLink(pl.IsPublic) }
>
@icons.ShareLink()
</button>
if perm, ok := ctx.Value("playlist-permission").(models.PlaylistPermissions); ok && (perm & models.OwnerPermission) != 0 {
@playlist.PlaylistsOptions(pl)
} else {
<button
class={
"popover-trigger", "p-2", "rounded-md", "hover:bg-accent-trans-20",
"flex", "justify-center", "items-center",
}
title="Copy link to this playlist"
type="button"
onClick={ copyLink(pl.IsPublic) }
>
@icons.ShareLink()
</button>
@joinLeavePlaylist(pl.PublicId, perm)
}
</div>
Expand Down

0 comments on commit 3fa05dc

Please sign in to comment.