Add display to errors.

This commit is contained in:
2018-12-23 00:23:48 -08:00
parent 50701e1885
commit c08ef14832
4 changed files with 41 additions and 3 deletions

View File

@@ -93,6 +93,10 @@ update msg model = case msg of
SendImageResponse _ -> (model, Cmd.none)
SendFileResponse _ -> (model, Cmd.none)
ReceiveMarkdown md -> updateMarkdown model md
DismissError i -> updateDismissError model i
updateDismissError : Model -> Int -> (Model, Cmd Msg)
updateDismissError m i = ({ m | errors = (List.take i m.errors) ++ (List.drop (i+1) m.errors)}, Cmd.none)
updateMarkdown : Model -> MarkdownResponse -> (Model, Cmd Msg)
updateMarkdown m { roomId, text, markdown } =

View File

@@ -63,6 +63,7 @@ type Msg =
| SendImageResponse (Result Http.Error ())
| SendFileResponse (Result Http.Error ())
| ReceiveMarkdown MarkdownResponse
| DismissError Int
displayName : Model -> Username -> String
displayName m s = Maybe.withDefault (senderName s) <| Maybe.andThen .displayName <| Dict.get s m.userData

View File

@@ -50,10 +50,10 @@ viewFull model =
[ errorList ] ++ [ core ]
errorsView : List String -> Html Msg
errorsView = div [] << List.map errorView
errorsView = div [ class "errors-wrapper" ] << List.indexedMap errorView
errorView : String -> Html Msg
errorView s = div [] [ text s ]
errorView : Int -> String -> Html Msg
errorView i s = div [ class "error-wrapper", onClick <| DismissError i ] [ iconView "alert-triangle", text s ]
baseView : Model -> Maybe (String, JoinedRoom) -> Html Msg
baseView m jr =