1module UI.Queue.ContextMenu exposing (futureMenu, futureNavigationMenu, historyMenu)
2
3import ContextMenu exposing (..)
4import Coordinates exposing (Coordinates)
5import Material.Icons.Round as Icons
6import Queue
7import UI.Queue.Types as Queue
8import UI.Tracks.ContextMenu
9import UI.Types exposing (Msg(..))
10
11
12
13-- 🔱
14
15
16futureMenu :
17 { cached : List String, cachingInProgress : List String, itemIndex : Int }
18 -> Queue.Item
19 -> Coordinates
20 -> ContextMenu Msg
21futureMenu { cached, cachingInProgress, itemIndex } item =
22 let
23 tracks =
24 [ item.identifiedTrack ]
25 in
26 ContextMenu
27 [ Item
28 { icon = Icons.update
29 , label = "Move to the top"
30 , msg =
31 { index = itemIndex }
32 |> Queue.MoveItemToFirst
33 |> QueueMsg
34
35 --
36 , active = False
37 }
38 , Item
39 { icon = Icons.update
40 , label = "Move to the end of my picks"
41 , msg =
42 { index = itemIndex }
43 |> Queue.MoveItemToLast
44 |> QueueMsg
45
46 --
47 , active = False
48 }
49 , Item
50 { icon = Icons.waves
51 , label = "Add to collection"
52 , msg = AssistWithAddingTracksToCollection tracks
53 , active = False
54 }
55 , Item
56 { icon = Icons.waves
57 , label = "Add to playlist"
58 , msg = AssistWithAddingTracksToPlaylist tracks
59 , active = False
60 }
61 , UI.Tracks.ContextMenu.cacheAction
62 { cached = cached, cachingInProgress = cachingInProgress }
63 tracks
64 ]
65
66
67futureNavigationMenu : { manualEntries : List Queue.Item } -> Coordinates -> ContextMenu Msg
68futureNavigationMenu { manualEntries } =
69 [ [ Item
70 { icon = Icons.not_interested
71 , label = "Reset ignored"
72 , msg = QueueMsg Queue.ResetIgnored
73
74 --
75 , active = False
76 }
77 ]
78 , --
79 if List.isEmpty manualEntries then
80 []
81
82 else
83 [ Item
84 { icon = Icons.waves
85 , label = "Add queue picks to collection"
86 , msg =
87 manualEntries
88 |> List.map .identifiedTrack
89 |> AssistWithAddingTracksToCollection
90 , active = False
91 }
92 , Item
93 { icon = Icons.waves
94 , label = "Add queue picks to playlist"
95 , msg =
96 manualEntries
97 |> List.map .identifiedTrack
98 |> AssistWithAddingTracksToPlaylist
99 , active = False
100 }
101 ]
102 ]
103 |> List.concat
104 |> ContextMenu
105
106
107historyMenu :
108 { cached : List String, cachingInProgress : List String }
109 -> Queue.Item
110 -> Coordinates
111 -> ContextMenu Msg
112historyMenu { cached, cachingInProgress } item =
113 let
114 tracks =
115 [ item.identifiedTrack ]
116 in
117 ContextMenu
118 [ Item
119 { icon = Icons.update
120 , label = "Play next"
121 , msg =
122 { inFront = True, tracks = tracks }
123 |> Queue.AddTracks
124 |> QueueMsg
125
126 --
127 , active = False
128 }
129 , Item
130 { icon = Icons.update
131 , label = "Add to queue"
132 , msg =
133 { inFront = False, tracks = tracks }
134 |> Queue.AddTracks
135 |> QueueMsg
136
137 --
138 , active = False
139 }
140 , Item
141 { icon = Icons.waves
142 , label = "Add to collection"
143 , msg = AssistWithAddingTracksToCollection tracks
144 , active = False
145 }
146 , Item
147 { icon = Icons.waves
148 , label = "Add to playlist"
149 , msg = AssistWithAddingTracksToPlaylist tracks
150 , active = False
151 }
152 , UI.Tracks.ContextMenu.cacheAction
153 { cached = cached, cachingInProgress = cachingInProgress }
154 tracks
155 ]