diff --git a/elm.json b/elm.json index e16e94e..5e7c3b3 100644 --- a/elm.json +++ b/elm.json @@ -9,6 +9,7 @@ "NoRedInk/elm-json-decode-pipeline": "1.0.0", "elm/browser": "1.0.1", "elm/core": "1.0.2", + "elm/file": "1.0.1", "elm/html": "1.0.0", "elm/http": "2.0.0", "elm/json": "1.1.2", @@ -18,7 +19,6 @@ }, "indirect": { "elm/bytes": "1.0.7", - "elm/file": "1.0.1", "elm/virtual-dom": "1.0.2" } }, diff --git a/src/Main.elm b/src/Main.elm index 11c01eb..1f41bd2 100644 --- a/src/Main.elm +++ b/src/Main.elm @@ -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 = diff --git a/src/Scylla/Model.elm b/src/Scylla/Model.elm index 4480e24..2217b2b 100644 --- a/src/Scylla/Model.elm +++ b/src/Scylla/Model.elm @@ -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 diff --git a/src/Scylla/Views.elm b/src/Scylla/Views.elm index df46831..2649ca9 100644 --- a/src/Scylla/Views.elm +++ b/src/Scylla/Views.elm @@ -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