subtree(users/wpcarro): docking briefcase at '24f5a642'
git-subtree-dir: users/wpcarro git-subtree-mainline:464bbcb15cgit-subtree-split:24f5a642afChange-Id: I6105b3762b79126b3488359c95978cadb3efa789
This commit is contained in:
commit
019f8fd211
766 changed files with 175420 additions and 0 deletions
37
users/wpcarro/assessments/tt/client/src/Common.elm
Normal file
37
users/wpcarro/assessments/tt/client/src/Common.elm
Normal file
|
|
@ -0,0 +1,37 @@
|
|||
module Common exposing (..)
|
||||
|
||||
import Html exposing (..)
|
||||
import Maybe.Extra as ME
|
||||
import State
|
||||
import UI
|
||||
import Utils
|
||||
|
||||
|
||||
allErrors : State.Model -> Html State.Msg
|
||||
allErrors model =
|
||||
div []
|
||||
(State.allErrors
|
||||
model
|
||||
|> List.map
|
||||
(\( mError, title ) ->
|
||||
case mError of
|
||||
Nothing ->
|
||||
text ""
|
||||
|
||||
Just err ->
|
||||
UI.errorBanner
|
||||
{ title = title
|
||||
, body = Utils.explainHttpError err
|
||||
}
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
withSession : State.Model -> (State.Session -> Html State.Msg) -> Html State.Msg
|
||||
withSession model renderWithSession =
|
||||
case model.session of
|
||||
Nothing ->
|
||||
div [] [ UI.paragraph "You need a valid session to view this page. Please attempt to log in." ]
|
||||
|
||||
Just session ->
|
||||
renderWithSession session
|
||||
Loading…
Add table
Add a link
Reference in a new issue