aboutsummaryrefslogtreecommitdiff
path: root/src/client/elm/View
diff options
context:
space:
mode:
Diffstat (limited to 'src/client/elm/View')
-rw-r--r--src/client/elm/View/Header.elm53
1 files changed, 28 insertions, 25 deletions
diff --git a/src/client/elm/View/Header.elm b/src/client/elm/View/Header.elm
index fb0e880..7a6fefc 100644
--- a/src/client/elm/View/Header.elm
+++ b/src/client/elm/View/Header.elm
@@ -21,28 +21,31 @@ import View.Click exposing (clickTo)
renderHeader : Address Action -> Model -> Html
renderHeader address model =
- header
- []
- [ a
- ( [ class "title" ] ++ clickTo Home)
- [ text (getMessage "SharedCost" model.translations) ]
- , case model.view of
- LoggedInView { me, users } ->
- div
- [ class "signedPanel" ]
- [ a
- ( [ class "user" ] ++ clickTo User)
- [ Dict.get me users
- |> Maybe.map .name
- |> Maybe.withDefault ""
- |> text
- ]
- , button
- [ class "icon"
- , onClick address SignOut
- ]
- [ renderIcon "power-off" ]
- ]
- _ ->
- text ""
- ]
+ let item route name additionalClasses =
+ a
+ ([ class ("item " ++ additionalClasses) ] ++ clickTo route)
+ [ text (getMessage name model.translations) ]
+ in
+ header
+ []
+ ( [item Home "SharedCost" "title"] ++
+ case model.view of
+ LoggedInView { me, users } ->
+ [ item Income "Income" ""
+ , item Stat "Statistics" ""
+ , button
+ [ class "signOut item"
+ , onClick address SignOut
+ ]
+ [ renderIcon "power-off" ]
+ , div
+ [ class "name" ]
+ [ Dict.get me users
+ |> Maybe.map .name
+ |> Maybe.withDefault ""
+ |> text
+ ]
+ ]
+ _ ->
+ []
+ )