Show app description on listing pages
continuous-integration/drone/push Build is failing
Details
continuous-integration/drone/push Build is failing
Details
Closes #3
This commit is contained in:
parent
33ddb9e390
commit
31d590c3fe
|
@ -15,3 +15,14 @@ i.fas, i.fab {
|
|||
display: inline-block;
|
||||
margin-right: 0.3rem;
|
||||
}
|
||||
|
||||
@media (min-width: 768px) {
|
||||
.card-body p {
|
||||
height: 2.5rem;
|
||||
}
|
||||
}
|
||||
|
||||
@media (max-width: 768px) {
|
||||
.card-body p {
|
||||
}
|
||||
}
|
||||
|
|
|
@ -40,6 +40,7 @@ type alias App =
|
|||
, slug : String
|
||||
, default_branch : String
|
||||
, website : Maybe String
|
||||
, description : Maybe String
|
||||
}
|
||||
|
||||
type alias Model =
|
||||
|
@ -293,6 +294,7 @@ appDecoder =
|
|||
|> andMap (Decode.succeed "")
|
||||
|> andMap (Decode.field "default_branch" Decode.string)
|
||||
|> andMap (Decode.maybe (Decode.field "website" Decode.string))
|
||||
|> andMap (Decode.maybe (Decode.field "description" Decode.string))
|
||||
|
||||
|
||||
appListDecoder : Decode.Decoder (List App)
|
||||
|
|
|
@ -4,7 +4,9 @@ import Html exposing (Html, button, div, h2, h5, img, text, ul, li, a, p, span,
|
|||
import Html.Attributes exposing (src, style, class, alt, href)
|
||||
import Html.Events exposing (onClick)
|
||||
import Http
|
||||
import Maybe exposing (withDefault)
|
||||
import Json.Decode as Decode
|
||||
import Json.Decode.Extra as Decode exposing (andMap)
|
||||
import Spa.Generated.Route as Route
|
||||
import Spa.Document exposing (Document)
|
||||
import Spa.Page as Page exposing (Page)
|
||||
|
@ -35,7 +37,9 @@ type alias App =
|
|||
, icon : Maybe String
|
||||
, status : Int
|
||||
, slug : String
|
||||
, default_branch : String
|
||||
, website : Maybe String
|
||||
, description : Maybe String
|
||||
}
|
||||
|
||||
|
||||
|
@ -99,20 +103,6 @@ body model =
|
|||
[ viewApps model
|
||||
]
|
||||
|
||||
appScore : App -> Int
|
||||
appScore app =
|
||||
case app.status of
|
||||
1 ->
|
||||
1
|
||||
2 ->
|
||||
2
|
||||
3 ->
|
||||
3
|
||||
4 ->
|
||||
4
|
||||
_ ->
|
||||
5
|
||||
|
||||
viewStatusBadge : App -> Html Msg
|
||||
viewStatusBadge app =
|
||||
let
|
||||
|
@ -173,6 +163,7 @@ viewApp app =
|
|||
, div [ class "card-body" ]
|
||||
[ h5 [ class "card-title" ]
|
||||
[ a [ href app_href ] [ text app.name ] ]
|
||||
, p [] [ text (withDefault "" app.description) ]
|
||||
, repository_link
|
||||
, website_link
|
||||
, a [ class "card-link", href app_href ]
|
||||
|
@ -205,7 +196,7 @@ viewApps model =
|
|||
div []
|
||||
[ div [ class "row" ]
|
||||
(List.map viewApp (apps |> List.sortWith
|
||||
(by appScore ASC
|
||||
(by .status ASC
|
||||
|> andThen .name ASC))
|
||||
)
|
||||
]
|
||||
|
@ -230,16 +221,17 @@ featuresDecoder =
|
|||
|
||||
appDecoder : Decode.Decoder App
|
||||
appDecoder =
|
||||
Decode.map8
|
||||
App
|
||||
(Decode.field "name" Decode.string)
|
||||
(Decode.field "category" Decode.string)
|
||||
(Decode.maybe (Decode.field "repository" Decode.string))
|
||||
(Decode.succeed Nothing)
|
||||
(Decode.maybe (Decode.field "icon" Decode.string))
|
||||
(Decode.at [ "features" ] featuresDecoder)
|
||||
(Decode.succeed "")
|
||||
(Decode.maybe (Decode.field "website" Decode.string))
|
||||
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.maybe (Decode.field "icon" Decode.string))
|
||||
|> andMap (Decode.at [ "features" ] featuresDecoder)
|
||||
|> andMap (Decode.succeed "")
|
||||
|> andMap (Decode.field "default_branch" Decode.string)
|
||||
|> andMap (Decode.maybe (Decode.field "website" Decode.string))
|
||||
|> andMap (Decode.maybe (Decode.field "description" Decode.string))
|
||||
|
||||
|
||||
appListDecoder : Decode.Decoder (List App)
|
||||
|
|
Loading…
Reference in New Issue