Skip to content

Commit

Permalink
frontend: Show current nixpkgs commit
Browse files Browse the repository at this point in the history
  • Loading branch information
dasJ committed Jun 10, 2024
1 parent cf2fd8e commit d7f61e9
Showing 1 changed file with 42 additions and 24 deletions.
66 changes: 42 additions & 24 deletions frontend/src/Search.elm
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ module Search exposing
, viewSearchInput
)

import Array
import Base64
import Browser.Dom
import Browser.Navigation
Expand All @@ -39,6 +40,7 @@ import Html
( Html
, a
, button
, code
, div
, form
, h1
Expand Down Expand Up @@ -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
]
Expand Down

0 comments on commit d7f61e9

Please sign in to comment.