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