A music player that connects to your cloud/distributed storage.
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

Move backdrop state

+77 -90
+21 -15
src/Applications/UI.elm
··· 44 44 import UI.Ports as Ports 45 45 import UI.Queue as Queue 46 46 import UI.Queue.ContextMenu as Queue 47 - import UI.Reply as Reply exposing (Reply(..)) 48 47 import UI.Reply.Translate as Reply 49 48 import UI.Routing.State as Routing 50 49 import UI.Services.State as Services ··· 121 120 , audioPosition = 0 122 121 , progress = Dict.empty 123 122 , rememberProgress = True 123 + 124 + ----------------------------------------- 125 + -- Backdrop 126 + ----------------------------------------- 127 + , chosenBackdrop = Nothing 128 + , extractedBackdropColor = Nothing 129 + , fadeInBackdrop = True 130 + , loadedBackdrops = [] 124 131 125 132 ----------------------------------------- 126 133 -- Debouncing ··· 142 149 -- Children (TODO) 143 150 ----------------------------------------- 144 151 , authentication = Authentication.initialModel url 145 - , backdrop = Backdrop.initialModel 146 152 , equalizer = Equalizer.initialModel 147 153 , playlists = Playlists.initialModel 148 154 , queue = Queue.initialModel ··· 228 234 Authentication.remoteStorageWebfinger a b 229 235 230 236 ----------------------------------------- 237 + -- Backdrop 238 + ----------------------------------------- 239 + ExtractedBackdropColor a -> 240 + Backdrop.extractedBackdropColor a 241 + 242 + ChooseBackdrop a -> 243 + Backdrop.chooseBackdrop a 244 + 245 + LoadBackdrop a -> 246 + Backdrop.loadBackdrop a 247 + 248 + ----------------------------------------- 231 249 -- Equalizer 232 250 ----------------------------------------- 233 251 ActivateKnob a b -> ··· 371 389 , msg = sub 372 390 } 373 391 374 - BackdropMsg sub -> 375 - \model -> 376 - Return3.wieldNested 377 - Reply.translate 378 - { mapCmd = BackdropMsg 379 - , mapModel = \child -> { model | backdrop = child } 380 - , update = Backdrop.update 381 - } 382 - { model = model.backdrop 383 - , msg = sub 384 - } 385 - 386 392 PlaylistsMsg sub -> 387 393 \model -> 388 394 Return3.wieldNested ··· 456 462 ----------------------------------------- 457 463 -- Backdrop 458 464 ----------------------------------------- 459 - , Ports.setAverageBackgroundColor (Backdrop.BackgroundColor >> BackdropMsg) 465 + , Ports.setAverageBackgroundColor ExtractedBackdropColor 460 466 461 467 ----------------------------------------- 462 468 -- Interface
+25 -45
src/Applications/UI/Backdrop.elm
··· 1 - module UI.Backdrop exposing (Model, Msg(..), backgroundPositioning, default, initialModel, options, update, view) 1 + module UI.Backdrop exposing (..) 2 2 3 3 import Chunky exposing (..) 4 4 import Color exposing (Color) ··· 8 8 import Html.Events exposing (on) 9 9 import Html.Lazy as Lazy 10 10 import Json.Decode 11 - import Return3 exposing (..) 11 + import Return exposing (andThen, return) 12 + import Return.Ext as Return 12 13 import UI.Ports as Ports 13 - import UI.Reply as Reply exposing (Reply) 14 + import UI.Reply as Reply exposing (Reply(..)) 15 + import UI.Types exposing (..) 14 16 15 17 16 18 ··· 49 51 50 52 51 53 52 - -- 🌳 53 - 54 - 55 - type alias Model = 56 - { bgColor : Maybe Color 57 - , chosen : Maybe String 58 - , fadeIn : Bool 59 - , loaded : List String 60 - } 61 - 62 - 63 - initialModel : Model 64 - initialModel = 65 - { bgColor = Nothing 66 - , chosen = Nothing 67 - , fadeIn = True 68 - , loaded = [] 69 - } 70 - 71 - 72 - 73 54 -- 📣 74 55 75 56 76 - type Msg 77 - = BackgroundColor { r : Int, g : Int, b : Int } 78 - | Choose String 79 - | Default 80 - | Load String 57 + extractedBackdropColor : { r : Int, g : Int, b : Int } -> Manager 58 + extractedBackdropColor { r, g, b } model = 59 + Return.singleton { model | extractedBackdropColor = Just (Color.rgb255 r g b) } 81 60 82 61 83 - update : Msg -> Model -> Return Model Msg Reply 84 - update msg model = 85 - case msg of 86 - BackgroundColor { r, g, b } -> 87 - return { model | bgColor = Just (Color.rgb255 r g b) } 62 + chooseBackdrop : String -> Manager 63 + chooseBackdrop backdrop model = 64 + Return.performance 65 + (Reply SaveSettings) 66 + { model | chosenBackdrop = Just backdrop } 67 + 88 68 89 - Choose backdrop -> 90 - return { model | chosen = Just backdrop } |> addReply Reply.SaveSettings 69 + loadBackdrop : String -> Manager 70 + loadBackdrop backdrop model = 71 + return 72 + { model | loadedBackdrops = model.loadedBackdrops ++ [ backdrop ] } 73 + (Ports.pickAverageBackgroundColor backdrop) 91 74 92 - Default -> 93 - return { model | chosen = Just default } 94 75 95 - Load backdrop -> 96 - returnCommandWithModel 97 - { model | loaded = model.loaded ++ [ backdrop ] } 98 - (Ports.pickAverageBackgroundColor backdrop) 76 + setDefault : Manager 77 + setDefault model = 78 + Return.singleton { model | chosenBackdrop = Just default } 99 79 100 80 101 81 ··· 109 89 , C.minus_inset_px 110 90 , C.z_0 111 91 ] 112 - [ Lazy.lazy chosen model.chosen 113 - , Lazy.lazy2 loaded model.loaded model.fadeIn 92 + [ Lazy.lazy chosen model.chosenBackdrop 93 + , Lazy.lazy2 loaded model.loadedBackdrops model.fadeInBackdrop 114 94 115 95 -- Shadow 116 96 --------- ··· 175 155 let 176 156 loadingDecoder = 177 157 c 178 - |> Load 158 + |> LoadBackdrop 179 159 |> Json.Decode.succeed 180 160 in 181 161 slab
+6 -9
src/Applications/UI/Reply/Translate.elm
··· 213 213 , searchResults = Nothing 214 214 } 215 215 } 216 - |> Return.performance (BackdropMsg Backdrop.Default) 216 + |> Backdrop.setDefault 217 217 |> Return.command (Ports.toBrain <| Alien.trigger Alien.SignOut) 218 218 |> Return.command (Ports.toBrain <| Alien.trigger Alien.StopProcessing) 219 219 |> Return.command (Ports.activeQueueItemChanged Nothing) ··· 738 738 ----------------------------------------- 739 739 -- User Data 740 740 ----------------------------------------- 741 - ChooseBackdrop filename -> 741 + Reply.ChooseBackdrop filename -> 742 742 filename 743 - |> Backdrop.Choose 744 - |> BackdropMsg 743 + |> UI.ChooseBackdrop 745 744 |> Return.performanceF model 746 745 747 746 Export -> ··· 765 764 |> saveAllHypaethralData 766 765 767 766 LoadDefaultBackdrop -> 768 - Backdrop.Default 769 - |> BackdropMsg 770 - |> Return.performanceF model 767 + Backdrop.setDefault model 771 768 772 769 RequestImport -> 773 770 ImportFile ··· 871 868 872 869 873 870 gatherSettings : Model -> Settings.Settings 874 - gatherSettings { backdrop, lastFm, processAutomatically, rememberProgress, tracks } = 875 - { backgroundImage = backdrop.chosen 871 + gatherSettings { chosenBackdrop, lastFm, processAutomatically, rememberProgress, tracks } = 872 + { backgroundImage = chosenBackdrop 876 873 , hideDuplicates = tracks.hideDuplicates 877 874 , lastFm = lastFm.sessionKey 878 875 , processAutomatically = processAutomatically
+17 -10
src/Applications/UI/Types.elm
··· 4 4 import Browser 5 5 import Browser.Navigation as Nav 6 6 import Chunky exposing (..) 7 + import Color exposing (Color) 7 8 import Common exposing (Switch) 8 9 import Conditional exposing (..) 9 10 import ContextMenu exposing (ContextMenu) ··· 40 41 import Tracks.Encoding as Tracks 41 42 import UI.Authentication as Authentication 42 43 import UI.Authentication.ContextMenu as Authentication 43 - import UI.Backdrop as Backdrop 44 44 import UI.Demo as Demo 45 45 import UI.DnD as DnD 46 46 import UI.Equalizer.Types as Equalizer ··· 53 53 import UI.Queue as Queue 54 54 import UI.Queue.ContextMenu as Queue 55 55 import UI.Reply as Reply exposing (Reply(..)) 56 - import UI.Settings as Settings 57 56 import UI.Sources as Sources 58 57 import UI.Sources.ContextMenu as Sources 59 58 import UI.Tracks as Tracks ··· 108 107 , audioIsLoading : Bool 109 108 , audioIsPlaying : Bool 110 109 , audioPosition : Float 110 + , progress : Dict String Float 111 + , rememberProgress : Bool 112 + 113 + ----------------------------------------- 114 + -- Backdrop 115 + ----------------------------------------- 116 + , chosenBackdrop : Maybe String 117 + , extractedBackdropColor : Maybe Color 118 + , fadeInBackdrop : Bool 119 + , loadedBackdrops : List String 111 120 112 121 ----------------------------------------- 113 122 -- Debouncing ··· 122 131 , notifications : UI.Notifications.Model 123 132 124 133 ----------------------------------------- 125 - -- Progress 126 - ----------------------------------------- 127 - , progress : Dict String Float 128 - , rememberProgress : Bool 129 - 130 - ----------------------------------------- 131 134 -- Children (TODO) 132 135 ----------------------------------------- 133 136 , authentication : Authentication.Model 134 - , backdrop : Backdrop.Model 135 137 , equalizer : Equalizer.Model 136 138 , queue : Queue.Model 137 139 , playlists : Playlists.Model ··· 171 173 | MissingSecretKey Json.Decode.Value 172 174 | NotAuthenticated 173 175 | RemoteStorageWebfinger RemoteStorage.Attributes (Result Http.Error String) 176 + ----------------------------------------- 177 + -- Backdrop 178 + ----------------------------------------- 179 + | ExtractedBackdropColor { r : Int, g : Int, b : Int } 180 + | ChooseBackdrop String 181 + | LoadBackdrop String 174 182 ----------------------------------------- 175 183 -- Equalizer 176 184 ----------------------------------------- ··· 236 244 -- Children (TODO) 237 245 ----------------------------------------- 238 246 | AuthenticationMsg Authentication.Msg 239 - | BackdropMsg Backdrop.Msg 240 247 | PlaylistsMsg Playlists.Msg 241 248 | QueueMsg Queue.Msg 242 249 | SourcesMsg Sources.Msg
+4 -5
src/Applications/UI/User/State/Import.elm
··· 128 128 case decodeHypaethralData value of 129 129 Ok data -> 130 130 let 131 - { backdrop, sources } = 131 + { sources } = 132 132 model 133 133 134 - backdropModel = 134 + chosenBackdrop = 135 135 data.settings 136 136 |> Maybe.andThen .backgroundImage 137 137 |> Maybe.withDefault Backdrop.default 138 138 |> Just 139 - |> (\c -> { backdrop | chosen = c }) 140 139 141 140 sourcesModel = 142 141 { sources | collection = data.sources } ··· 156 155 model.lastFm 157 156 in 158 157 ( { model 159 - | backdrop = backdropModel 160 - , playlists = playlistsModel 158 + | playlists = playlistsModel 161 159 , sources = sourcesModel 162 160 , tracks = tracksModel 163 161 164 162 -- 163 + , chosenBackdrop = chosenBackdrop 165 164 , lastFm = { lastFmModel | sessionKey = Maybe.andThen .lastFm data.settings } 166 165 , processAutomatically = Maybe.unwrap True .processAutomatically data.settings 167 166 , progress = data.progress
+4 -6
src/Applications/UI/View.elm
··· 98 98 ----------------------------------------- 99 99 -- Backdrop 100 100 ----------------------------------------- 101 - , model.backdrop 102 - |> Lazy.lazy Backdrop.view 103 - |> Html.map BackdropMsg 101 + , Lazy.lazy Backdrop.view model 104 102 105 103 ----------------------------------------- 106 104 -- Context Menu ··· 164 162 ----------------------------------------- 165 163 , vessel 166 164 [ { amountOfSources = List.length model.sources.collection 167 - , bgColor = model.backdrop.bgColor 165 + , bgColor = model.extractedBackdropColor 168 166 , darkMode = model.darkMode 169 167 , isOnIndexPage = model.page == Page.Index 170 168 , isTouchDevice = model.isTouchDevice ··· 184 182 nothing 185 183 186 184 Page.Playlists subPage -> 187 - model.backdrop.bgColor 185 + model.extractedBackdropColor 188 186 |> Lazy.lazy4 189 187 Playlists.view 190 188 subPage ··· 199 197 200 198 Page.Settings subPage -> 201 199 { authenticationMethod = Authentication.extractMethod model.authentication 202 - , chosenBackgroundImage = model.backdrop.chosen 200 + , chosenBackgroundImage = model.chosenBackdrop 203 201 , hideDuplicateTracks = model.tracks.hideDuplicates 204 202 , lastFm = model.lastFm 205 203 , processAutomatically = model.processAutomatically