module View.Header ( renderHeader ) where import Signal exposing (Address) import Dict import Route exposing (..) import Html exposing (..) import Html.Attributes exposing (..) import Html.Events exposing (..) import Model exposing (Model) import Model.Translations exposing (getMessage) import Action exposing (..) import Model.View exposing (..) import View.Icon exposing (renderIcon) 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 "" ]