frontend: reset from and buckets when changing pages (#595)

Co-authored-by: Rok Garbas <rok@garbas.si>
This commit is contained in:
Naïm Favier 2023-01-27 18:49:55 +01:00 committed by GitHub
parent 25e8dbdb94
commit a7ac1d8e8c
Failed to generate hash of commit

View file

@ -413,27 +413,28 @@ view model =
viewNavigation : Route.Route -> List (Html Msg)
viewNavigation route =
let
toRoute f =
case route of
-- Preserve arguments
Route.Packages searchArgs ->
f searchArgs
-- Preserve most arguments
searchArgs =
(\args -> { args | from = Nothing, buckets = Nothing }) <|
case route of
Route.Packages args ->
args
Route.Options searchArgs ->
f searchArgs
Route.Options args ->
args
Route.Flakes searchArgs ->
f searchArgs
Route.Flakes args ->
args
_ ->
f <| Route.SearchArgs Nothing Nothing Nothing Nothing Nothing Nothing Nothing Nothing
_ ->
Route.SearchArgs Nothing Nothing Nothing Nothing Nothing Nothing Nothing Nothing
in
li [] [ a [ href "https://nixos.org" ] [ text "Back to nixos.org" ] ]
:: List.map
(viewNavigationItem route)
[ ( toRoute Route.Packages, text "Packages" )
, ( toRoute Route.Options, text "Options" )
, ( toRoute Route.Flakes, span [] [ text "Flakes", sup [] [ span [ class "label label-info" ] [ small [] [ text "Experimental" ] ] ] ] )
[ ( Route.Packages searchArgs, text "Packages" )
, ( Route.Options searchArgs, text "Options" )
, ( Route.Flakes searchArgs, span [] [ text "Flakes", sup [] [ span [ class "label label-info" ] [ small [] [ text "Experimental" ] ] ] ] )
]