1module UI.Sources.ContextMenu exposing (sourceMenu)
2
3import Conditional exposing (ifThenElse)
4import ContextMenu exposing (..)
5import Coordinates exposing (Coordinates)
6import Material.Icons.Round as Icons
7import Sources exposing (Source)
8import UI.Page
9import UI.Sources.Page
10import UI.Sources.Types as Sources
11import UI.Types exposing (Msg(..))
12
13
14
15-- 🔱
16
17
18sourceMenu : Source -> Coordinates -> ContextMenu Msg
19sourceMenu source =
20 ContextMenu
21 [ Item
22 { icon = ifThenElse source.directoryPlaylists Icons.folder Icons.folder_open
23 , label = ifThenElse source.directoryPlaylists "Disable Directory Playlists" "Enable Directory Playlists"
24 , msg =
25 { sourceId = source.id }
26 |> Sources.ToggleDirectoryPlaylists
27 |> SourcesMsg
28
29 --
30 , active = False
31 }
32
33 --
34 , Item
35 { icon = Icons.edit
36 , label = "Edit source"
37 , msg =
38 source.id
39 |> UI.Sources.Page.Edit
40 |> UI.Page.Sources
41 |> ChangeUrlUsingPage
42
43 --
44 , active = False
45 }
46
47 --
48 , Item
49 { icon = Icons.sync
50 , label = "Process source"
51 , msg =
52 [ source ]
53 |> Sources.ProcessSpecific
54 |> SourcesMsg
55
56 --
57 , active = False
58 }
59
60 --
61 , Item
62 { icon = Icons.delete
63 , label = "Remove source"
64 , msg =
65 { sourceId = source.id }
66 |> Sources.RemoveFromCollection
67 |> SourcesMsg
68 , active = False
69 }
70
71 --
72 , Item
73 { icon = Icons.font_download
74 , label = "Rename source"
75 , msg =
76 source.id
77 |> UI.Sources.Page.Rename
78 |> UI.Page.Sources
79 |> ChangeUrlUsingPage
80
81 --
82 , active = False
83 }
84 ]