4 Commits

Author SHA1 Message Date
Rankin Zheng
8258d7e01a Implement delete message functionality
- Added a new `deleteMessage` function in `chatSlice.ts` to handle message deletion.
- Modified `MessageContainer.tsx` and `MessageHeader.tsx` to pass the entire message item instead of individual properties.
- Updated the `showDelete` prop in `MessageContainer.tsx` to only show the delete icon for the second last message.
- Dispatch the `deleteMessage` action when the delete icon is clicked in `MessageHeader.tsx`.
- Updated the message structure in `chatSlice.ts` to include `date` and `hash` properties.
- Added a case for `deleteMessage.fulfilled` in `chatSlice.ts` to remove the deleted message from the state.
2023-07-17 21:07:42 +08:00
Rankin Zheng
21fb29f72c Add delete icon to MessageHeader component
- Imported IconTrash from "@tabler/icons-react" in MessageHeader.tsx.
- Added a new prop 'showDelete' to the MessageHeader component with a default value of true.
- Added a new Tooltip for the delete icon with the label "Delete message".
- The delete icon is conditionally rendered based on the 'showDelete' prop.
2023-07-17 20:31:01 +08:00
Rankin Zheng
90d0064e15 Add edit message functionality to MessageHeader
- Imported SimpleGrid and IconEdit from respective libraries in MessageHeader.tsx.
- Added a new prop 'showEdit' to MessageHeader component to conditionally show the edit icon.
- Wrapped the refill prompt and edit message icons in a Flex container for better alignment.
- Added a Tooltip and ActionIcon for the edit message functionality.
2023-07-17 20:31:01 +08:00
Rankin Zheng
ac1d9705ec Refactor MessageHeader into a separate component
- Extracted MessageHeader from MessageContainer.tsx into its own file MessageHeader.tsx.
- Removed unused imports from MessageContainer.tsx.
- Added necessary imports to MessageHeader.tsx.
- Updated MessageContainer.tsx to import MessageHeader from the new file.
2023-07-17 20:31:01 +08:00