diff --git a/frontend/src/Search.elm b/frontend/src/Search.elm index 2fa91124..85e4ea78 100644 --- a/frontend/src/Search.elm +++ b/frontend/src/Search.elm @@ -31,6 +31,7 @@ module Search exposing , viewSearchInput ) +import Array import Base64 import Browser.Dom import Browser.Navigation @@ -39,6 +40,7 @@ import Html ( Html , a , button + , code , div , form , h1 @@ -1039,33 +1041,49 @@ viewResults nixosChannels model result viewSuccess _ outMsg categoryName = total = String.fromInt result.hits.total.value + in [ div [] - [ Html.map outMsg <| viewSortSelection model - , h2 [] - (List.append - [ text "Showing results " - , text from - , text "-" - , text to - , text " of " - ] - (if result.hits.total.value == 10000 then - [ text "more than 10000." - , p [] [ text "Please provide more precise search terms." ] - ] - - else - [ strong [] - [ text total - , text " " - , text categoryName - ] + (List.append + [ Html.map outMsg <| viewSortSelection model + , h2 [] + (List.append + [ text "Showing results " + , text from + , text "-" + , text to + , text " of " + ] + (if result.hits.total.value == 10000 then + [ text "more than 10000." + , p [] [ text "Please provide more precise search terms." ] + ] + + else + [ strong [] + [ text total + , text " " + , text categoryName + ] + , text "." + ] + ) + ) + ] + (case List.head result.hits.hits of + Nothing -> [] + Just elem -> + case Array.get 3 (Array.fromList (String.split "-" elem.index)) of + Nothing -> [] + Just commit -> + [ + text "Data from nixpkgs " + , a [ href ("https://github.com/NixOS/nixpkgs/commit/" ++ commit) ] + [ (code [] [ text (String.slice 0 12 commit) ]) ] , text "." - ] - ) - ) - ] + ] + ) + ) , viewSuccess nixosChannels model.channel model.showInstallDetails model.show result.hits.hits , Html.map outMsg <| viewPager model result.hits.total.value ]