Fix title of the app before it loads (#97)

and improve window title per page

fixes #93
This commit is contained in:
Rok Garbas 2020-06-12 12:20:28 +02:00 committed by GitHub
parent 9f3de349e8
commit 2daa4b0d8b
Failed to generate hash of commit
2 changed files with 47 additions and 30 deletions

View file

@ -252,9 +252,28 @@ update msg model =
-- VIEW -- VIEW
view : Model -> Html Msg view :
Model
->
{ title : String
, body : List (Html Msg)
}
view model = view model =
div [] let
title =
case model.page of
Packages _ ->
"NixOS Search - Packages"
Options _ ->
"NixOS Search - Options"
_ ->
"NixOS Search"
in
{ title = title
, body =
[ div []
[ header [] [ header []
[ div [ class "navbar navbar-static-top" ] [ div [ class "navbar navbar-static-top" ]
[ div [ class "navbar-inner" ] [ div [ class "navbar-inner" ]
@ -285,6 +304,8 @@ view model =
] ]
] ]
] ]
]
}
viewNavigation : Page -> Url.Url -> List (Html Msg) viewNavigation : Page -> Url.Url -> List (Html Msg)
@ -367,9 +388,5 @@ main =
, onUrlChange = ChangedUrl , onUrlChange = ChangedUrl
, subscriptions = subscriptions , subscriptions = subscriptions
, update = update , update = update
, view = , view = view
\m ->
{ title = "NixOS Search"
, body = [ view m ]
}
} }

View file

@ -4,7 +4,7 @@
<head> <head>
<meta charset="utf-8" /> <meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1"> <meta name="viewport" content="width=device-width, initial-scale=1">
<title>Elm hotloading dev environment</title> <title>NixOS Search - Loading...</title>
<script type="text/javascript" src="https://nixos.org/js/jquery.min.js"></script> <script type="text/javascript" src="https://nixos.org/js/jquery.min.js"></script>