Merge branch 'recipe-versions'
continuous-integration/drone/push Build is passing Details
continuous-integration/drone Build is passing Details

This commit is contained in:
3wc 2023-03-28 11:22:35 -04:00
commit 338da444d8
1 changed files with 21 additions and 3 deletions

View File

@ -37,7 +37,7 @@ type alias App =
{ name : String
, category : String
, repository : Maybe String
, versions : Maybe (List String)
, versions : List String
, icon : Maybe String
, status : Int
, slug : String
@ -271,7 +271,10 @@ viewApp app readme =
[ div [] (Markdown.toHtml Nothing readme)
]
, div [ class "card-footer" ]
[]
[ h5 [] [ text "Versions" ]
, ul [] (
List.map (\version -> li [] [ text (version) ]) app.versions
)]
]
]
@ -316,13 +319,28 @@ featuresDecoder =
]
versionsDecoder : Decode.Decoder (List String)
versionsDecoder =
Decode.list (Decode.keyValuePairs Decode.value)
|> Decode.map buildVersions
buildVersions : List (List ( String, Decode.Value )) -> List String
buildVersions versions =
List.concatMap (List.map (\( version, _ ) -> version)) versions
appDecoder : Decode.Decoder App
appDecoder =
Decode.succeed App
|> andMap (Decode.field "name" Decode.string)
|> andMap (Decode.field "category" Decode.string)
|> andMap (Decode.maybe (Decode.field "repository" Decode.string))
|> andMap (Decode.succeed Nothing)
|> andMap (Decode.at [ "versions" ] versionsDecoder)
-- |> andMap (Decode.succeed Nothing)
|> andMap (Decode.maybe (Decode.field "icon" Decode.string))
|> andMap (Decode.at [ "features" ] featuresDecoder)
|> andMap (Decode.succeed "")