mi/sina/src/Page/Index.elm

59 lines
2.0 KiB
Elm
Raw Normal View History

2020-11-16 03:09:53 +00:00
module Page.Index exposing (view)
import Browser exposing (Document)
2020-11-16 15:10:57 +00:00
import Html exposing (br, h2, img, p, s, span, text)
import Html.Attributes exposing (height, src, width)
import Iso8601
2020-11-16 03:09:53 +00:00
import Layout exposing (basic, template)
import Model exposing (Model)
view : Model -> Document msg
2020-11-16 15:10:57 +00:00
view { tokenData, front } =
2020-11-16 03:09:53 +00:00
case tokenData of
Nothing ->
basic "Login Required" []
Just data ->
template "Mi"
2020-11-16 15:10:57 +00:00
([ h2 [] [ text "Token Info" ]
, p
2020-11-16 03:09:53 +00:00
[]
[ span
[]
[ text "Subscriber: "
, text data.sub
, br [] []
, text "Token ID: "
, text data.jti
, br [] []
, text "Issuer: "
, text data.iss
]
]
2020-11-16 15:10:57 +00:00
]
++ (case front of
Just front_data ->
[ h2 [] [ text "Current Front" ]
, span
[]
[ text "Name: "
, text front_data.who
, br [] []
, text "Started At: "
, text <| Iso8601.fromTime front_data.started_at
, br [] []
, img
[ src front_data.img_url
, width 64
, height 64
]
[]
]
]
Nothing ->
[]
)
)