A music player that connects to your cloud/distributed storage.
at main 113 lines 2.3 kB view raw
1module UI.Theme exposing (..) 2 3import Chunky exposing (..) 4import Dict exposing (Dict) 5import Html exposing (Html) 6import Theme exposing (Theme) 7import Themes.Sunrise.Theme as Sunrise 8import Themes.Sunrise.Tracks.Scene.Covers 9import Themes.Sunrise.Tracks.Scene.List 10import Tracks exposing (IdentifiedTrack, Scene) 11import UI.Svg.Elements 12import UI.Types exposing (Model, Msg) 13 14 15 16-- 🔮 17 18 19list : List (Theme Msg Model) 20list = 21 [ Sunrise.theme 22 ] 23 24 25default : Theme Msg Model 26default = 27 Sunrise.theme 28 29 30 31-- 🚧 32 33 34dict : Dict String (Theme Msg Model) 35dict = 36 list 37 |> List.map 38 (\theme -> 39 ( theme.id, theme ) 40 ) 41 |> Dict.fromList 42 43 44view : Model -> Html Msg 45view model = 46 if model.isLoading then 47 loadingAnimation 48 49 else 50 case model.theme of 51 Just { id } -> 52 case Dict.get id dict of 53 Just theme -> 54 theme.view model 55 56 Nothing -> 57 default.view model 58 59 Nothing -> 60 default.view model 61 62 63loadingAnimation = 64 chunk 65 [ "flex" 66 , "flex-col" 67 , "items-center" 68 , "justify-center" 69 , "screen-height" 70 , "w-screen" 71 ] 72 [ loadingAnimationSvg 73 , chunk 74 [ "italic" 75 , "mt-5" 76 , "text-white" 77 , "text-opacity-30" 78 ] 79 [ Html.text "Transmitting particles" ] 80 ] 81 82 83loadingAnimationSvg = 84 Html.map never UI.Svg.Elements.loading 85 86 87 88-- TODO 89 90 91scrollTracksToTop : Scene -> Cmd Msg 92scrollTracksToTop scene = 93 case scene of 94 Tracks.Covers -> 95 Themes.Sunrise.Tracks.Scene.List.scrollToTop 96 97 Tracks.List -> 98 Themes.Sunrise.Tracks.Scene.Covers.scrollToTop 99 100 101scrollToNowPlaying : Scene -> IdentifiedTrack -> Model -> Cmd Msg 102scrollToNowPlaying scene ( identifiers, track ) model = 103 case scene of 104 Tracks.Covers -> 105 Themes.Sunrise.Tracks.Scene.Covers.scrollToNowPlaying 106 model.viewport.width 107 model.covers.harvested 108 ( identifiers, track ) 109 110 Tracks.List -> 111 Themes.Sunrise.Tracks.Scene.List.scrollToNowPlaying 112 model.tracks.harvested 113 ( identifiers, track )