group-income icon indicating copy to clipboard operation
group-income copied to clipboard

File attachments in chat

Open leihla opened this issue 1 year ago • 6 comments

Problem

We need a simple UI for uploading file attachments and displaying them.

Solution

I've designed two flows for send picture attachment or file attachments. Users should be able to attach a file either by clicking on the attachment icon on the message bar or dragging and dropping an attachment in the chat area.

Send Image https://www.figma.com/file/mxGadAHfkWH6qApebQvcdN/Group-Income-2.0?type=design&node-id=26191%3A296507&t=teMy1XvN3V9PR9oY-1

Screenshot 2023-06-05 at 16 12 43 Screenshot 2023-06-05 at 16 12 50 Screenshot 2023-06-05 at 16 12 57

Send Attachment https://www.figma.com/file/mxGadAHfkWH6qApebQvcdN/Group-Income-2.0?type=design&node-id=26191%3A301188&t=teMy1XvN3V9PR9oY-1

Screenshot 2023-06-05 at 16 13 31

Related to #1557

leihla avatar Jun 05 '23 15:06 leihla

Dev TODO List

Part 1. UI components that don't involve changing chatroom.js contracts

  • [x] Task 1-1. Load and preview image attachment Load image from the file-system and display the preview of the image and make it removable via 'x' button at the corner.
  • [x] Task 1-2. Load and preview non-image type attachment Extend the Task 1-1 to non-image type attachments.
  • [x] Task 1-3. Implement file-size detection and build 'File too large' modal
  • [x] Task 1-4. Implement task 1-1, 1-2, 1-3 by drag&drop action

Part 2. UI components that involve changing chatroom.js contracts

  • [ ] Task 2-1. Implement 'Send a message with image attachment' Implement 'file attachment' in chatroom.js contracts and also update Message.vue component with image-preview element.
  • [ ] Task 2-2. Implement 'Send a message with non-image type attachment' Implement 'file attachment' in chatroom.js contracts and also update Message.vue component with the file preview element.
  • [ ] Task 2-3. Implement 'Download the attachment' Add the download button to Message.vue component and make it possible to download the attached file.

SebinSong avatar Aug 07 '23 07:08 SebinSong

I'm going to develop this feature step by step according to the Todo list created above. cc. @taoeffect

SebinSong avatar Aug 07 '23 07:08 SebinSong

@taoeffect I've got a question regarding this modal below. It looks to me that this modal having two buttons is unnecessary as they both are supposed to result in the same action, which is 'Closing the modal and discard the file the user has selected.' Do you agree we can remove the 'Cancel' button here?

SebinSong avatar Aug 09 '23 03:08 SebinSong

@SebinSong Yep, agreed! 👍

taoeffect avatar Aug 09 '23 03:08 taoeffect

@taoeffect I think all Task - 1 items are complete and ready for sending a PR. As described in the todo details, implementing the functionality in the chatroom.js is better to be done after E2E encryption work is complete in the backend. So for now, when the Send button is clicked with a file attached,

I've made it so that it results in this appended text message saying the attached file name and the feature will be prepared in the future.

Does this sound good to you? If it does, I can put the work together and send a PR.

SebinSong avatar Aug 18 '23 00:08 SebinSong

@SebinSong yeah, sending a message that just has that text sounds good 👍 Hopefully this doesn't require modifying chatroom.js at all

taoeffect avatar Aug 18 '23 00:08 taoeffect

Pretty sure this has been closed.

taoeffect avatar May 25 '24 23:05 taoeffect