Skip to content

Commit 8f59405

Browse files
authored
feat(Search.elm): suggest to search nixpkgs when no pkg is found (#922)
When an user searches for a package not already merged it won't be found. Let's suggest them to check for open issues on nixpkgs. - Added a link to `github:nixpkgs?q=PACKAGE`
1 parent 24a10f2 commit 8f59405

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

frontend/src/Search.elm

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -819,7 +819,7 @@ viewResult nixosChannels outMsg toRoute categoryName model viewSuccess viewBucke
819819
if result.hits.total.value == 0 && List.length buckets == 0 then
820820
div [ class "search-results" ]
821821
[ ul [ class "search-sidebar" ] searchBuckets
822-
, viewNoResults categoryName
822+
, viewNoResults categoryName (Maybe.withDefault "" model.query)
823823
]
824824

825825
else if List.length buckets > 0 then
@@ -866,12 +866,15 @@ viewResult nixosChannels outMsg toRoute categoryName model viewSuccess viewBucke
866866

867867
viewNoResults :
868868
String
869+
-> String
869870
-> Html c
870-
viewNoResults categoryName =
871+
viewNoResults categoryName query =
871872
div [ class "search-no-results" ]
872873
[ h2 [] [ text <| "No " ++ categoryName ++ " found!" ]
873874
, text "You might want to "
874875
, Html.a [ href "https://github.com/NixOS/nixpkgs/blob/master/pkgs/README.md#quick-start-to-adding-a-package" ] [ text "add a package" ]
876+
, text " or "
877+
, Html.a [ href ("https://github.com/NixOS/nixpkgs/issues?q=" ++ query) ] [ text "search nixpkgs issues" ]
875878
, text "."
876879
]
877880

0 commit comments

Comments
 (0)