diff --git a/src/Applications/UI/Navigation.elm b/src/Applications/UI/Navigation.elm index 80471fc3..e9469237 100644 --- a/src/Applications/UI/Navigation.elm +++ b/src/Applications/UI/Navigation.elm @@ -7,6 +7,7 @@ import Conditional exposing (..) import Html exposing (Html, text) import Html.Attributes exposing (href, style, tabindex, target, title) import Html.Events exposing (onClick) +import Html.Events.Extra.Mouse as Mouse import Material.Icons.Types exposing (Coloring(..)) import Maybe.Extra as Maybe import Svg exposing (Svg) @@ -21,6 +22,7 @@ type Action msg = NavigateToPage Page | OpenLinkInNewPage String | PerformMsg msg + | PerformMsgWithMouseEvent (Mouse.Event -> msg) type Icon msg @@ -141,6 +143,9 @@ localItem tabindex_ { amount } ( Icon icon, Label labelText labelType, action ) PerformMsg _ -> Html.button + + PerformMsgWithMouseEvent _ -> + Html.button ) [ case action of NavigateToPage page -> @@ -152,6 +157,9 @@ localItem tabindex_ { amount } ( Icon icon, Label labelText labelType, action ) PerformMsg msg -> onClick msg + PerformMsgWithMouseEvent msg -> + Mouse.onClick msg + -- , case labelType of Hidden -> diff --git a/src/Applications/UI/Queue/ContextMenu.elm b/src/Applications/UI/Queue/ContextMenu.elm index 67081302..91f3c3d1 100644 --- a/src/Applications/UI/Queue/ContextMenu.elm +++ b/src/Applications/UI/Queue/ContextMenu.elm @@ -1,4 +1,4 @@ -module UI.Queue.ContextMenu exposing (futureMenu, historyMenu) +module UI.Queue.ContextMenu exposing (futureMenu, futureNavigationMenu, historyMenu) import ContextMenu exposing (..) import Coordinates exposing (Coordinates) @@ -58,6 +58,37 @@ futureMenu { cached, cachingInProgress, itemIndex } item = ] +futureNavigationMenu : { manualEntries : List Queue.Item } -> Coordinates -> ContextMenu Msg +futureNavigationMenu { manualEntries } = + [ [ Item + { icon = Icons.not_interested + , label = "Reset ignored" + , msg = QueueMsg Queue.Reset + + -- + , active = False + } + ] + , -- + if List.isEmpty manualEntries then + [] + + else + [ Item + { icon = Icons.waves + , label = "Add queue picks to playlist" + , msg = + manualEntries + |> List.map .identifiedTrack + |> AssistWithAddingTracksToPlaylist + , active = False + } + ] + ] + |> List.concat + |> ContextMenu + + historyMenu : { cached : List String, cachingInProgress : List String } -> Queue.Item diff --git a/src/Applications/UI/Queue/State.elm b/src/Applications/UI/Queue/State.elm index df676c65..a2e46904 100644 --- a/src/Applications/UI/Queue/State.elm +++ b/src/Applications/UI/Queue/State.elm @@ -42,6 +42,9 @@ update msg = ShowFutureMenu a b c -> showFutureMenu a b c + ShowFutureNavigationMenu a -> + showFutureNavigationMenu a + ShowHistoryMenu a b -> showHistoryMenu a b @@ -244,6 +247,16 @@ showFutureMenu item { index } mouseEvent model = |> Return.singleton +showFutureNavigationMenu : Mouse.Event -> Manager +showFutureNavigationMenu mouseEvent model = + mouseEvent.clientPos + |> Coordinates.fromTuple + |> Queue.futureNavigationMenu { manualEntries = List.filter .manualEntry model.playingNext } + |> Just + |> (\c -> { model | contextMenu = c }) + |> Return.singleton + + showHistoryMenu : Item -> Mouse.Event -> Manager showHistoryMenu item mouseEvent model = mouseEvent.clientPos diff --git a/src/Applications/UI/Queue/Types.elm b/src/Applications/UI/Queue/Types.elm index 53ce7098..dcacd4d0 100644 --- a/src/Applications/UI/Queue/Types.elm +++ b/src/Applications/UI/Queue/Types.elm @@ -16,6 +16,7 @@ type Msg | Select Item | Shift | ShowFutureMenu Item { index : Int } Mouse.Event + | ShowFutureNavigationMenu Mouse.Event | ShowHistoryMenu Item Mouse.Event | ToggleRepeat | ToggleShuffle diff --git a/src/Applications/UI/Queue/View.elm b/src/Applications/UI/Queue/View.elm index 0d5edfc3..3e58e49e 100644 --- a/src/Applications/UI/Queue/View.elm +++ b/src/Applications/UI/Queue/View.elm @@ -66,9 +66,9 @@ futureView playingNext selectedQueueItem dnd = , Label "Clear" Shown , PerformMsg (QueueMsg Clear) ) - , ( Icon Icons.not_interested - , Label "Reset ignored" Shown - , PerformMsg (QueueMsg Reset) + , ( Icon Icons.more_horiz + , Label "Menu" Hidden + , PerformMsgWithMouseEvent (QueueMsg << ShowFutureNavigationMenu) ) ]