@@ -6,7 +6,6 @@ import Browser.Navigation as Nav
6
6
import CodebaseTree
7
7
import Definition.Reference exposing (Reference )
8
8
import Env exposing (Env , OperatingSystem (..) )
9
- import Env.AppContext as AppContext exposing (AppContext (..) )
10
9
import Finder
11
10
import Finder.SearchOptions as SearchOptions
12
11
import FullyQualifiedName as FQN exposing (FQN )
@@ -24,15 +23,12 @@ import RemoteData
24
23
import Route exposing (Route )
25
24
import UI
26
25
import UI.AppHeader as AppHeader
27
- import UI.Banner as Banner
28
26
import UI.Button as Button
29
27
import UI.Click as Click exposing (Click (..) )
30
- import UI.CopyField as CopyField
31
28
import UI.Icon as Icon
32
29
import UI.Modal as Modal
33
30
import UI.Sidebar as Sidebar
34
31
import UI.Tooltip as Tooltip
35
- import UnisonShare.SidebarContent
36
32
import Url exposing (Url )
37
33
import Workspace
38
34
import Workspace.WorkspaceItems as WorkspaceItems
@@ -48,7 +44,6 @@ type Modal
48
44
| HelpModal
49
45
| ReportBugModal
50
46
| PublishModal
51
- | DownloadModal FQN
52
47
53
48
54
49
type alias Model =
@@ -459,8 +454,8 @@ subscriptions model =
459
454
-- VIEW
460
455
461
456
462
- appTitle : Maybe msg -> AppContext -> AppHeader .AppTitle msg
463
- appTitle clickMsg appContext =
457
+ appTitle : Maybe msg -> AppHeader .AppTitle msg
458
+ appTitle clickMsg =
464
459
let
465
460
appTitle_ =
466
461
case clickMsg of
@@ -469,52 +464,28 @@ appTitle clickMsg appContext =
469
464
470
465
Just msg ->
471
466
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
467
in
481
- appTitle_ content
468
+ appTitle_ ( h1 [] [ text " Unison " , span [ class " context unison-local " ] [ text " Local " ] ] )
482
469
483
470
484
471
viewAppHeader : Model -> Html Msg
485
472
viewAppHeader model =
486
473
let
487
- { appContext, perspective } =
488
- model. env
489
-
490
474
changePerspectiveMsg =
491
- case perspective of
475
+ case model . env . perspective of
492
476
Codebase codebaseHash ->
493
477
ChangePerspective ( Codebase codebaseHash)
494
478
495
479
Namespace { codebaseHash } ->
496
480
ChangePerspective ( Codebase codebaseHash)
497
481
498
482
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
- )
483
+ appTitle ( Just changePerspectiveMsg)
513
484
in
514
485
AppHeader . view
515
486
{ menuToggle = Just ToggleSidebar
516
487
, appTitle = appTitle_
517
- , banner = banner
488
+ , banner = Nothing
518
489
, rightButton = Just ( Button . button ( ShowModal PublishModal ) " Publish on Unison Share" |> Button . share)
519
490
}
520
491
@@ -533,26 +504,13 @@ viewSidebarHeader env =
533
504
-- thats quite involved...
534
505
isOverflowing =
535
506
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
507
in
549
508
Sidebar . header
550
509
[ Sidebar . headerItem
551
510
[ classList [ ( " is-overflowing" , isOverflowing ) ] ]
552
511
[ UI . namespaceSlug
553
512
, h2 [ class " namespace" ] [ FQN . view fqn ]
554
513
]
555
- , download
556
514
, UI . divider
557
515
]
558
516
@@ -573,67 +531,44 @@ viewMainSidebarCollapseButton model =
573
531
]
574
532
575
533
576
- subMenu : AppContext -> List ( String , Click Msg )
577
- subMenu appContext =
534
+ subMenu : List ( String , Click Msg )
535
+ subMenu =
578
536
[ ( " Unison website" , ExternalHref " https://unisonweb.org" )
579
537
, ( " Docs" , ExternalHref " https://unisonweb.org/docs" )
580
538
, ( " Language Reference" , ExternalHref " https://unisonweb.org/docs/language-reference" )
581
539
, ( " Community" , ExternalHref " https://unisonweb.org/community" )
582
540
, ( " Report a bug" , OnClick ( ShowModal ReportBugModal ) )
541
+ , ( " Unison Share" , ExternalHref " https://share.unison-lang.org" )
583
542
]
584
- ++ ( if AppContext . isUnisonLocal appContext then
585
- [ ( " Unison Share" , ExternalHref " https://share.unison-lang.org" ) ]
586
-
587
- else
588
- []
589
- )
590
543
591
544
592
- unisonSubmenu : AppContext -> Html Msg
593
- unisonSubmenu appContext =
545
+ unisonSubmenu : Html Msg
546
+ unisonSubmenu =
594
547
Tooltip . tooltip
595
548
( Icon . unisonMark
596
549
|> Icon . withClass " sidebar-unison-submenu"
597
550
|> Icon . view
598
551
)
599
- ( subMenu appContext |> Tooltip . textMenu)
552
+ ( Tooltip . textMenu subMenu )
600
553
|> Tooltip . withPosition Tooltip . RightOf
601
554
|> Tooltip . withArrow Tooltip . End
602
555
|> Tooltip . view
603
556
604
557
605
558
viewMainSidebar : Model -> Html Msg
606
559
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
560
Sidebar . view
625
561
[ viewMainSidebarCollapseButton model
626
562
, div [ class " expanded-content" ]
627
563
[ viewSidebarHeader model. env
628
564
, div [ class " sidebar-scroll-area" ]
629
- [ sidebarContent
630
- , Sidebar . section
565
+ [ Sidebar . section
631
566
" Namespaces and Definitions"
632
567
[ Html . map CodebaseTreeMsg ( CodebaseTree . view model. codebaseTree) ]
633
568
, nav []
634
569
( List . map
635
570
( \ ( l, c ) -> Click . view [] [ text l ] c)
636
- ( subMenu appContext )
571
+ subMenu
637
572
++ [ a [ class " show-help" , onClick ( ShowModal HelpModal ) ]
638
573
[ text " Keyboard Shortcuts"
639
574
, KeyboardShortcut . view model. keyboardShortcut ( KeyboardShortcut . single QuestionMark )
@@ -643,7 +578,7 @@ viewMainSidebar model =
643
578
]
644
579
]
645
580
, div [ class " collapsed-content" ]
646
- [ unisonSubmenu appContext
581
+ [ unisonSubmenu
647
582
, Tooltip . tooltip
648
583
( a
649
584
[ class " show-help-collapsed" , onClick ( ShowModal HelpModal ) ]
@@ -658,33 +593,6 @@ viewMainSidebar model =
658
593
]
659
594
660
595
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
596
viewHelpModal : OperatingSystem -> KeyboardShortcut .Model -> Html Msg
689
597
viewHelpModal os keyboardShortcut =
690
598
let
@@ -780,8 +688,8 @@ viewPublishModal =
780
688
|> Modal . view
781
689
782
690
783
- viewReportBugModal : AppContext -> Html Msg
784
- viewReportBugModal appContext =
691
+ viewReportBugModal : Html Msg
692
+ viewReportBugModal =
785
693
let
786
694
content =
787
695
Modal . Content
@@ -796,7 +704,7 @@ viewReportBugModal appContext =
796
704
, div [ class " action" ]
797
705
[ githubLinkButton " unisonweb/codebase-ui"
798
706
, text " for reports on"
799
- , strong [] [ text ( AppContext . toString appContext ) ]
707
+ , strong [] [ text " Unison Local " ]
800
708
, span [ class " subtle" ] [ text " (this UI)" ]
801
709
]
802
710
, div [ class " action" ]
@@ -832,44 +740,34 @@ viewModal model =
832
740
viewPublishModal
833
741
834
742
ReportBugModal ->
835
- viewReportBugModal model . env . appContext
743
+ viewReportBugModal
836
744
837
- DownloadModal fqn ->
838
- viewDownloadModal fqn
839
745
840
-
841
- viewAppLoading : AppContext -> Html msg
842
- viewAppLoading appContext =
746
+ viewAppLoading : Html msg
747
+ viewAppLoading =
843
748
div [ id " app" ]
844
- [ AppHeader . view ( AppHeader . appHeader ( appTitle Nothing appContext ))
749
+ [ AppHeader . view ( AppHeader . appHeader ( appTitle Nothing ))
845
750
, Sidebar . view []
846
751
, div [ id " main-content" ] []
847
752
]
848
753
849
754
850
- viewAppError : AppContext -> Http .Error -> Html msg
851
- viewAppError appContext error =
852
- let
853
- context =
854
- AppContext . toString appContext
855
- in
755
+ viewAppError : Http .Error -> Html msg
756
+ viewAppError error =
856
757
div [ id " app" ]
857
- [ AppHeader . view ( AppHeader . appHeader ( appTitle Nothing appContext ))
758
+ [ AppHeader . view ( AppHeader . appHeader ( appTitle Nothing ))
858
759
, Sidebar . view []
859
760
, div [ id " main-content" , class " app-error" ]
860
761
[ Icon . view Icon . warn
861
762
, p [ title ( Api . errorToString error) ]
862
- [ text ( context ++ " could not be started." ) ]
763
+ [ text " Unison Local could not be started." ]
863
764
]
864
765
]
865
766
866
767
867
768
view : Model -> Browser .Document Msg
868
769
view model =
869
770
let
870
- title_ =
871
- AppContext . toString model. env. appContext
872
-
873
771
page =
874
772
case model. route of
875
773
Route . Perspective _ ->
@@ -882,7 +780,7 @@ view model =
882
780
Route . Definition _ _ ->
883
781
Html . map WorkspaceMsg ( Workspace . view model. workspace)
884
782
in
885
- { title = title_
783
+ { title = " Unison Local "
886
784
, body =
887
785
[ div [ id " app" , classList [ ( " sidebar-toggled" , model. sidebarToggled ) ] ]
888
786
[ viewAppHeader model
0 commit comments