@@ -27,6 +27,7 @@ import UI.Button as Button
27
27
import UI.Click as Click exposing (Click (..) )
28
28
import UI.Icon as Icon
29
29
import UI.Modal as Modal
30
+ import UI.Page as Page
30
31
import UI.Sidebar as Sidebar
31
32
import UI.Tooltip as Tooltip
32
33
import Url exposing (Url )
@@ -471,7 +472,7 @@ appTitle clickMsg =
471
472
appTitle_ ( h1 [] [ text " Unison" , span [ class " context unison-local" ] [ text " Local" ] ] )
472
473
473
474
474
- viewAppHeader : Model -> Html Msg
475
+ viewAppHeader : Model -> AppHeader . AppHeader Msg
475
476
viewAppHeader model =
476
477
let
477
478
changePerspectiveMsg =
@@ -485,12 +486,11 @@ viewAppHeader model =
485
486
appTitle_ =
486
487
appTitle ( Just changePerspectiveMsg)
487
488
in
488
- AppHeader . view
489
- { menuToggle = Just ToggleSidebar
490
- , appTitle = appTitle_
491
- , banner = Nothing
492
- , rightButton = Just ( Button . button ( ShowModal PublishModal ) " Publish on Unison Share" |> Button . share)
493
- }
489
+ { menuToggle = Just ToggleSidebar
490
+ , appTitle = appTitle_
491
+ , banner = Nothing
492
+ , rightButton = Just ( Button . button ( ShowModal PublishModal ) " Publish on Unison Share" |> Button . share)
493
+ }
494
494
495
495
496
496
viewSidebarHeader : Env -> Html Msg
@@ -558,42 +558,41 @@ unisonSubmenu =
558
558
|> Tooltip . view
559
559
560
560
561
- viewMainSidebar : Model -> Html Msg
561
+ viewMainSidebar : Model -> List ( Html Msg )
562
562
viewMainSidebar model =
563
- Sidebar . view
564
- [ viewMainSidebarCollapseButton model
565
- , div [ class " expanded-content" ]
566
- [ viewSidebarHeader model. env
567
- , div [ class " sidebar-scroll-area" ]
568
- [ Sidebar . section
569
- " Namespaces and Definitions"
570
- [ Html . map CodebaseTreeMsg ( CodebaseTree . view model. codebaseTree) ]
571
- , nav []
572
- ( List . map
573
- ( \ ( l, c ) -> Click . view [] [ text l ] c)
574
- subMenu
575
- ++ [ a [ class " show-keyboard-shortcuts" , onClick ( ShowModal HelpModal ) ]
576
- [ text " Keyboard Shortcuts"
577
- , KeyboardShortcut . view model. keyboardShortcut ( KeyboardShortcut . single QuestionMark )
578
- ]
579
- ]
580
- )
581
- ]
582
- ]
583
- , div [ class " collapsed-content" ]
584
- [ unisonSubmenu
585
- , Tooltip . tooltip
586
- ( a
587
- [ class " show-keyboard-shortcuts-collapsed" , onClick ( ShowModal HelpModal ) ]
588
- [ KeyboardShortcut . view model. keyboardShortcut ( KeyboardShortcut . single QuestionMark )
589
- ]
563
+ [ viewMainSidebarCollapseButton model
564
+ , div [ class " expanded-content" ]
565
+ [ viewSidebarHeader model. env
566
+ , div [ class " sidebar-scroll-area" ]
567
+ [ Sidebar . section
568
+ " Namespaces and Definitions"
569
+ [ Html . map CodebaseTreeMsg ( CodebaseTree . view model. codebaseTree) ]
570
+ , nav []
571
+ ( List . map
572
+ ( \ ( l, c ) -> Click . view [] [ text l ] c)
573
+ subMenu
574
+ ++ [ a [ class " show-keyboard-shortcuts" , onClick ( ShowModal HelpModal ) ]
575
+ [ text " Keyboard Shortcuts"
576
+ , KeyboardShortcut . view model. keyboardShortcut ( KeyboardShortcut . single QuestionMark )
577
+ ]
578
+ ]
590
579
)
591
- ( Tooltip . Text " Keyboard Shortcuts" )
592
- |> Tooltip . withPosition Tooltip . RightOf
593
- |> Tooltip . withArrow Tooltip . Middle
594
- |> Tooltip . view
595
580
]
596
581
]
582
+ , div [ class " collapsed-content" ]
583
+ [ unisonSubmenu
584
+ , Tooltip . tooltip
585
+ ( a
586
+ [ class " show-help-collapsed" , onClick ( ShowModal HelpModal ) ]
587
+ [ KeyboardShortcut . view model. keyboardShortcut ( KeyboardShortcut . single QuestionMark )
588
+ ]
589
+ )
590
+ ( Tooltip . Text " Keyboard Shortcuts" )
591
+ |> Tooltip . withPosition Tooltip . RightOf
592
+ |> Tooltip . withArrow Tooltip . Middle
593
+ |> Tooltip . view
594
+ ]
595
+ ]
597
596
598
597
599
598
viewHelpModal : OperatingSystem -> KeyboardShortcut .Model -> Html Msg
@@ -748,30 +747,39 @@ viewModal model =
748
747
749
748
viewAppLoading : Html msg
750
749
viewAppLoading =
751
- div [ id " app" ]
752
- [ AppHeader . view ( AppHeader . appHeader ( appTitle Nothing ))
753
- , Sidebar . view []
754
- , div [ id " main-content" ] []
755
- ]
750
+ Page . view
751
+ ( Page . SidebarLayout
752
+ { header = AppHeader . appHeader ( appTitle Nothing )
753
+ , sidebar = []
754
+ , sidebarToggled = False
755
+ , content = Page . PageContent []
756
+ }
757
+ )
756
758
757
759
758
760
viewAppError : Http .Error -> Html msg
759
761
viewAppError error =
760
- div [ id " app" ]
761
- [ AppHeader . view ( AppHeader . appHeader ( appTitle Nothing ))
762
- , Sidebar . view []
763
- , div [ id " main-content" , class " app-error" ]
764
- [ Icon . view Icon . warn
765
- , p [ title ( Api . errorToString error) ]
766
- [ text " Unison Local could not be started." ]
767
- ]
768
- ]
762
+ Page . view
763
+ ( Page . SidebarLayout
764
+ { header = AppHeader . appHeader ( appTitle Nothing )
765
+ , sidebar = []
766
+ , sidebarToggled = False
767
+ , content =
768
+ Page . PageContent
769
+ [ div [ class " app-error" ]
770
+ [ Icon . view Icon . warn
771
+ , p [ title ( Api . errorToString error) ]
772
+ [ text " Unison Local could not be started." ]
773
+ ]
774
+ ]
775
+ }
776
+ )
769
777
770
778
771
779
view : Model -> Browser .Document Msg
772
780
view model =
773
781
let
774
- page =
782
+ pageContent =
775
783
case model. route of
776
784
Route . Perspective _ ->
777
785
Html . map PerspectiveLandingMsg
@@ -782,14 +790,15 @@ view model =
782
790
783
791
Route . Definition _ _ ->
784
792
Html . map WorkspaceMsg ( Workspace . view model. workspace)
793
+
794
+ page =
795
+ Page . SidebarLayout
796
+ { header = viewAppHeader model
797
+ , sidebar = viewMainSidebar model
798
+ , sidebarToggled = model. sidebarToggled
799
+ , content = Page . PageContent [ pageContent ]
800
+ }
785
801
in
786
802
{ title = " Unison Local"
787
- , body =
788
- [ div [ id " app" , classList [ ( " sidebar-toggled" , model. sidebarToggled ) ] ]
789
- [ viewAppHeader model
790
- , viewMainSidebar model
791
- , div [ id " main-content" ] [ page ]
792
- , viewModal model
793
- ]
794
- ]
803
+ , body = [ div [ id " app" ] [ Page . view page, viewModal model ] ]
795
804
}
0 commit comments