1
0
mirror of https://github.com/jhillyerd/inbucket.git synced 2025-12-20 11:07:01 +00:00

ui: Refactor page view/framing to handle titles

This commit is contained in:
James Hillyerd
2018-11-18 10:37:57 -08:00
parent 59062e1326
commit eaf41949d4
7 changed files with 112 additions and 120 deletions

View File

@@ -32,12 +32,7 @@ type alias Model =
init : ( Model, Cmd Msg )
init =
( Model False []
, Cmd.batch
[ Ports.windowTitle "Inbucket Monitor"
, Ports.monitorCommand True
]
)
( Model False [], Ports.monitorCommand True )
@@ -95,32 +90,35 @@ update session msg model =
-- VIEW
view : Session -> Model -> Html Msg
view : Session -> Model -> { title : String, content : Html Msg }
view session model =
div [ id "page" ]
[ h1 [] [ text "Monitor" ]
, p []
[ text "Messages will be listed here shortly after delivery. "
, em []
[ text
(if model.connected then
"Connected."
{ title = "Inbucket Monitor"
, content =
div [ id "page" ]
[ h1 [] [ text "Monitor" ]
, p []
[ text "Messages will be listed here shortly after delivery. "
, em []
[ text
(if model.connected then
"Connected."
else
"Disconnected!"
)
else
"Disconnected!"
)
]
]
, table [ id "monitor" ]
[ thead []
[ th [] [ text "Date" ]
, th [ class "desktop" ] [ text "From" ]
, th [] [ text "Mailbox" ]
, th [] [ text "Subject" ]
]
, tbody [] (List.map viewMessage model.messages)
]
]
, table [ id "monitor" ]
[ thead []
[ th [] [ text "Date" ]
, th [ class "desktop" ] [ text "From" ]
, th [] [ text "Mailbox" ]
, th [] [ text "Subject" ]
]
, tbody [] (List.map viewMessage model.messages)
]
]
}
viewMessage : MessageHeader -> Html Msg