Add file buttons and messages (currently do nothing)
This commit is contained in:
@@ -80,6 +80,10 @@ update msg model = case msg of
|
||||
TypingTick _ -> updateTypingTick model
|
||||
History r -> updateHistory model r
|
||||
ReceiveHistoryResponse r hr -> updateHistoryResponse model r hr
|
||||
SendImages rid -> (model, Cmd.none)
|
||||
SendFiles rid -> (model, Cmd.none)
|
||||
ImagesSelected rid f fs -> (model, Cmd.none)
|
||||
FilesSelected rid f fs -> (model, Cmd.none)
|
||||
|
||||
updateHistoryResponse : Model -> RoomId -> Result Http.Error HistoryResponse -> (Model, Cmd Msg)
|
||||
updateHistoryResponse m r hr =
|
||||
|
||||
@@ -10,6 +10,7 @@ import Browser.Dom exposing (Viewport)
|
||||
import Url.Builder
|
||||
import Dict exposing (Dict)
|
||||
import Time exposing (Posix)
|
||||
import File exposing (File)
|
||||
import Json.Decode
|
||||
import Browser
|
||||
import Http
|
||||
@@ -52,6 +53,10 @@ type Msg =
|
||||
| TypingTick Posix -- Tick for updating the typing status
|
||||
| History RoomId -- Load history for a room
|
||||
| ReceiveHistoryResponse RoomId (Result Http.Error HistoryResponse) -- HTTP, receive history
|
||||
| SendImages RoomId
|
||||
| SendFiles RoomId
|
||||
| ImagesSelected RoomId File (List File)
|
||||
| FilesSelected RoomId File (List File)
|
||||
|
||||
displayName : Model -> Username -> String
|
||||
displayName m s = Maybe.withDefault (senderName s) <| Maybe.andThen .displayName <| Dict.get s m.userData
|
||||
|
||||
@@ -129,6 +129,8 @@ joinedRoomView m roomId jr =
|
||||
, onEnterKey <| SendRoomText roomId
|
||||
, value <| Maybe.withDefault "" <| Dict.get roomId m.roomText
|
||||
] []
|
||||
, button [ onClick <| SendFiles roomId ] [ iconView "file" ]
|
||||
, button [ onClick <| SendImages roomId ] [ iconView "image" ]
|
||||
, button [ onClick <| SendRoomText roomId ] [ iconView "send" ]
|
||||
]
|
||||
in
|
||||
|
||||
Reference in New Issue
Block a user