Enabling the addition of comments with file attachments
In this section, we want to allow to add as many additional file attachments to a comment as the user wants. We start by enhancing our TicketComments
component UI first by adding some logic to be able to choose files within a comment. Then, we will continue with the Supabase-related flow, which will look as follows:
- We upload the files to the storage, if there are any, and wait for the upload to finish. This will require us to set up proper Storage RLS policies.
- Then, we insert the comment into the database.
- After that, we connect the entry in the comments table with the uploaded file for them to be related technically.
- Finally, we ensure that the uploaded files are shown in the UI along with the comment text.
Let’s get started.
Preparing the UI with file upload possibility
Open TicketComment.js
and find <textarea />
. Then, right below the textarea
field, add a new input
field for...