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

Configure Feed

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

Add ability to edit sources

+428 -178
+2 -1
src/App/Equalizer/View.elm
··· 10 10 import Material.Icons.Navigation as Icons 11 11 import Mouse 12 12 import Navigation.View as Navigation 13 + import Routing.Types 13 14 import Svg exposing (Svg, svg, polygon) 14 15 import Svg.Attributes exposing (height, points, viewBox, width) 15 16 import Traits exposing (gr) ··· 44 45 [ Icons.arrow_back colorDerivatives.text 16 45 46 , label [] [ text "Tracks" ] 46 47 ] 47 - , "/" 48 + , Routing.Types.Index 48 49 ) 49 50 ] 50 51
+21 -34
src/App/Navigation/View.elm
··· 4 4 import Html.Attributes exposing (href) 5 5 import Html.Events.Extra exposing (onClickPreventDefault) 6 6 import Navigation.Styles exposing (..) 7 - import Routing.Logic exposing (pageToParentHref) 7 + import Routing.Logic exposing (isSameBase, pageToHref) 8 8 import Routing.Types as Routing 9 9 import Types exposing (Model, Msg(RoutingMsg)) 10 10 import Utils exposing (cssClass) ··· 13 13 -- 🍯 14 14 15 15 16 - outside : Routing.Page -> List ( Label, String ) -> Html Msg 16 + outside : Routing.Page -> List ( Label, Routing.Page ) -> Html Msg 17 17 outside currentPage items = 18 - let 19 - currentHref = 20 - pageToParentHref currentPage 21 - in 22 - div 23 - [ cssClass OutsideNavigation ] 24 - (List.map (itemViewWithActiveLink currentHref) items) 18 + div 19 + [ cssClass OutsideNavigation ] 20 + (List.map (itemViewWithActiveLink currentPage) items) 25 21 26 22 27 - outsideOutgoing : String -> List ( Label, String ) -> Html Msg 28 - outsideOutgoing activeHref items = 23 + outsideOutgoing : Routing.Page -> List ( Label, String ) -> Html Msg 24 + outsideOutgoing currentPage items = 29 25 div 30 26 [ cssClass OutsideNavigation ] 31 - (List.map (itemViewOutgoing activeHref) items) 27 + (List.map (itemViewOutgoing <| pageToHref currentPage) items) 32 28 33 29 34 - inside : List ( Label, String ) -> Html Msg 30 + inside : List ( Label, Routing.Page ) -> Html Msg 35 31 inside items = 36 32 div 37 33 [ cssClass InsideNavigation ] ··· 57 53 -- Items 58 54 59 55 60 - itemView : ( Label, String ) -> Html Msg 61 - itemView ( itemLabel, itemHref ) = 56 + itemView : ( Label, Routing.Page ) -> Html Msg 57 + itemView ( itemLabel, itemPage ) = 62 58 a 63 - [ href itemHref 64 - , onClickPreventDefault (RoutingMsg <| Routing.GoToUrl itemHref) 59 + [ href (pageToHref itemPage) 60 + , onClickPreventDefault (RoutingMsg <| Routing.GoToPage itemPage) 65 61 ] 66 62 [ span 67 63 [] ··· 69 65 ] 70 66 71 67 72 - itemViewWithActiveLink : String -> ( Label, String ) -> Html Msg 73 - itemViewWithActiveLink activeHref ( itemLabel, itemHref ) = 68 + itemViewWithActiveLink : Routing.Page -> ( Label, Routing.Page ) -> Html Msg 69 + itemViewWithActiveLink currentPage ( itemLabel, itemPage ) = 74 70 a 75 - [ href itemHref 76 - , onClickPreventDefault (RoutingMsg <| Routing.GoToUrl itemHref) 71 + [ href (pageToHref itemPage) 72 + , onClickPreventDefault (RoutingMsg <| Routing.GoToPage itemPage) 77 73 78 74 -- 79 - , let 80 - baseHref = 81 - itemHref 82 - |> String.dropLeft 1 83 - |> String.split "/" 84 - |> List.head 85 - |> Maybe.withDefault (String.dropLeft 1 itemHref) 86 - |> String.append "/" 87 - in 88 - if baseHref == activeHref then 89 - cssClass ActiveLink 90 - else 91 - cssClass NonActiveLink 75 + , if isSameBase currentPage itemPage then 76 + cssClass ActiveLink 77 + else 78 + cssClass NonActiveLink 92 79 ] 93 80 [ span 94 81 []
+5 -2
src/App/Queue/View.elm
··· 61 61 [ Icons.queue_music colorDerivatives.text 16 62 62 , label [] [ text "History" ] 63 63 ] 64 - , RoutingMsg (Routing.Types.GoToUrl "/queue/history") 64 + , History 65 + |> Routing.Types.Queue 66 + |> Routing.Types.GoToPage 67 + |> RoutingMsg 65 68 ) 66 69 , ( span 67 70 [] ··· 137 140 [ Icons.queue_music colorDerivatives.text 16 138 141 , label [] [ text "Up next" ] 139 142 ] 140 - , "/queue" 143 + , Routing.Types.Queue Index 141 144 ) 142 145 ] 143 146
+47 -9
src/App/Routing/Logic.elm
··· 1 - module Routing.Logic exposing (locationToMessage, locationToPage, pageToParentHref) 1 + module Routing.Logic exposing (locationToMessage, locationToPage, isSameBase, pageToHref) 2 2 3 3 import Navigation 4 4 import Queue.Types as Queue ··· 13 13 locationToMessage location = 14 14 location 15 15 |> locationToPage 16 - |> GoToPage 16 + |> SetPage 17 17 18 18 19 19 {-| Parse the location and return a `Page`. ··· 25 25 |> Maybe.withDefault (ErrorScreen "Page not found.") 26 26 27 27 28 - {-| Href to `Page`. 28 + {-| Base `Page`. 29 29 -} 30 - pageToParentHref : Page -> String 31 - pageToParentHref page = 30 + isSameBase : Page -> Page -> Bool 31 + isSameBase a b = 32 + case a of 33 + Queue _ -> 34 + case b of 35 + Queue _ -> 36 + True 37 + 38 + _ -> 39 + False 40 + 41 + Sources _ -> 42 + case b of 43 + Sources _ -> 44 + True 45 + 46 + _ -> 47 + False 48 + 49 + _ -> 50 + a == b 51 + 52 + 53 + {-| `Page` to `href`. 54 + -} 55 + pageToHref : Page -> String 56 + pageToHref page = 32 57 case page of 33 58 Equalizer -> 34 59 "/equalizer" 35 60 36 - Queue _ -> 61 + ErrorScreen _ -> 62 + "/" 63 + 64 + Index -> 65 + "/" 66 + 67 + Queue Queue.Index -> 37 68 "/queue" 69 + 70 + Queue Queue.History -> 71 + "/queue/history" 38 72 39 73 Settings -> 40 74 "/settings" 41 75 42 - Sources _ -> 76 + Sources Sources.Index -> 43 77 "/sources" 44 78 45 - _ -> 46 - "/" 79 + Sources (Sources.Edit sourceId) -> 80 + "/sources/edit/" ++ sourceId 81 + 82 + Sources Sources.New -> 83 + "/sources/new" 47 84 48 85 49 86 ··· 54 91 route = 55 92 oneOf 56 93 [ map (Sources Sources.Index) (s "sources") 94 + , map (\x -> Sources (Sources.Edit x)) (s "sources" </> s "edit" </> string) 57 95 , map (Sources Sources.New) (s "sources" </> s "new") 58 96 59 97 -- Queue
+15 -13
src/App/Routing/State.elm
··· 15 15 { currentPage = Logic.locationToPage location } 16 16 17 17 18 - initialCommands : Cmd TopLevel.Msg 19 - initialCommands = 20 - Cmd.none 18 + initialCommands : Navigation.Location -> Cmd TopLevel.Msg 19 + initialCommands location = 20 + -- Trigger routing-transitions 21 + location 22 + |> Logic.locationToPage 23 + |> SetPage 24 + |> TopLevel.RoutingMsg 25 + |> do 21 26 22 27 23 28 ··· 28 33 update msg model = 29 34 case msg of 30 35 GoToPage page -> 31 - let 32 - cmd = 33 - if model.currentPage == Index then 34 - do TopLevel.RecalibrateTracks 35 - else 36 - Cmd.none 37 - in 38 - (,) { model | currentPage = page } cmd 36 + (!) 37 + model 38 + [ Navigation.newUrl (Logic.pageToHref page) ] 39 39 40 - GoToUrl url -> 41 - (,) model (Navigation.newUrl url) 40 + SetPage page -> 41 + (!) 42 + { model | currentPage = page } 43 + []
+1 -1
src/App/Routing/Types.elm
··· 6 6 7 7 type Msg 8 8 = GoToPage Page 9 - | GoToUrl String 9 + | SetPage Page 10 10 11 11 12 12 type alias Model =
+32
src/App/Sources/ContextMenu.elm
··· 1 + module Sources.ContextMenu exposing (..) 2 + 3 + import Color 4 + import Material.Icons.Action as Icons 5 + import Material.Icons.Editor as Icons 6 + import Mouse 7 + import Routing.Types 8 + import Sources.Types exposing (..) 9 + import Types exposing (..) 10 + 11 + 12 + listMenu : SourceId -> Mouse.Position -> ContextMenu 13 + listMenu sourceId = 14 + ContextMenu 15 + [ -- Edit 16 + -- 17 + ( Icons.mode_edit (Color.black) 16 18 + , "Edit" 19 + , Edit sourceId 20 + |> Routing.Types.Sources 21 + |> Routing.Types.GoToPage 22 + |> RoutingMsg 23 + ) 24 + 25 + -- Delete 26 + -- 27 + , ( Icons.delete (Color.black) 16 28 + , "Remove" 29 + , Destroy sourceId 30 + |> SourcesMsg 31 + ) 32 + ]
+25 -2
src/App/Sources/State.elm
··· 277 277 EditForm source -> 278 278 source 279 279 280 - newSource = 280 + source = 281 281 { ns | data = Dict.map (always String.trim) ns.data } 282 282 283 283 newCollection = 284 - (setProperSourceId model newSource) :: model.collection 284 + case model.form of 285 + NewForm _ _ -> 286 + (setProperSourceId model source) :: model.collection 287 + 288 + EditForm _ -> 289 + model.collection 290 + |> List.filter (.id >> (/=) source.id) 291 + |> List.append [ source ] 285 292 in 286 293 ($) 287 294 { model ··· 318 325 [ updateEnabledSourceIds newCollection 319 326 , storeSources newCollection 320 327 ] 328 + 329 + 330 + editForm : Model -> SourceId -> Model 331 + editForm model sourceId = 332 + let 333 + source = 334 + model.collection 335 + |> List.find (.id >> (==) sourceId) 336 + |> Maybe.withDefault initialSource 337 + in 338 + { model | form = EditForm source } 339 + 340 + 341 + newForm : Model -> Model 342 + newForm model = 343 + { model | form = NewForm 1 initialSource } 321 344 322 345 323 346
+2 -1
src/App/Sources/Types.elm
··· 124 124 125 125 126 126 type Page 127 - = Index 127 + = Edit SourceId 128 + | Index 128 129 | New
+194 -94
src/App/Sources/View.elm
··· 4 4 import Dict 5 5 import Html exposing (..) 6 6 import Html.Attributes exposing (..) 7 - import Html.Events exposing (onClick, onInput, onSubmit) 7 + import Html.Events exposing (onClick, onInput, onSubmit, onWithOptions) 8 8 import Html.Keyed 9 9 import Html.Lazy exposing (lazy, lazy2, lazy3) 10 + import Json.Decode as Decode 10 11 import List.Extra as List 11 12 import Material.Icons.Alert as Icons 12 13 import Material.Icons.Action as Icons ··· 15 16 import Material.Icons.Content as Icons 16 17 import Material.Icons.Navigation as Icons 17 18 import Material.Icons.Notification as Icons 19 + import Mouse 18 20 import Navigation.View as Navigation 19 - import Routing.Types exposing (Msg(..)) 21 + import Routing.Types 20 22 import Sources.Services as Services 21 23 import Sources.Types as Sources exposing (..) 22 24 import Types as TopLevel exposing (Model, Msg(..)) ··· 37 39 entry : Sources.Page -> TopLevel.Model -> Html TopLevel.Msg 38 40 entry page model = 39 41 case page of 42 + Edit _ -> 43 + lazy 44 + pageEdit 45 + model.sources.form 46 + 40 47 Index -> 41 48 lazy3 42 49 pageIndex ··· 69 76 [ Icons.add colorDerivatives.text 16 70 77 , label [] [ text "Add a new source" ] 71 78 ] 72 - , RoutingMsg (GoToUrl "/sources/new") 79 + , Sources.New 80 + |> Routing.Types.Sources 81 + |> Routing.Types.GoToPage 82 + |> RoutingMsg 73 83 ) 74 84 ] 75 85 ··· 201 211 Icons.not_interested colorDerivatives.text 16 202 212 ] 203 213 204 - -- Delete 214 + -- Settings 205 215 -- 206 216 , a 207 - [ title "Remove" 208 - , source.id 209 - |> Sources.Destroy 210 - |> TopLevel.SourcesMsg 211 - |> onClick 217 + [ onWithOptions 218 + "click" 219 + { stopPropagation = True 220 + , preventDefault = True 221 + } 222 + (Decode.map (TopLevel.ShowSourceMenu source.id) Mouse.position) 212 223 ] 213 - [ Icons.remove_circle_outline colorDerivatives.text 16 ] 224 + [ Icons.settings colorDerivatives.text 16 ] 214 225 ] 215 226 ] 216 227 ) ··· 241 252 [ Icons.list colorDerivatives.text 16 242 253 , label [] [ text "" ] 243 254 ] 244 - , RoutingMsg (GoToUrl "/sources") 255 + , Sources.Index 256 + |> Routing.Types.Sources 257 + |> Routing.Types.GoToPage 258 + |> RoutingMsg 245 259 ) 246 260 ] 247 261 ··· 271 285 272 286 pageNewForm : Int -> Source -> Html Sources.Msg 273 287 pageNewForm step source = 274 - Html.form 275 - [ cssClasses 276 - [ InsulationContent 277 - , InsulationFlexContent 278 - , InsulationCentered 279 - ] 280 - , style 281 - [ ( "position", "relative" ) 282 - , ( "text-align", "center" ) 283 - ] 284 - , onSubmit 285 - (case step of 286 - 1 -> 287 - Sources.AssignFormStep 2 288 + formNode 289 + (case step of 290 + 1 -> 291 + Sources.AssignFormStep 2 288 292 289 - 2 -> 290 - Sources.AssignFormStep 3 293 + 2 -> 294 + Sources.AssignFormStep 3 291 295 292 - 3 -> 293 - Sources.SubmitForm 296 + 3 -> 297 + Sources.SubmitForm 294 298 295 - _ -> 296 - Sources.AssignFormStep 1 297 - ) 298 - ] 299 - [ div 300 - [ cssClasses 301 - [ InsulationFlexContent ] 302 - , style 303 - [ ( "overflow", "hidden" ) 304 - , ( "position", "relative" ) 305 - , ( "width", "100%" ) 306 - , ( "z-index", "9" ) 307 - ] 308 - ] 309 - [ div 310 - [ cssClasses 311 - [ InsulationContent 312 - , InsulationCentered 313 - ] 314 - ] 315 - [ div 316 - [ cssClasses 317 - [ ContentBox ] 318 - , style 319 - [ ( "padding-top", "2.25rem" ) ] 320 - ] 321 - [ case step of 322 - 1 -> 323 - pageNewStep1 source step 299 + _ -> 300 + Sources.AssignFormStep 1 301 + ) 302 + (case step of 303 + 1 -> 304 + pageNewStep1 source step 324 305 325 - 2 -> 326 - pageNewStep2 source step 306 + 2 -> 307 + pageNewStep2 source step 327 308 328 - 3 -> 329 - pageNewStep3 source step 309 + 3 -> 310 + pageNewStep3 source step 330 311 331 - _ -> 332 - text "" 333 - ] 334 - ] 335 - ] 336 - , div 337 - [ cssClass LogoBackdrop ] 338 - [] 339 - ] 312 + _ -> 313 + text "" 314 + ) 340 315 341 316 342 317 pageNewStep1 : Source -> Int -> Html Sources.Msg ··· 416 391 , br 417 392 [] 418 393 [] 419 - , div 420 - [ cssClass FormStyles.InputBox ] 421 - [ input 422 - [ name "name" 423 - , onInput (Sources.AssignFormProperty "name") 424 - , placeholder 425 - (source.service 426 - |> Services.properties 427 - |> List.reverse 428 - |> List.head 429 - |> Maybe.map (\( _, l, _, _ ) -> l) 430 - |> Maybe.withDefault "Label" 431 - ) 432 - , required True 433 - , type_ "text" 434 - , value 435 - (source.data 436 - |> Dict.get "name" 437 - |> Maybe.withDefault "" 438 - ) 439 - ] 440 - [] 441 - ] 394 + , labelBox source 442 395 ] 443 396 , div 444 397 [ cssClass Styles.Intro ] ··· 463 416 464 417 465 418 419 + -- {Page} Edit 420 + 421 + 422 + pageEdit : Sources.Form -> Html TopLevel.Msg 423 + pageEdit sForm = 424 + div 425 + [ cssClasses 426 + [ InsulationContent 427 + , InsulationFlexContent 428 + ] 429 + ] 430 + (case sForm of 431 + EditForm source -> 432 + [ ------------------------------------ 433 + -- Navigation 434 + ------------------------------------ 435 + Navigation.insideCustom 436 + [ ( span 437 + [] 438 + [ Icons.list colorDerivatives.text 16 439 + , label [] [ text "" ] 440 + ] 441 + , Sources.Index 442 + |> Routing.Types.Sources 443 + |> Routing.Types.GoToPage 444 + |> RoutingMsg 445 + ) 446 + ] 447 + 448 + ------------------------------------ 449 + -- Form 450 + ------------------------------------ 451 + , Html.map 452 + SourcesMsg 453 + (formNode 454 + Sources.SubmitForm 455 + (div 456 + [] 457 + [ h3 458 + [] 459 + [ text "Edit source" ] 460 + , div 461 + [ cssClasses 462 + [ Columns ] 463 + , style 464 + [ ( "text-align", "left" ) ] 465 + ] 466 + (List.concat 467 + [ renderSourceProperties source 468 + , [ label 469 + [] 470 + [ text "Name" ] 471 + , labelBox source 472 + ] 473 + ] 474 + ) 475 + , br 476 + [] 477 + [] 478 + , button 479 + [ cssClass Button, type_ "submit" ] 480 + [ text "Save" ] 481 + ] 482 + ) 483 + ) 484 + ] 485 + 486 + _ -> 487 + [ text "Cannot use this model.form on this page" ] 488 + ) 489 + 490 + 491 + 492 + -- Forms 493 + 494 + 495 + formNode : Sources.Msg -> Html Sources.Msg -> Html Sources.Msg 496 + formNode submitMsg childNode = 497 + Html.form 498 + [ cssClasses 499 + [ InsulationContent 500 + , InsulationFlexContent 501 + , InsulationCentered 502 + ] 503 + , style 504 + [ ( "position", "relative" ) 505 + , ( "text-align", "center" ) 506 + ] 507 + , onSubmit submitMsg 508 + ] 509 + [ div 510 + [ cssClasses 511 + [ InsulationFlexContent ] 512 + , style 513 + [ ( "overflow", "hidden" ) 514 + , ( "position", "relative" ) 515 + , ( "width", "100%" ) 516 + , ( "z-index", "9" ) 517 + ] 518 + ] 519 + [ div 520 + [ cssClasses 521 + [ InsulationContent 522 + , InsulationCentered 523 + ] 524 + ] 525 + [ div 526 + [ cssClasses [ ContentBox ] 527 + , style [ ( "padding-top", "2.25rem" ) ] 528 + ] 529 + [ childNode ] 530 + ] 531 + ] 532 + , div 533 + [ cssClass LogoBackdrop ] 534 + [] 535 + ] 536 + 537 + 538 + 466 539 -- Properties 467 540 468 541 ··· 505 578 |> List.drop 1 506 579 |> List.reverse 507 580 |> List.map (propertyRenderer source) 581 + 582 + 583 + labelBox : Source -> Html Sources.Msg 584 + labelBox source = 585 + div 586 + [ cssClass FormStyles.InputBox ] 587 + [ input 588 + [ name "name" 589 + , onInput (Sources.AssignFormProperty "name") 590 + , placeholder 591 + (source.service 592 + |> Services.properties 593 + |> List.reverse 594 + |> List.head 595 + |> Maybe.map (\( _, l, _, _ ) -> l) 596 + |> Maybe.withDefault "Label" 597 + ) 598 + , required True 599 + , type_ "text" 600 + , value 601 + (source.data 602 + |> Dict.get "name" 603 + |> Maybe.withDefault "" 604 + ) 605 + ] 606 + [] 607 + ]
+63 -11
src/App/State.elm
··· 29 29 import Queue.Ports 30 30 import Queue.Types 31 31 import Queue.Utils 32 + import Routing.Types as RT 33 + import Sources.ContextMenu 32 34 import Sources.Types 33 35 import Tracks.ContextMenu 34 36 import Tracks.Types ··· 63 65 64 66 65 67 initialCommands : ProgramFlags -> Navigation.Location -> Cmd Msg 66 - initialCommands flags _ = 68 + initialCommands flags location = 67 69 Cmd.batch 68 70 [ -- Time 69 71 Task.perform SetTimestamp Time.now ··· 72 74 , Console.initialCommands 73 75 , Equalizer.initialCommands 74 76 , Queue.initialCommands 75 - , Routing.initialCommands 77 + , Routing.initialCommands location 76 78 , Sources.initialCommands 77 79 , Tracks.initialCommands flags.tracks 78 80 ] ··· 152 154 RoutingMsg sub -> 153 155 Routing.update sub model.routing 154 156 |> mapModel (\x -> { model | routing = x }) 157 + |> handleRouteTransitions sub model 155 158 156 159 SourcesMsg sub -> 157 160 Sources.update sub model.sources ··· 245 248 |> do 246 249 ] 247 250 251 + ToggleFavourite index -> 252 + (!) 253 + model 254 + [ index 255 + |> Tracks.Types.ToggleFavourite 256 + |> TracksMsg 257 + |> do 258 + ] 259 + 260 + ------------------------------------ 261 + -- Children, Pt. 3 262 + ------------------------------------ 263 + ShowSourceMenu sourceId mousePos -> 264 + (!) 265 + { model | contextMenu = Just (Sources.ContextMenu.listMenu sourceId mousePos) } 266 + [] 267 + 248 268 ShowTrackContextMenu ( index, mousePos ) -> 249 269 let 250 270 contextMenu = ··· 279 299 |> (\c -> { model | contextMenu = c }) 280 300 |> (\m -> ( m, Cmd.none )) 281 301 282 - ToggleFavourite index -> 283 - (!) 284 - model 285 - [ index 286 - |> Tracks.Types.ToggleFavourite 287 - |> TracksMsg 288 - |> do 289 - ] 290 - 291 302 ------------------------------------ 292 303 -- Other 293 304 ------------------------------------ ··· 315 326 , Sub.map SourcesMsg <| Sources.subscriptions model.sources 316 327 , Sub.map TracksMsg <| Tracks.subscriptions model.tracks 317 328 ] 329 + 330 + 331 + handleRouteTransitions : RT.Msg -> Model -> ( Model, Cmd Msg ) -> ( Model, Cmd Msg ) 332 + handleRouteTransitions routingMsg oldModel response = 333 + response 334 + -- 335 + -- Commands 336 + -- 337 + |> Tuple.mapSecond 338 + (\cmd -> 339 + case oldModel.routing.currentPage of 340 + RT.Index -> 341 + Cmd.batch [ cmd, do RecalibrateTracks ] 342 + 343 + _ -> 344 + cmd 345 + ) 346 + -- 347 + -- Model 348 + -- 349 + |> Response.mapModel 350 + (\model -> 351 + case routingMsg of 352 + RT.SetPage (RT.Sources (Sources.Types.Edit sourceId)) -> 353 + let 354 + sources = 355 + Sources.editForm model.sources sourceId 356 + in 357 + { model | sources = sources } 358 + 359 + RT.SetPage (RT.Sources Sources.Types.New) -> 360 + case model.sources.form of 361 + Sources.Types.EditForm _ -> 362 + { model | sources = Sources.newForm model.sources } 363 + 364 + _ -> 365 + model 366 + 367 + _ -> 368 + model 369 + )
+7 -4
src/App/Tracks/View.elm
··· 14 14 import Material.Icons.Toggle 15 15 import Mouse 16 16 import Navigation.View as Navigation 17 - import Routing.Types exposing (Msg(..)) 17 + import Routing.Types 18 18 import Sources.Types exposing (IsProcessing, Source) 19 19 import Styles exposing (Classes(Button, ContentBox, Important, LogoBackdrop)) 20 20 import Tracks.Styles exposing (..) ··· 133 133 -- 134 134 , Navigation.insideCustom 135 135 [ ( Material.Icons.Av.equalizer colorDerivatives.text 16 136 - , TopLevel.RoutingMsg (GoToUrl "/equalizer") 136 + , Routing.Types.Equalizer 137 + |> Routing.Types.GoToPage 138 + |> RoutingMsg 137 139 ) 138 140 , ( Material.Icons.Av.featured_play_list colorDerivatives.text 16 139 141 , TopLevel.ShowViewMenu ··· 205 207 { stopPropagation = False 206 208 , preventDefault = True 207 209 } 208 - ("/sources/new" 209 - |> GoToUrl 210 + (Sources.Types.New 211 + |> Routing.Types.Sources 212 + |> Routing.Types.GoToPage 210 213 |> RoutingMsg 211 214 |> Decode.succeed 212 215 )
+3 -1
src/App/Types.elm
··· 44 44 | ResetQueue 45 45 | PlayTrack String 46 46 | ProcessSources 47 + | ToggleFavourite String 48 + -- Children, Pt. 3 49 + | ShowSourceMenu String Mouse.Position 47 50 | ShowTrackContextMenu ( String, Mouse.Position ) 48 51 | ShowViewMenu 49 52 | ShowViewMenuWithWindow Window.Size 50 - | ToggleFavourite String 51 53 -- Other 52 54 | NoOp 53 55
+11 -5
src/App/View.elm
··· 32 32 import Tracks.View as Tracks 33 33 34 34 35 + -- Children, Pt. 2 36 + 37 + import Queue.Types 38 + import Sources.Types 39 + 40 + 35 41 -- 🍯 36 42 37 43 ··· 181 187 authenticatedNavigation currentPage = 182 188 Navigation.outside 183 189 currentPage 184 - [ ( text "Tracks", "/" ) 185 - , ( text "Queue", "/queue" ) 186 - , ( text "Sources", "/sources" ) 187 - , ( text "Settings", "/settings" ) 190 + [ ( text "Tracks", Routing.Types.Index ) 191 + , ( text "Queue", Routing.Types.Queue Queue.Types.Index ) 192 + , ( text "Sources", Routing.Types.Sources Sources.Types.Index ) 193 + , ( text "Settings", Routing.Types.Settings ) 188 194 ] 189 195 190 196 ··· 206 212 unauthenticatedNavigation : Page -> Html Msg 207 213 unauthenticatedNavigation currentPage = 208 214 Navigation.outsideOutgoing 209 - "/" 215 + currentPage 210 216 [ ( Material.Icons.Action.home colors.base05 16, "/" ) 211 217 , ( Material.Icons.Action.info colors.base05 16, "/about" ) 212 218 ]