@@ -10,7 +10,8 @@ import Code.Namespace.NamespaceRef as NamespaceRef
1010import Code.Perspective as Perspective
1111import Code.ProjectDependency as ProjectDependency exposing (ProjectDependency )
1212import Code.ReadmeCard as ReadmeCard
13- import Html exposing (Html , div , footer , form , p , span , strong , text )
13+ import Code.Version as Version exposing (Version )
14+ import Html exposing (Html , div , footer , form , header , p , span , strong , text )
1415import Html.Attributes exposing (class )
1516import Http exposing (Error )
1617import Json.Decode as Decode
@@ -706,6 +707,26 @@ viewReadmeCard project readme =
706707 ReadmeCard . viewError RetryFetchReadme
707708
708709
710+ viewLatestVersion : ProjectRef -> Version -> Html msg
711+ viewLatestVersion projectRef version =
712+ div [ class " project-releases" ]
713+ [ header []
714+ [ strong [] [ text " Latest release" ]
715+ , span [ class " view-all" ]
716+ [ text " ("
717+ , Link . view " View all"
718+ ( Link . projectReleases projectRef)
719+ , text " )"
720+ ]
721+ ]
722+ , Tag . tag ( Version . toString version)
723+ |> Tag . withClick ( Link . projectRelease projectRef version)
724+ |> Tag . withIcon Icon . rocket
725+ |> Tag . extraLarge
726+ |> Tag . view
727+ ]
728+
729+
709730viewDependencies : List ProjectDependency -> Html msg
710731viewDependencies deps =
711732 let
@@ -732,7 +753,7 @@ viewDependencies deps =
732753 ]
733754
734755
735- view_ : Session -> ProjectDetails -> Model -> ( Maybe ( List (Html Msg ) ), PageContent Msg )
756+ view_ : Session -> ProjectDetails -> Model -> ( List (Html Msg ), PageContent Msg )
736757view_ session project model =
737758 let
738759 viewKpi icon num labelSingular labelPlural kpiDescription =
@@ -843,17 +864,18 @@ view_ session project model =
843864 case ( project. summary, Set . toList project. tags ) of
844865 ( Just s, [] ) ->
845866 Just
846- [ div [ class " project-description" ]
867+ ( div [ class " project-description" ]
847868 [ div [ class " project-summary" ] [ text s ]
848869 , edit Icon . writingPad " Edit summary"
849870 |> Maybe . map Button . view
850871 |> Maybe . withDefault UI . nothing
851872 ]
852- ]
873+ )
853874
854875 ( Just s, tags ) ->
855876 Just
856- [ div [ class " project-description" ]
877+ ( div
878+ [ class " project-description" ]
857879 [ div [ class " project-summary" ] [ text s ]
858880 , tags |> List . map Tag . tag |> Tag . viewTags
859881 , Button . icon ShowEditDescriptionModal Icon . writingPad
@@ -862,25 +884,27 @@ view_ session project model =
862884 |> showIfCanMaintain
863885 |> MaybeE . unwrap UI . nothing Button . view
864886 ]
865- ]
887+ )
866888
867889 ( Nothing , [] ) ->
868890 if canMaintain then
869891 Just
870- [ div [ class " project-description-empty-state" ]
892+ ( div
893+ [ class " project-description-empty-state" ]
871894 [ text " Add a bit of detail with a summary."
872895 , edit Icon . writingPad " Add now "
873896 |> MaybeE . unwrap UI . nothing Button . view
874897 ]
875- ]
898+ )
876899
877900 else
878901 Nothing
879902
880903 ( Nothing , tags ) ->
881904 if canMaintain then
882905 Just
883- [ div []
906+ ( div
907+ []
884908 [ div
885909 [ class " project-description-empty-state" ]
886910 [ text " Add a bit of detail with a summary."
@@ -889,31 +913,26 @@ view_ session project model =
889913 ]
890914 , tags |> List . map Tag . tag |> Tag . viewTags
891915 ]
892- ]
916+ )
893917
894918 else
895919 Just
896- [ div [] [ tags |> List . map Tag . tag |> Tag . viewTags ]
897- ]
920+ ( div
921+ []
922+ [ tags |> List . map Tag . tag |> Tag . viewTags ]
923+ )
898924
899925 dependencies =
900926 model. dependencies
901927 |> RemoteData . toMaybe
902928 |> Maybe . map viewDependencies
903929
904- aside =
905- case ( summaryAndTags, dependencies ) of
906- ( Just sumAndTags, Just deps ) ->
907- Just ( sumAndTags ++ [ deps ] )
908-
909- ( Nothing , Just deps ) ->
910- Just [ deps ]
930+ version =
931+ project. latestVersion
932+ |> Maybe . map ( viewLatestVersion project. ref)
911933
912- ( Just sumAndTags, Nothing ) ->
913- Just sumAndTags
914-
915- _ ->
916- Nothing
934+ aside =
935+ MaybeE . values [ summaryAndTags, dependencies, version ]
917936
918937 content =
919938 PageContent . oneColumn
@@ -949,17 +968,16 @@ view session projectRef project model =
949968 ( aside, content ) =
950969 view_ session project model
951970 in
952- case aside of
953- Just aside_ ->
954- ( PageLayout . centeredLayout ( PageContent . withLeftAside aside_ content)
955- PageFooter . pageFooter
956- |> PageLayout . withSubduedBackground
957- , modal
958- )
971+ if List . isEmpty aside then
972+ ( PageLayout . centeredNarrowLayout content
973+ PageFooter . pageFooter
974+ |> PageLayout . withSubduedBackground
975+ , modal
976+ )
959977
960- Nothing ->
961- ( PageLayout . centeredNarrowLayout content
962- PageFooter . pageFooter
963- |> PageLayout . withSubduedBackground
964- , modal
965- )
978+ else
979+ ( PageLayout . centeredLayout ( PageContent . withLeftAside aside content)
980+ PageFooter . pageFooter
981+ |> PageLayout . withSubduedBackground
982+ , modal
983+ )
0 commit comments