mirror of
https://gitcode.com/GitHub_Trending/ji/jitsi-meet.git
synced 2025-12-30 11:22:31 +00:00
- Change "features/chat" to support listening for new chat messages and storing them, removing that logic from conference.js. - Combine chat.scss and side_toolbar_container.css, and remove unused scss files. Chat is the only side panel so the two concepts have been merged. - Remove direct access to the chat feature from non-react and non-redux flows. - Modify the i18n translate function to take in an options object. By default the option "wait" is set to true, but that causes components to mount after the parent has been notified of an update, which means autoscrolling down to the latest rendered messages does not work. With "wait" set to false, the children will mount and then the parent will trigger componentDidUpdate. - Create react components for chat. Chat is the side panel plus the entiren chat feature. ChatInput is a child of Chat and is used for composing messages. ChatMessage displays one message and extends PureComponent to limit re-renders. - Fix a bug where the toolbar was not showing automatically when chat is closed and a new message is received. - Import react-transition-group to time the animation of the side panel showing/hiding and unmounting the Chat component. This gets around the issue of having to control autofocus if the component were always mounted and visibility toggled, but introduces not being able to store previous scroll state (without additional work or re-work).
62 lines
1.5 KiB
JavaScript
62 lines
1.5 KiB
JavaScript
import { ADD_MESSAGE, SEND_MESSAGE, TOGGLE_CHAT } from './actionTypes';
|
|
|
|
/* eslint-disable max-params */
|
|
|
|
/**
|
|
* Adds a chat message to the collection of messages.
|
|
*
|
|
* @param {Object} messageDetails - The chat message to save.
|
|
* @param {string} messageDetails.displayName - The displayName of the
|
|
* participant that authored the message.
|
|
* @param {boolean} messageDetails.hasRead - Whether or not to immediately mark
|
|
* the message as read.
|
|
* @param {string} messageDetails.message - The received message to display.
|
|
* @param {string} messageDetails.messageType - The kind of message, such as
|
|
* "error" or "local" or "remote".
|
|
* @param {string} messageDetails.timestamp - A timestamp to display for when
|
|
* the message was received.
|
|
* @returns {{
|
|
* type: ADD_MESSAGE,
|
|
* displayName: string,
|
|
* hasRead: boolean,
|
|
* message: string,
|
|
* messageType: string,
|
|
* timestamp: string,
|
|
* }}
|
|
*/
|
|
export function addMessage(messageDetails) {
|
|
return {
|
|
type: ADD_MESSAGE,
|
|
...messageDetails
|
|
};
|
|
}
|
|
|
|
/**
|
|
* Sends a chat message to everyone in the conference.
|
|
*
|
|
* @param {string} message - The chat message to send out.
|
|
* @returns {{
|
|
* type: SEND_MESSAGE,
|
|
* message: string
|
|
* }}
|
|
*/
|
|
export function sendMessage(message) {
|
|
return {
|
|
type: SEND_MESSAGE,
|
|
message
|
|
};
|
|
}
|
|
|
|
/**
|
|
* Toggles display of the chat side panel.
|
|
*
|
|
* @returns {{
|
|
* type: TOGGLE_CHAT
|
|
* }}
|
|
*/
|
|
export function toggleChat() {
|
|
return {
|
|
type: TOGGLE_CHAT
|
|
};
|
|
}
|