frontend: show query in title (#662)

Fixes https://github.com/NixOS/nixos-search/issues/661
This commit is contained in:
Naïm Favier 2023-06-11 13:02:41 +02:00 committed by GitHub
parent 7ef651230b
commit c98b1e3685
Failed to generate hash of commit

View file

@ -343,16 +343,32 @@ view :
} }
view model = view model =
let let
maybeQuery m =
case m.query of
Nothing ->
""
Just q ->
" - " ++ q
maybeFlakeQuery m =
case m of
OptionModel m_ ->
maybeQuery m_
PackagesModel m_ ->
maybeQuery m_
title = title =
case model.page of case model.page of
Packages _ -> Packages m ->
"NixOS Search - Packages" "NixOS Search - Packages" ++ maybeQuery m
Options _ -> Options m ->
"NixOS Search - Options" "NixOS Search - Options" ++ maybeQuery m
Flakes _ -> Flakes m ->
"NixOS Search - Flakes (Experimental)" "NixOS Search - Flakes (Experimental)" ++ maybeFlakeQuery m
_ -> _ ->
"NixOS Search" "NixOS Search"