Reinstate score badges, fix sorting
continuous-integration/drone/pr Build is failing
Details
continuous-integration/drone/pr Build is failing
Details
This commit is contained in:
parent
65ef1d2772
commit
d8b2192240
|
@ -46,6 +46,7 @@ i.fas, i.fab {
|
|||
.app-category {
|
||||
background-color: var(--light-blue);
|
||||
color: var(--white);
|
||||
margin-left: 0.5rem;
|
||||
}
|
||||
|
||||
.card-description {
|
||||
|
|
|
@ -39,7 +39,7 @@ type alias App =
|
|||
, repository : Maybe String
|
||||
, versions : Maybe (List String)
|
||||
, icon : Maybe String
|
||||
, status : String
|
||||
, status : Int
|
||||
, slug : String
|
||||
, default_branch : String
|
||||
, website : Maybe String
|
||||
|
@ -192,23 +192,23 @@ viewStatusBadge app =
|
|||
let
|
||||
status_class =
|
||||
case app.status of
|
||||
"1" ->
|
||||
5 ->
|
||||
"badge-success"
|
||||
|
||||
"2" ->
|
||||
4 ->
|
||||
"badge-info"
|
||||
|
||||
"3" ->
|
||||
3 ->
|
||||
"badge-warning"
|
||||
|
||||
"4" ->
|
||||
2 ->
|
||||
"badge-danger"
|
||||
|
||||
_ ->
|
||||
"badge-dark"
|
||||
in
|
||||
span [ class ("card-link badge " ++ status_class) ]
|
||||
[ text ("Score: " ++ app.status) ]
|
||||
[ text ("Score: " ++ String.fromInt app.status) ]
|
||||
|
||||
|
||||
viewApp : App -> String -> Html Msg
|
||||
|
@ -309,12 +309,10 @@ loadREADME app =
|
|||
}
|
||||
|
||||
|
||||
featuresDecoder : Decode.Decoder String
|
||||
featuresDecoder =
|
||||
-- get features.status if it's there
|
||||
Decode.oneOf
|
||||
[ Decode.at [ "status" ] Decode.string
|
||||
, Decode.succeed ""
|
||||
[ Decode.at [ "status" ] Decode.int
|
||||
, Decode.succeed 5
|
||||
]
|
||||
|
||||
|
||||
|
|
|
@ -114,7 +114,7 @@ filterAppsScore apps score =
|
|||
case score of
|
||||
Just s ->
|
||||
List.filter (\app ->
|
||||
app.status <= s
|
||||
app.status >= s
|
||||
) apps
|
||||
Nothing ->
|
||||
apps
|
||||
|
@ -231,23 +231,23 @@ viewStatusBadge app =
|
|||
let
|
||||
status_class =
|
||||
case app.status of
|
||||
1 ->
|
||||
5 ->
|
||||
"badge-success"
|
||||
|
||||
2 ->
|
||||
4 ->
|
||||
"badge-info"
|
||||
|
||||
3 ->
|
||||
"badge-warning"
|
||||
|
||||
4 ->
|
||||
2 ->
|
||||
"badge-danger"
|
||||
|
||||
_ ->
|
||||
"badge-dark"
|
||||
in
|
||||
span [ class ("card-link badge " ++ status_class) ]
|
||||
[ text ("Score: " ++ String.fromInt app.status) ]
|
||||
[ text ("Status: " ++ String.fromInt app.status) ]
|
||||
|
||||
|
||||
viewApp : App -> Html Msg
|
||||
|
@ -303,7 +303,7 @@ viewApp app =
|
|||
, p [ class "card-description" ] [ text (ellipsis 100 (withDefault "" app.description)) ]
|
||||
]
|
||||
, div [ class "footer" ]
|
||||
[ span [ class "badge app-category" ] [ text app.category ]]
|
||||
[ viewStatusBadge app, span [ class "badge app-category" ] [ text app.category ]]
|
||||
]
|
||||
]
|
||||
|
||||
|
@ -349,10 +349,11 @@ viewApps model =
|
|||
, label [ for "level" ] [ text " and show only items that have at least " ]
|
||||
, select [ class "search-dropdown", id "level", onInput FilterScore ] [
|
||||
option [ ] [ text "any" ]
|
||||
, option [ value "1" ] [ text "1 (production)" ]
|
||||
, option [ value "2" ] [ text "2 (beta)" ]
|
||||
, option [ value "5" ] [ text "5 (production)" ]
|
||||
, option [ value "4" ] [ text "4 (beta)" ]
|
||||
, option [ value "3" ] [ text "3 (alpha)" ]
|
||||
, option [ value "4" ] [ text "4 (pre-alpha)" ]
|
||||
, option [ value "2" ] [ text "2 (pre-alpha)" ]
|
||||
, option [ value "1" ] [ text "1 (work-in-progress)" ]
|
||||
]
|
||||
, text "builds "
|
||||
]
|
||||
|
@ -364,7 +365,7 @@ viewApps model =
|
|||
(List.map viewApp
|
||||
(model.results
|
||||
|> List.sortWith
|
||||
(by .status ASC
|
||||
(by .status DESC
|
||||
|> andThen (String.toLower << .name) ASC
|
||||
)
|
||||
)
|
||||
|
|
Loading…
Reference in New Issue