Project-Chirp / chirp-frontend

Frontend of Chirp
2 stars 3 forks source link

T13: Direct message #54

Closed Dennull closed 1 year ago

Dennull commented 1 year ago

This PR closes #13 and adds the direct messaging to the app. Users can now send messages to other users in a one on one chat. Messages are saved in the database and get displayed in the chat once users click on one of their conversations. Live messaging hasn't been implemented in this MVP, so users have to refresh their page to get their latest messages for now

A new route, /messages/user1/user2, was added to display the direct message page. This route fetches for and displays the direct message history between user1 and user2, whereas the /messages route shows the conversation list with a prompt to select a new message, same as before

Additionally, messagesSlice.ts is a new Redux slice created to cache the list of conversations users have and the currently selected conversation