Extract actions_menu
This commit is contained in:
@@ -1,8 +1,7 @@
|
|||||||
defmodule MusicLibraryWeb.AddRecordComponent do
|
defmodule MusicLibraryWeb.AddRecordComponent do
|
||||||
use MusicLibraryWeb, :live_component
|
use MusicLibraryWeb, :live_component
|
||||||
|
|
||||||
import MusicLibraryWeb.RecordComponents,
|
import MusicLibraryWeb.RecordComponents, only: [format_label: 1, type_label: 1]
|
||||||
only: [toggle_actions_menu: 1, close_actions_menu: 1, format_label: 1, type_label: 1]
|
|
||||||
|
|
||||||
alias MusicBrainz.ReleaseGroupSearchResult
|
alias MusicBrainz.ReleaseGroupSearchResult
|
||||||
alias MusicLibrary.Records
|
alias MusicLibrary.Records
|
||||||
@@ -88,37 +87,9 @@ defmodule MusicLibraryWeb.AddRecordComponent do
|
|||||||
)}
|
)}
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
<div class="relative flex-none">
|
|
||||||
<button
|
|
||||||
type="button"
|
|
||||||
class="text-zinc-500 hover:text-zinc-900 dark:text-zinc-400 dark:hover:text-zinc-300"
|
|
||||||
aria-expanded="false"
|
|
||||||
aria-haspopup="true"
|
|
||||||
phx-click={toggle_actions_menu(@release_group.id)}
|
|
||||||
phx-click-away={close_actions_menu(@release_group.id)}
|
|
||||||
>
|
|
||||||
<span class="sr-only">{gettext("Choose which format to import")}</span>
|
|
||||||
<.icon name={@icon_name} class="-mt-1 h-5 w-5" aria-hidden="true" data-slot="icon" />
|
|
||||||
</button>
|
|
||||||
<!--
|
|
||||||
Dropdown menu, show/hide based on menu state.
|
|
||||||
|
|
||||||
Entering: "transition ease-out duration-100"
|
<.actions_menu id={@release_group.id} background_container_target="#records > li">
|
||||||
From: "transform opacity-0 scale-95"
|
<:links>
|
||||||
To: "transform opacity-100 scale-100"
|
|
||||||
Leaving: "transition ease-in duration-75"
|
|
||||||
From: "transform opacity-100 scale-100"
|
|
||||||
To: "transform opacity-0 scale-95"
|
|
||||||
-->
|
|
||||||
<.focus_wrap
|
|
||||||
id={"actions-#{@release_group.id}"}
|
|
||||||
class={[
|
|
||||||
"hidden pointer-events-auto absolute right-0 z-10 mt-2 w-48 origin-top-right rounded-md bg-white dark:bg-zinc-800 py-2 shadow-lg ring-1 ring-zinc-900/5 focus:outline-hidden"
|
|
||||||
]}
|
|
||||||
role="menu"
|
|
||||||
aria-orientation="vertical"
|
|
||||||
aria-labelledby="options-menu-0-button"
|
|
||||||
>
|
|
||||||
<.link
|
<.link
|
||||||
:for={format <- Records.Record.formats()}
|
:for={format <- Records.Record.formats()}
|
||||||
class="block px-3 py-1 text-sm leading-6 text-zinc-900 dark:text-zinc-400 hover:bg-zinc-50 dark:hover:text-zinc-300 dark:hover:bg-zinc-700"
|
class="block px-3 py-1 text-sm leading-6 text-zinc-900 dark:text-zinc-400 hover:bg-zinc-50 dark:hover:text-zinc-300 dark:hover:bg-zinc-700"
|
||||||
@@ -131,8 +102,8 @@ defmodule MusicLibraryWeb.AddRecordComponent do
|
|||||||
>
|
>
|
||||||
{format_label(format)}
|
{format_label(format)}
|
||||||
</.link>
|
</.link>
|
||||||
</.focus_wrap>
|
</:links>
|
||||||
</div>
|
</.actions_menu>
|
||||||
</div>
|
</div>
|
||||||
</li>
|
</li>
|
||||||
"""
|
"""
|
||||||
|
|||||||
@@ -194,6 +194,57 @@ defmodule MusicLibraryWeb.CoreComponents do
|
|||||||
"""
|
"""
|
||||||
end
|
end
|
||||||
|
|
||||||
|
attr :id, :string, required: true
|
||||||
|
attr :class, :string, default: nil
|
||||||
|
attr :background_container_target, :string, required: true
|
||||||
|
slot :links, required: true
|
||||||
|
slot :button, required: false
|
||||||
|
|
||||||
|
def actions_menu(assigns) do
|
||||||
|
~H"""
|
||||||
|
<div class={["relative flex-none", @class]}>
|
||||||
|
<button
|
||||||
|
type="button"
|
||||||
|
class="text-zinc-500 hover:text-zinc-900 dark:text-zinc-400 dark:hover:text-zinc-300"
|
||||||
|
aria-expanded="false"
|
||||||
|
aria-haspopup="true"
|
||||||
|
phx-click={toggle_actions_menu(@id, @background_container_target)}
|
||||||
|
>
|
||||||
|
{render_slot(@button) || default_actions_menu_button(%{})}
|
||||||
|
</button>
|
||||||
|
<.focus_wrap
|
||||||
|
id={"actions-#{@id}"}
|
||||||
|
class={[
|
||||||
|
"hidden pointer-events-auto absolute right-0 z-10 mt-2 w-48 origin-top-right rounded-md bg-white dark:bg-zinc-800 py-2 shadow-lg ring-1 ring-zinc-900/5 focus:outline-hidden"
|
||||||
|
]}
|
||||||
|
role="menu"
|
||||||
|
aria-orientation="vertical"
|
||||||
|
aria-labelledby="options-menu-0-button"
|
||||||
|
phx-click-away={close_actions_menu(@id, @background_container_target)}
|
||||||
|
>
|
||||||
|
{render_slot(@links)}
|
||||||
|
</.focus_wrap>
|
||||||
|
</div>
|
||||||
|
"""
|
||||||
|
end
|
||||||
|
|
||||||
|
defp default_actions_menu_button(assigns) do
|
||||||
|
~H"""
|
||||||
|
<span class="sr-only">{gettext("Open options")}</span>
|
||||||
|
<.icon name="hero-ellipsis-vertical" class="-mt-1 h-5 w-5" aria-hidden="true" data-slot="icon" />
|
||||||
|
"""
|
||||||
|
end
|
||||||
|
|
||||||
|
defp toggle_actions_menu(id, background_container_target) do
|
||||||
|
JS.toggle(to: "#actions-#{id}")
|
||||||
|
|> JS.toggle_class("pointer-events-none", to: background_container_target)
|
||||||
|
end
|
||||||
|
|
||||||
|
defp close_actions_menu(id, background_container_target) do
|
||||||
|
JS.hide(to: "#actions-#{id}")
|
||||||
|
|> JS.remove_class("pointer-events-none", to: background_container_target)
|
||||||
|
end
|
||||||
|
|
||||||
## JS Commands
|
## JS Commands
|
||||||
|
|
||||||
def show(js \\ %JS{}, selector) do
|
def show(js \\ %JS{}, selector) do
|
||||||
|
|||||||
@@ -95,42 +95,8 @@ defmodule MusicLibraryWeb.RecordComponents do
|
|||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
<%!-- TODO: replace with OSS version --%>
|
<%!-- TODO: replace with OSS version --%>
|
||||||
<div class="relative flex-none">
|
<.actions_menu id={record.id} background_container_target="#records > li">
|
||||||
<button
|
<:links>
|
||||||
type="button"
|
|
||||||
class="text-zinc-500 hover:text-zinc-900 dark:text-zinc-400 dark:hover:text-zinc-300"
|
|
||||||
aria-expanded="false"
|
|
||||||
aria-haspopup="true"
|
|
||||||
phx-click={toggle_actions_menu(record.id)}
|
|
||||||
phx-click-away={close_actions_menu(record.id)}
|
|
||||||
>
|
|
||||||
<span class="sr-only">{gettext("Open options")}</span>
|
|
||||||
<.icon
|
|
||||||
name="hero-ellipsis-vertical"
|
|
||||||
class="-mt-1 h-5 w-5"
|
|
||||||
aria-hidden="true"
|
|
||||||
data-slot="icon"
|
|
||||||
/>
|
|
||||||
</button>
|
|
||||||
<!--
|
|
||||||
Dropdown menu, show/hide based on menu state.
|
|
||||||
|
|
||||||
Entering: "transition ease-out duration-100"
|
|
||||||
From: "transform opacity-0 scale-95"
|
|
||||||
To: "transform opacity-100 scale-100"
|
|
||||||
Leaving: "transition ease-in duration-75"
|
|
||||||
From: "transform opacity-100 scale-100"
|
|
||||||
To: "transform opacity-0 scale-95"
|
|
||||||
-->
|
|
||||||
<.focus_wrap
|
|
||||||
id={"actions-#{record.id}"}
|
|
||||||
class={[
|
|
||||||
"hidden pointer-events-auto absolute right-0 z-10 mt-2 w-48 origin-top-right rounded-md bg-white dark:bg-zinc-800 py-2 shadow-lg ring-1 ring-zinc-900/5 focus:outline-hidden"
|
|
||||||
]}
|
|
||||||
role="menu"
|
|
||||||
aria-orientation="vertical"
|
|
||||||
aria-labelledby="options-menu-0-button"
|
|
||||||
>
|
|
||||||
<.link
|
<.link
|
||||||
class="block px-3 py-1 text-sm leading-6 text-zinc-900 dark:text-zinc-400 hover:bg-zinc-50 dark:hover:text-zinc-300 dark:hover:bg-zinc-700"
|
class="block px-3 py-1 text-sm leading-6 text-zinc-900 dark:text-zinc-400 hover:bg-zinc-50 dark:hover:text-zinc-300 dark:hover:bg-zinc-700"
|
||||||
role="menuitem"
|
role="menuitem"
|
||||||
@@ -185,8 +151,8 @@ defmodule MusicLibraryWeb.RecordComponents do
|
|||||||
>
|
>
|
||||||
{gettext("Delete")}
|
{gettext("Delete")}
|
||||||
</.link>
|
</.link>
|
||||||
</.focus_wrap>
|
</:links>
|
||||||
</div>
|
</.actions_menu>
|
||||||
</div>
|
</div>
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
@@ -270,42 +236,8 @@ defmodule MusicLibraryWeb.RecordComponents do
|
|||||||
<p class="pointer-events-none mt-2 block truncate text-sm font-medium text-zinc-900 dark:text-zinc-300">
|
<p class="pointer-events-none mt-2 block truncate text-sm font-medium text-zinc-900 dark:text-zinc-300">
|
||||||
{record.title}
|
{record.title}
|
||||||
</p>
|
</p>
|
||||||
<div class="relative flex-none mt-2">
|
<.actions_menu id={record.id} background_container_target="#records > li" class="mt-2">
|
||||||
<button
|
<:links>
|
||||||
type="button"
|
|
||||||
class="text-zinc-500 hover:text-zinc-900 dark:text-zinc-400 dark:hover:text-zinc-300"
|
|
||||||
aria-expanded="false"
|
|
||||||
aria-haspopup="true"
|
|
||||||
phx-click={toggle_actions_menu(record.id)}
|
|
||||||
phx-click-away={close_actions_menu(record.id)}
|
|
||||||
>
|
|
||||||
<span class="sr-only">{gettext("Open options")}</span>
|
|
||||||
<.icon
|
|
||||||
name="hero-ellipsis-vertical"
|
|
||||||
class="-mt-1 h-5 w-5"
|
|
||||||
aria-hidden="true"
|
|
||||||
data-slot="icon"
|
|
||||||
/>
|
|
||||||
</button>
|
|
||||||
<!--
|
|
||||||
Dropdown menu, show/hide based on menu state.
|
|
||||||
|
|
||||||
Entering: "transition ease-out duration-100"
|
|
||||||
From: "transform opacity-0 scale-95"
|
|
||||||
To: "transform opacity-100 scale-100"
|
|
||||||
Leaving: "transition ease-in duration-75"
|
|
||||||
From: "transform opacity-100 scale-100"
|
|
||||||
To: "transform opacity-0 scale-95"
|
|
||||||
-->
|
|
||||||
<.focus_wrap
|
|
||||||
id={"actions-#{record.id}"}
|
|
||||||
class={[
|
|
||||||
"hidden pointer-events-auto absolute right-0 z-10 mt-2 w-48 origin-top-right rounded-md bg-white dark:bg-zinc-800 py-2 shadow-lg ring-1 ring-zinc-900/5 focus:outline-hidden"
|
|
||||||
]}
|
|
||||||
role="menu"
|
|
||||||
aria-orientation="vertical"
|
|
||||||
aria-labelledby="options-menu-0-button"
|
|
||||||
>
|
|
||||||
<.link
|
<.link
|
||||||
class="block px-3 py-1 text-sm leading-6 text-zinc-900 dark:text-zinc-400 hover:bg-zinc-50 dark:hover:text-zinc-300 dark:hover:bg-zinc-700"
|
class="block px-3 py-1 text-sm leading-6 text-zinc-900 dark:text-zinc-400 hover:bg-zinc-50 dark:hover:text-zinc-300 dark:hover:bg-zinc-700"
|
||||||
role="menuitem"
|
role="menuitem"
|
||||||
@@ -360,8 +292,8 @@ defmodule MusicLibraryWeb.RecordComponents do
|
|||||||
>
|
>
|
||||||
{gettext("Delete")}
|
{gettext("Delete")}
|
||||||
</.link>
|
</.link>
|
||||||
</.focus_wrap>
|
</:links>
|
||||||
</div>
|
</.actions_menu>
|
||||||
</div>
|
</div>
|
||||||
<p class="pointer-events-none block text-sm font-medium text-zinc-500">
|
<p class="pointer-events-none block text-sm font-medium text-zinc-500">
|
||||||
{format_label(record.format)} · {type_label(record.type)}
|
{format_label(record.format)} · {type_label(record.type)}
|
||||||
@@ -450,14 +382,4 @@ defmodule MusicLibraryWeb.RecordComponents do
|
|||||||
country_code
|
country_code
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def toggle_actions_menu(record_id) do
|
|
||||||
JS.toggle(to: "#actions-#{record_id}")
|
|
||||||
|> JS.toggle_class("pointer-events-none", to: "#records > li")
|
|
||||||
end
|
|
||||||
|
|
||||||
def close_actions_menu(record_id) do
|
|
||||||
JS.hide(to: "#actions-#{record_id}")
|
|
||||||
|> JS.remove_class("pointer-events-none", to: "#records > li")
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ defmodule MusicLibraryWeb.ArtistLive.Show do
|
|||||||
use MusicLibraryWeb, :live_view
|
use MusicLibraryWeb, :live_view
|
||||||
|
|
||||||
import MusicLibraryWeb.RecordComponents,
|
import MusicLibraryWeb.RecordComponents,
|
||||||
only: [record_grid: 1, toggle_actions_menu: 1, close_actions_menu: 1, country_label: 1]
|
only: [record_grid: 1, country_label: 1]
|
||||||
|
|
||||||
alias MusicLibrary.Artists.ArtistInfo
|
alias MusicLibrary.Artists.ArtistInfo
|
||||||
alias MusicLibrary.{Artists, Records}
|
alias MusicLibrary.{Artists, Records}
|
||||||
|
|||||||
@@ -6,32 +6,8 @@
|
|||||||
<.country_flag country={@country} />
|
<.country_flag country={@country} />
|
||||||
</h1>
|
</h1>
|
||||||
|
|
||||||
<div class="relative flex-none">
|
<.actions_menu id={@artist.musicbrainz_id} background_container_target="#records > li">
|
||||||
<button
|
<:links>
|
||||||
type="button"
|
|
||||||
class="text-zinc-500 hover:text-zinc-900 dark:text-zinc-400 dark:hover:text-zinc-300"
|
|
||||||
aria-expanded="false"
|
|
||||||
aria-haspopup="true"
|
|
||||||
phx-click={toggle_actions_menu(@artist.musicbrainz_id)}
|
|
||||||
>
|
|
||||||
<span class="sr-only">{gettext("Open options")}</span>
|
|
||||||
<.icon
|
|
||||||
name="hero-ellipsis-vertical"
|
|
||||||
class="-mt-1 h-5 w-5"
|
|
||||||
aria-hidden="true"
|
|
||||||
data-slot="icon"
|
|
||||||
/>
|
|
||||||
</button>
|
|
||||||
<.focus_wrap
|
|
||||||
id={"actions-#{@artist.musicbrainz_id}"}
|
|
||||||
class={[
|
|
||||||
"hidden pointer-events-auto absolute right-0 z-10 mt-2 w-48 origin-top-right rounded-md bg-white dark:bg-zinc-800 py-2 shadow-lg ring-1 ring-zinc-900/5 focus:outline-hidden"
|
|
||||||
]}
|
|
||||||
role="menu"
|
|
||||||
aria-orientation="vertical"
|
|
||||||
aria-labelledby="options-menu-0-button"
|
|
||||||
phx-click-away={close_actions_menu(@artist.musicbrainz_id)}
|
|
||||||
>
|
|
||||||
<.link
|
<.link
|
||||||
class="block px-3 py-1 text-sm leading-6 text-zinc-900 dark:text-zinc-400 hover:bg-zinc-50 dark:hover:text-zinc-300 dark:hover:bg-zinc-700"
|
class="block px-3 py-1 text-sm leading-6 text-zinc-900 dark:text-zinc-400 hover:bg-zinc-50 dark:hover:text-zinc-300 dark:hover:bg-zinc-700"
|
||||||
role="menuitem"
|
role="menuitem"
|
||||||
@@ -63,8 +39,8 @@
|
|||||||
/>
|
/>
|
||||||
{gettext("Refresh info")}
|
{gettext("Refresh info")}
|
||||||
</.link>
|
</.link>
|
||||||
</.focus_wrap>
|
</:links>
|
||||||
</div>
|
</.actions_menu>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="mt-4 flex items-center justify-between">
|
<div class="mt-4 flex items-center justify-between">
|
||||||
|
|||||||
@@ -3,8 +3,6 @@ defmodule MusicLibraryWeb.CollectionLive.Show do
|
|||||||
|
|
||||||
import MusicLibraryWeb.RecordComponents,
|
import MusicLibraryWeb.RecordComponents,
|
||||||
only: [
|
only: [
|
||||||
toggle_actions_menu: 1,
|
|
||||||
close_actions_menu: 1,
|
|
||||||
format_label: 1,
|
format_label: 1,
|
||||||
type_label: 1,
|
type_label: 1,
|
||||||
release_summary: 1
|
release_summary: 1
|
||||||
|
|||||||
@@ -28,32 +28,8 @@
|
|||||||
)} · {type_label(@record.type)}
|
)} · {type_label(@record.type)}
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
<div class="relative flex-none">
|
<.actions_menu id={@record.id} background_container_target="#records > li">
|
||||||
<button
|
<:links>
|
||||||
type="button"
|
|
||||||
class="text-zinc-500 hover:text-zinc-900 dark:text-zinc-400 dark:hover:text-zinc-300"
|
|
||||||
aria-expanded="false"
|
|
||||||
aria-haspopup="true"
|
|
||||||
phx-click={toggle_actions_menu(@record.id)}
|
|
||||||
>
|
|
||||||
<span class="sr-only">{gettext("Open options")}</span>
|
|
||||||
<.icon
|
|
||||||
name="hero-ellipsis-vertical"
|
|
||||||
class="-mt-1 h-5 w-5"
|
|
||||||
aria-hidden="true"
|
|
||||||
data-slot="icon"
|
|
||||||
/>
|
|
||||||
</button>
|
|
||||||
<.focus_wrap
|
|
||||||
id={"actions-#{@record.id}"}
|
|
||||||
class={[
|
|
||||||
"hidden pointer-events-auto absolute right-0 z-10 mt-2 w-48 origin-top-right rounded-md bg-white dark:bg-zinc-800 py-2 shadow-lg ring-1 ring-zinc-900/5 focus:outline-hidden"
|
|
||||||
]}
|
|
||||||
role="menu"
|
|
||||||
aria-orientation="vertical"
|
|
||||||
aria-labelledby="options-menu-0-button"
|
|
||||||
phx-click-away={close_actions_menu(@record.id)}
|
|
||||||
>
|
|
||||||
<.link
|
<.link
|
||||||
class="block px-3 py-1 text-sm leading-6 text-zinc-900 dark:text-zinc-400 hover:bg-zinc-50 dark:hover:text-zinc-300 dark:hover:bg-zinc-700"
|
class="block px-3 py-1 text-sm leading-6 text-zinc-900 dark:text-zinc-400 hover:bg-zinc-50 dark:hover:text-zinc-300 dark:hover:bg-zinc-700"
|
||||||
role="menuitem"
|
role="menuitem"
|
||||||
@@ -134,8 +110,8 @@
|
|||||||
/>
|
/>
|
||||||
{gettext("Delete")}
|
{gettext("Delete")}
|
||||||
</.link>
|
</.link>
|
||||||
</.focus_wrap>
|
</:links>
|
||||||
</div>
|
</.actions_menu>
|
||||||
</div>
|
</div>
|
||||||
<div class="mt-4">
|
<div class="mt-4">
|
||||||
<%!-- TODO: replace with OSS version --%>
|
<%!-- TODO: replace with OSS version --%>
|
||||||
|
|||||||
@@ -216,16 +216,6 @@ defmodule MusicLibraryWeb.StatsLive.Index do
|
|||||||
|> DateTime.to_iso8601()
|
|> DateTime.to_iso8601()
|
||||||
end
|
end
|
||||||
|
|
||||||
defp toggle_actions_menu(track_id) do
|
|
||||||
JS.toggle(to: "#actions-#{track_id}")
|
|
||||||
|> JS.toggle_class("pointer-events-none", to: "#scrobble-activity > li")
|
|
||||||
end
|
|
||||||
|
|
||||||
defp close_actions_menu(track_id) do
|
|
||||||
JS.hide(to: "#actions-#{track_id}")
|
|
||||||
|> JS.remove_class("pointer-events-none", to: "#scrobble-activity > li")
|
|
||||||
end
|
|
||||||
|
|
||||||
defp resolve_timezone! do
|
defp resolve_timezone! do
|
||||||
Application.get_env(:music_library, MusicLibraryWeb)
|
Application.get_env(:music_library, MusicLibraryWeb)
|
||||||
|> Keyword.fetch!(:timezone)
|
|> Keyword.fetch!(:timezone)
|
||||||
|
|||||||
@@ -220,7 +220,7 @@
|
|||||||
</.link>
|
</.link>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div
|
<.actions_menu
|
||||||
:if={
|
:if={
|
||||||
album.metadata.musicbrainz_id !== "" and
|
album.metadata.musicbrainz_id !== "" and
|
||||||
!tracked_record?(
|
!tracked_record?(
|
||||||
@@ -228,38 +228,14 @@
|
|||||||
album.metadata.musicbrainz_id
|
album.metadata.musicbrainz_id
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
class="relative flex-none"
|
id={album.scrobbled_at_uts}
|
||||||
|
background_container_target="#records > li"
|
||||||
>
|
>
|
||||||
<button
|
<:button>
|
||||||
type="button"
|
|
||||||
class="text-zinc-500 hover:text-zinc-900 dark:text-zinc-400 dark:hover:text-zinc-300"
|
|
||||||
aria-expanded="false"
|
|
||||||
aria-haspopup="true"
|
|
||||||
phx-click={toggle_actions_menu(album.scrobbled_at_uts)}
|
|
||||||
phx-click-away={close_actions_menu(album.scrobbled_at_uts)}
|
|
||||||
>
|
|
||||||
<span class="sr-only">{gettext("Choose which format to import")}</span>
|
<span class="sr-only">{gettext("Choose which format to import")}</span>
|
||||||
<.icon name="hero-star" class="-mt-1 h-5 w-5" aria-hidden="true" data-slot="icon" />
|
<.icon name="hero-star" class="-mt-1 h-5 w-5" aria-hidden="true" data-slot="icon" />
|
||||||
</button>
|
</:button>
|
||||||
<!--
|
<:links>
|
||||||
Dropdown menu, show/hide based on menu state.
|
|
||||||
|
|
||||||
Entering: "transition ease-out duration-100"
|
|
||||||
From: "transform opacity-0 scale-95"
|
|
||||||
To: "transform opacity-100 scale-100"
|
|
||||||
Leaving: "transition ease-in duration-75"
|
|
||||||
From: "transform opacity-100 scale-100"
|
|
||||||
To: "transform opacity-0 scale-95"
|
|
||||||
-->
|
|
||||||
<.focus_wrap
|
|
||||||
id={"actions-#{album.scrobbled_at_uts}"}
|
|
||||||
class={[
|
|
||||||
"hidden pointer-events-auto absolute right-0 z-10 mt-2 w-48 origin-top-right rounded-md bg-white dark:bg-zinc-800 py-2 shadow-lg ring-1 ring-zinc-900/5 focus:outline-hidden"
|
|
||||||
]}
|
|
||||||
role="menu"
|
|
||||||
aria-orientation="vertical"
|
|
||||||
aria-labelledby="options-menu-0-button"
|
|
||||||
>
|
|
||||||
<.link
|
<.link
|
||||||
:for={format <- Records.Record.formats()}
|
:for={format <- Records.Record.formats()}
|
||||||
class="block px-3 py-1 text-sm leading-6 text-zinc-900 dark:text-zinc-400 hover:bg-zinc-50 dark:hover:text-zinc-300 dark:hover:bg-zinc-700"
|
class="block px-3 py-1 text-sm leading-6 text-zinc-900 dark:text-zinc-400 hover:bg-zinc-50 dark:hover:text-zinc-300 dark:hover:bg-zinc-700"
|
||||||
@@ -275,8 +251,8 @@
|
|||||||
>
|
>
|
||||||
{format_label(format)}
|
{format_label(format)}
|
||||||
</.link>
|
</.link>
|
||||||
</.focus_wrap>
|
</:links>
|
||||||
</div>
|
</.actions_menu>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</li>
|
</li>
|
||||||
@@ -345,7 +321,7 @@
|
|||||||
</.link>
|
</.link>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div
|
<.actions_menu
|
||||||
:if={
|
:if={
|
||||||
track.album.musicbrainz_id !== "" and
|
track.album.musicbrainz_id !== "" and
|
||||||
!tracked_record?(
|
!tracked_record?(
|
||||||
@@ -353,38 +329,14 @@
|
|||||||
track.album.musicbrainz_id
|
track.album.musicbrainz_id
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
class="relative flex-none"
|
id={track.scrobbled_at_uts}
|
||||||
|
background_container_target="#records > li"
|
||||||
>
|
>
|
||||||
<button
|
<:button>
|
||||||
type="button"
|
|
||||||
class="text-zinc-500 hover:text-zinc-900 dark:text-zinc-400 dark:hover:text-zinc-300"
|
|
||||||
aria-expanded="false"
|
|
||||||
aria-haspopup="true"
|
|
||||||
phx-click={toggle_actions_menu(track.scrobbled_at_uts)}
|
|
||||||
phx-click-away={close_actions_menu(track.scrobbled_at_uts)}
|
|
||||||
>
|
|
||||||
<span class="sr-only">{gettext("Choose which format to import")}</span>
|
<span class="sr-only">{gettext("Choose which format to import")}</span>
|
||||||
<.icon name="hero-star" class="-mt-1 h-5 w-5" aria-hidden="true" data-slot="icon" />
|
<.icon name="hero-star" class="-mt-1 h-5 w-5" aria-hidden="true" data-slot="icon" />
|
||||||
</button>
|
</:button>
|
||||||
<!--
|
<:links>
|
||||||
Dropdown menu, show/hide based on menu state.
|
|
||||||
|
|
||||||
Entering: "transition ease-out duration-100"
|
|
||||||
From: "transform opacity-0 scale-95"
|
|
||||||
To: "transform opacity-100 scale-100"
|
|
||||||
Leaving: "transition ease-in duration-75"
|
|
||||||
From: "transform opacity-100 scale-100"
|
|
||||||
To: "transform opacity-0 scale-95"
|
|
||||||
-->
|
|
||||||
<.focus_wrap
|
|
||||||
id={"actions-#{track.scrobbled_at_uts}"}
|
|
||||||
class={[
|
|
||||||
"hidden pointer-events-auto absolute right-0 z-10 mt-2 w-48 origin-top-right rounded-md bg-white dark:bg-zinc-800 py-2 shadow-lg ring-1 ring-zinc-900/5 focus:outline-hidden"
|
|
||||||
]}
|
|
||||||
role="menu"
|
|
||||||
aria-orientation="vertical"
|
|
||||||
aria-labelledby="options-menu-0-button"
|
|
||||||
>
|
|
||||||
<.link
|
<.link
|
||||||
:for={format <- Records.Record.formats()}
|
:for={format <- Records.Record.formats()}
|
||||||
class="block px-3 py-1 text-sm leading-6 text-zinc-900 dark:text-zinc-400 hover:bg-zinc-50 dark:hover:text-zinc-300 dark:hover:bg-zinc-700"
|
class="block px-3 py-1 text-sm leading-6 text-zinc-900 dark:text-zinc-400 hover:bg-zinc-50 dark:hover:text-zinc-300 dark:hover:bg-zinc-700"
|
||||||
@@ -400,8 +352,8 @@
|
|||||||
>
|
>
|
||||||
{format_label(format)}
|
{format_label(format)}
|
||||||
</.link>
|
</.link>
|
||||||
</.focus_wrap>
|
</:links>
|
||||||
</div>
|
</.actions_menu>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</li>
|
</li>
|
||||||
|
|||||||
@@ -3,8 +3,6 @@ defmodule MusicLibraryWeb.WishlistLive.Show do
|
|||||||
|
|
||||||
import MusicLibraryWeb.RecordComponents,
|
import MusicLibraryWeb.RecordComponents,
|
||||||
only: [
|
only: [
|
||||||
toggle_actions_menu: 1,
|
|
||||||
close_actions_menu: 1,
|
|
||||||
format_label: 1,
|
format_label: 1,
|
||||||
type_label: 1,
|
type_label: 1,
|
||||||
release_summary: 1
|
release_summary: 1
|
||||||
|
|||||||
@@ -30,32 +30,8 @@
|
|||||||
· {format_label(@record.format)} · {type_label(@record.type)}
|
· {format_label(@record.format)} · {type_label(@record.type)}
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
<div class="relative flex-none">
|
<.actions_menu id={@record.id} background_container_target="#records > li">
|
||||||
<button
|
<:links>
|
||||||
type="button"
|
|
||||||
class="text-zinc-500 hover:text-zinc-900 dark:text-zinc-400 dark:hover:text-zinc-300"
|
|
||||||
aria-expanded="false"
|
|
||||||
aria-haspopup="true"
|
|
||||||
phx-click={toggle_actions_menu(@record.id)}
|
|
||||||
>
|
|
||||||
<span class="sr-only">{gettext("Open options")}</span>
|
|
||||||
<.icon
|
|
||||||
name="hero-ellipsis-vertical"
|
|
||||||
class="-mt-1 h-5 w-5"
|
|
||||||
aria-hidden="true"
|
|
||||||
data-slot="icon"
|
|
||||||
/>
|
|
||||||
</button>
|
|
||||||
<.focus_wrap
|
|
||||||
id={"actions-#{@record.id}"}
|
|
||||||
class={[
|
|
||||||
"hidden pointer-events-auto absolute right-0 z-10 mt-2 w-48 origin-top-right rounded-md bg-white dark:bg-zinc-800 py-2 shadow-lg ring-1 ring-zinc-900/5 focus:outline-hidden"
|
|
||||||
]}
|
|
||||||
role="menu"
|
|
||||||
aria-orientation="vertical"
|
|
||||||
aria-labelledby="options-menu-0-button"
|
|
||||||
phx-click-away={close_actions_menu(@record.id)}
|
|
||||||
>
|
|
||||||
<.link
|
<.link
|
||||||
class="block px-3 py-1 text-sm leading-6 text-zinc-900 dark:text-zinc-400 hover:bg-zinc-50 dark:hover:text-zinc-300 dark:hover:bg-zinc-700"
|
class="block px-3 py-1 text-sm leading-6 text-zinc-900 dark:text-zinc-400 hover:bg-zinc-50 dark:hover:text-zinc-300 dark:hover:bg-zinc-700"
|
||||||
role="menuitem"
|
role="menuitem"
|
||||||
@@ -156,8 +132,8 @@
|
|||||||
/>
|
/>
|
||||||
{gettext("Delete")}
|
{gettext("Delete")}
|
||||||
</.link>
|
</.link>
|
||||||
</.focus_wrap>
|
</:links>
|
||||||
</div>
|
</.actions_menu>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="mt-4">
|
<div class="mt-4">
|
||||||
|
|||||||
@@ -123,10 +123,7 @@ msgstr ""
|
|||||||
msgid "No results"
|
msgid "No results"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: lib/music_library_web/components/record_components.ex
|
#: lib/music_library_web/components/core_components.ex
|
||||||
#: lib/music_library_web/live/artist_live/show.html.heex
|
|
||||||
#: lib/music_library_web/live/collection_live/show.html.heex
|
|
||||||
#: lib/music_library_web/live/wishlist_live/show.html.heex
|
|
||||||
#, elixir-autogen, elixir-format
|
#, elixir-autogen, elixir-format
|
||||||
msgid "Open options"
|
msgid "Open options"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
@@ -283,7 +280,6 @@ msgstr ""
|
|||||||
msgid "Scrobble activity"
|
msgid "Scrobble activity"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: lib/music_library_web/components/add_record_component.ex
|
|
||||||
#: lib/music_library_web/live/stats_live/index.html.heex
|
#: lib/music_library_web/live/stats_live/index.html.heex
|
||||||
#, elixir-autogen, elixir-format
|
#, elixir-autogen, elixir-format
|
||||||
msgid "Choose which format to import"
|
msgid "Choose which format to import"
|
||||||
|
|||||||
@@ -123,10 +123,7 @@ msgstr ""
|
|||||||
msgid "No results"
|
msgid "No results"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: lib/music_library_web/components/record_components.ex
|
#: lib/music_library_web/components/core_components.ex
|
||||||
#: lib/music_library_web/live/artist_live/show.html.heex
|
|
||||||
#: lib/music_library_web/live/collection_live/show.html.heex
|
|
||||||
#: lib/music_library_web/live/wishlist_live/show.html.heex
|
|
||||||
#, elixir-autogen, elixir-format
|
#, elixir-autogen, elixir-format
|
||||||
msgid "Open options"
|
msgid "Open options"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
@@ -283,7 +280,6 @@ msgstr ""
|
|||||||
msgid "Scrobble activity"
|
msgid "Scrobble activity"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: lib/music_library_web/components/add_record_component.ex
|
|
||||||
#: lib/music_library_web/live/stats_live/index.html.heex
|
#: lib/music_library_web/live/stats_live/index.html.heex
|
||||||
#, elixir-autogen, elixir-format
|
#, elixir-autogen, elixir-format
|
||||||
msgid "Choose which format to import"
|
msgid "Choose which format to import"
|
||||||
|
|||||||
Reference in New Issue
Block a user