Skip to content

Commit

Permalink
use full name for filtered repos (#122)
Browse files Browse the repository at this point in the history
  • Loading branch information
plyr4 authored Feb 21, 2020
1 parent 7c6da0b commit 105fb10
Showing 1 changed file with 12 additions and 5 deletions.
17 changes: 12 additions & 5 deletions src/elm/Pages/Home.elm
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ viewFilteredFavorites favorites filter toggleFavorite =
-- Render the found repositories
if not <| List.isEmpty filteredRepos then
filteredRepos
|> List.map (viewFavorite favorites toggleFavorite)
|> List.map (viewFavorite favorites toggleFavorite True)

else
-- No repos matched the search
Expand Down Expand Up @@ -166,22 +166,29 @@ viewOrg org toggleFavorite favorites =
[ text org
, FeatherIcons.chevronDown |> FeatherIcons.withSize 20 |> FeatherIcons.withClass "details-icon-expand" |> FeatherIcons.toHtml []
]
:: List.map (viewFavorite favorites toggleFavorite) favorites
:: List.map (viewFavorite favorites toggleFavorite False) favorites
)


{-| viewFavorite : takes favorites and favorite action and renders single favorite
-}
viewFavorite : Favorites -> ToggleFavorite msg -> String -> Html msg
viewFavorite favorites toggleFavorite favorite =
viewFavorite : Favorites -> ToggleFavorite msg -> Bool -> String -> Html msg
viewFavorite favorites toggleFavorite filtered favorite =
let
( org, repo ) =
( Maybe.withDefault "" <| List.Extra.getAt 0 <| String.split "/" favorite
, Maybe.withDefault "" <| List.Extra.getAt 1 <| String.split "/" favorite
)

name =
if filtered then
favorite

else
repo
in
div [ class "item", Util.testAttribute "repo-item" ]
[ div [] [ text repo ]
[ div [] [ text name ]
, div [ class "buttons" ]
[ starToggle org repo toggleFavorite <| List.member favorite favorites
, a
Expand Down

0 comments on commit 105fb10

Please sign in to comment.