@@ -24,15 +24,12 @@ import RemoteData
24
24
import Route exposing (Route )
25
25
import UI
26
26
import UI.AppHeader as AppHeader
27
- import UI.Banner as Banner
28
27
import UI.Button as Button
29
28
import UI.Click as Click exposing (Click (..) )
30
- import UI.CopyField as CopyField
31
29
import UI.Icon as Icon
32
30
import UI.Modal as Modal
33
31
import UI.Sidebar as Sidebar
34
32
import UI.Tooltip as Tooltip
35
- import UnisonShare.SidebarContent
36
33
import Url exposing (Url )
37
34
import Workspace
38
35
import Workspace.WorkspaceItems as WorkspaceItems
@@ -48,7 +45,6 @@ type Modal
48
45
| HelpModal
49
46
| ReportBugModal
50
47
| PublishModal
51
- | DownloadModal FQN
52
48
53
49
54
50
type alias Model =
@@ -459,8 +455,8 @@ subscriptions model =
459
455
-- VIEW
460
456
461
457
462
- appTitle : Maybe msg -> AppContext -> AppHeader .AppTitle msg
463
- appTitle clickMsg appContext =
458
+ appTitle : Maybe msg -> AppHeader .AppTitle msg
459
+ appTitle clickMsg =
464
460
let
465
461
appTitle_ =
466
462
case clickMsg of
@@ -469,52 +465,28 @@ appTitle clickMsg appContext =
469
465
470
466
Just msg ->
471
467
AppHeader . Clickable msg
472
-
473
- content =
474
- case appContext of
475
- UnisonLocal ->
476
- h1 [] [ text " Unison" , span [ class " context unison-local" ] [ text " Local" ] ]
477
-
478
- UnisonShare ->
479
- h1 [] [ text " Unison" , span [ class " context unison-share" ] [ text " Share" ] ]
480
468
in
481
- appTitle_ content
469
+ appTitle_ ( h1 [] [ text " Unison " , span [ class " context unison-local " ] [ text " Local " ] ] )
482
470
483
471
484
472
viewAppHeader : Model -> Html Msg
485
473
viewAppHeader model =
486
474
let
487
- { appContext, perspective } =
488
- model. env
489
-
490
475
changePerspectiveMsg =
491
- case perspective of
476
+ case model . env . perspective of
492
477
Codebase codebaseHash ->
493
478
ChangePerspective ( Codebase codebaseHash)
494
479
495
480
Namespace { codebaseHash } ->
496
481
ChangePerspective ( Codebase codebaseHash)
497
482
498
483
appTitle_ =
499
- appTitle ( Just changePerspectiveMsg) appContext
500
-
501
- banner =
502
- case appContext of
503
- UnisonLocal ->
504
- Nothing
505
-
506
- UnisonShare ->
507
- Just
508
- ( Banner . promotion " article"
509
- " New Article: Spark-like distributed datasets in under 100 lines of Unison"
510
- ( ExternalHref " https://www.unison-lang.org/articles/distributed-datasets/" )
511
- " Check it out!"
512
- )
484
+ appTitle ( Just changePerspectiveMsg)
513
485
in
514
486
AppHeader . view
515
487
{ menuToggle = Just ToggleSidebar
516
488
, appTitle = appTitle_
517
- , banner = banner
489
+ , banner = Nothing
518
490
, rightButton = Just ( Button . button ( ShowModal PublishModal ) " Publish on Unison Share" |> Button . share)
519
491
}
520
492
@@ -533,26 +505,13 @@ viewSidebarHeader env =
533
505
-- thats quite involved...
534
506
isOverflowing =
535
507
fqn |> FQN . toString |> String . length |> ( \ l -> l > 20 )
536
-
537
- download =
538
- case env. appContext of
539
- UnisonShare ->
540
- Button . iconThenLabel ( ShowModal ( DownloadModal fqn)) Icon . download " Download latest version"
541
- |> Button . small
542
- |> Button . view
543
- |> List . singleton
544
- |> Sidebar . headerItem []
545
-
546
- UnisonLocal ->
547
- UI . nothing
548
508
in
549
509
Sidebar . header
550
510
[ Sidebar . headerItem
551
511
[ classList [ ( " is-overflowing" , isOverflowing ) ] ]
552
512
[ UI . namespaceSlug
553
513
, h2 [ class " namespace" ] [ FQN . view fqn ]
554
514
]
555
- , download
556
515
, UI . divider
557
516
]
558
517
@@ -573,67 +532,44 @@ viewMainSidebarCollapseButton model =
573
532
]
574
533
575
534
576
- subMenu : AppContext -> List ( String , Click Msg )
577
- subMenu appContext =
535
+ subMenu : List ( String , Click Msg )
536
+ subMenu =
578
537
[ ( " Unison website" , ExternalHref " https://unisonweb.org" )
579
538
, ( " Docs" , ExternalHref " https://unisonweb.org/docs" )
580
539
, ( " Language Reference" , ExternalHref " https://unisonweb.org/docs/language-reference" )
581
540
, ( " Community" , ExternalHref " https://unisonweb.org/community" )
582
541
, ( " Report a bug" , OnClick ( ShowModal ReportBugModal ) )
542
+ , ( " Unison Share" , ExternalHref " https://share.unison-lang.org" )
583
543
]
584
- ++ ( if AppContext . isUnisonLocal appContext then
585
- [ ( " Unison Share" , ExternalHref " https://share.unison-lang.org" ) ]
586
-
587
- else
588
- []
589
- )
590
544
591
545
592
- unisonSubmenu : AppContext -> Html Msg
593
- unisonSubmenu appContext =
546
+ unisonSubmenu : Html Msg
547
+ unisonSubmenu =
594
548
Tooltip . tooltip
595
549
( Icon . unisonMark
596
550
|> Icon . withClass " sidebar-unison-submenu"
597
551
|> Icon . view
598
552
)
599
- ( subMenu appContext |> Tooltip . textMenu)
553
+ ( Tooltip . textMenu subMenu )
600
554
|> Tooltip . withPosition Tooltip . RightOf
601
555
|> Tooltip . withArrow Tooltip . End
602
556
|> Tooltip . view
603
557
604
558
605
559
viewMainSidebar : Model -> Html Msg
606
560
viewMainSidebar model =
607
- let
608
- perspective =
609
- model. env. perspective
610
-
611
- appContext =
612
- model. env. appContext
613
-
614
- changePerspectiveMsg =
615
- Perspective . toNamespacePerspective perspective >> ChangePerspective
616
-
617
- sidebarContent =
618
- if Perspective . isCodebasePerspective perspective && AppContext . isUnisonShare appContext then
619
- UnisonShare . SidebarContent . view changePerspectiveMsg
620
-
621
- else
622
- UI . nothing
623
- in
624
561
Sidebar . view
625
562
[ viewMainSidebarCollapseButton model
626
563
, div [ class " expanded-content" ]
627
564
[ viewSidebarHeader model. env
628
565
, div [ class " sidebar-scroll-area" ]
629
- [ sidebarContent
630
- , Sidebar . section
566
+ [ Sidebar . section
631
567
" Namespaces and Definitions"
632
568
[ Html . map CodebaseTreeMsg ( CodebaseTree . view model. codebaseTree) ]
633
569
, nav []
634
570
( List . map
635
571
( \ ( l, c ) -> Click . view [] [ text l ] c)
636
- ( subMenu appContext )
572
+ subMenu
637
573
++ [ a [ class " show-help" , onClick ( ShowModal HelpModal ) ]
638
574
[ text " Keyboard Shortcuts"
639
575
, KeyboardShortcut . view model. keyboardShortcut ( KeyboardShortcut . single QuestionMark )
@@ -643,7 +579,7 @@ viewMainSidebar model =
643
579
]
644
580
]
645
581
, div [ class " collapsed-content" ]
646
- [ unisonSubmenu appContext
582
+ [ unisonSubmenu
647
583
, Tooltip . tooltip
648
584
( a
649
585
[ class " show-help-collapsed" , onClick ( ShowModal HelpModal ) ]
@@ -658,33 +594,6 @@ viewMainSidebar model =
658
594
]
659
595
660
596
661
- viewDownloadModal : FQN -> Html Msg
662
- viewDownloadModal fqn =
663
- let
664
- prettyName =
665
- FQN . toString fqn
666
-
667
- unqualified =
668
- FQN . unqualifiedName fqn
669
-
670
- pullCommand =
671
- " pull [email protected] :unisonweb/share.git:." ++ prettyName
++ " ." ++ unqualified
672
-
673
- content =
674
- Modal . Content
675
- ( section
676
- []
677
- [ p [] [ text " Download " , UI . bold prettyName, text " by pulling the namespace from Unison Share into a namespace in your local codebase:" ]
678
- , CopyField . copyField ( \ _ -> CloseModal ) pullCommand |> CopyField . withPrefix " .>" |> CopyField . view
679
- , div [ class " hint" ] [ text " Copy and paste this command into UCM." ]
680
- ]
681
- )
682
- in
683
- Modal . modal " download-modal" CloseModal content
684
- |> Modal . withHeader ( " Download " ++ prettyName)
685
- |> Modal . view
686
-
687
-
688
597
viewHelpModal : OperatingSystem -> KeyboardShortcut .Model -> Html Msg
689
598
viewHelpModal os keyboardShortcut =
690
599
let
@@ -834,32 +743,25 @@ viewModal model =
834
743
ReportBugModal ->
835
744
viewReportBugModal model. env. appContext
836
745
837
- DownloadModal fqn ->
838
- viewDownloadModal fqn
839
-
840
746
841
- viewAppLoading : AppContext -> Html msg
842
- viewAppLoading appContext =
747
+ viewAppLoading : Html msg
748
+ viewAppLoading =
843
749
div [ id " app" ]
844
- [ AppHeader . view ( AppHeader . appHeader ( appTitle Nothing appContext ))
750
+ [ AppHeader . view ( AppHeader . appHeader ( appTitle Nothing ))
845
751
, Sidebar . view []
846
752
, div [ id " main-content" ] []
847
753
]
848
754
849
755
850
- viewAppError : AppContext -> Http .Error -> Html msg
851
- viewAppError appContext error =
852
- let
853
- context =
854
- AppContext . toString appContext
855
- in
756
+ viewAppError : Http .Error -> Html msg
757
+ viewAppError error =
856
758
div [ id " app" ]
857
- [ AppHeader . view ( AppHeader . appHeader ( appTitle Nothing appContext ))
759
+ [ AppHeader . view ( AppHeader . appHeader ( appTitle Nothing ))
858
760
, Sidebar . view []
859
761
, div [ id " main-content" , class " app-error" ]
860
762
[ Icon . view Icon . warn
861
763
, p [ title ( Api . errorToString error) ]
862
- [ text ( context ++ " could not be started." ) ]
764
+ [ text " Unison Local could not be started." ]
863
765
]
864
766
]
865
767
0 commit comments