Jitsi Meet - Secure, Simple and Scalable Video Conferences that you use as a standalone app or embed in your web application.
TypeScript debiandeep-videojitsijitsi-meetscalable-video-conferencessfuvideovideo-communicationvideo-conferencingwebrtc
feat(toolbox): Add polls and file sharing buttons to overflow menu
Hristo Terezove02c4e8f7fef
diff --git a/lang/main.json b/lang/main.jsonindex 2fcad29a74..eac9d3f492 100644--- a/lang/main.json+++ b/lang/main.json@@ -1429,6 +1429,7 @@"exitFullScreen": "Exit full screen","exitTileView": "Exit tile view","feedback": "Leave feedback",+ "fileSharing": "File sharing","giphy": "Toggle GIPHY menu","hangup": "Leave the meeting","help": "Help",@@ -1464,6 +1465,7 @@"openReactionsMenu": "Open reactions menu","participants": "Participants","pip": "Enter Picture-in-Picture mode",+ "polls": "Polls","privateMessage": "Send private message","profile": "Edit your profile","raiseHand": "Raise your hand",diff --git a/react/features/chat/actions.any.ts b/react/features/chat/actions.any.tsindex 7e9d7a53ce..461f3505d5 100644--- a/react/features/chat/actions.any.ts+++ b/react/features/chat/actions.any.ts@@ -220,6 +220,34 @@ export function openCCPanel() {};}+/**+ * Opens the chat panel with polls tab active.+ *+ * @returns {Object} The redux action.+ */+export function openPollsPanel() {+ return async (dispatch: IStore['dispatch']) => {+ dispatch(setFocusedTab(ChatTabs.POLLS));+ dispatch({+ type: OPEN_CHAT+ });+ };+}++/**+ * Opens the chat panel with file sharing tab active.+ *+ * @returns {Object} The redux action.+ */+export function openFileSharingPanel() {+ return async (dispatch: IStore['dispatch']) => {+ dispatch(setFocusedTab(ChatTabs.FILE_SHARING));+ dispatch({+ type: OPEN_CHAT+ });+ };+}+/*** Initiates the sending of messages between a moderator and a lobby attendee.diff --git a/react/features/file-sharing/components/web/FileSharingButton.tsx b/react/features/file-sharing/components/web/FileSharingButton.tsxnew file mode 100644index 0000000000..f52c8b7deb--- /dev/null+++ b/react/features/file-sharing/components/web/FileSharingButton.tsx@@ -0,0 +1,45 @@+import { connect } from 'react-redux';++import { IReduxState } from '../../../app/types';+import { translate } from '../../../base/i18n/functions';+import { IconShareDoc } from '../../../base/icons/svg';+import AbstractButton, { IProps as AbstractButtonProps } from '../../../base/toolbox/components/AbstractButton';+import { openFileSharingPanel } from '../../../chat/actions.any';+import { isFileSharingEnabled } from '../../functions.any';++/**+ * Component that renders a button to open the file sharing panel.+ *+ * @augments AbstractButton+ */+class FileSharingButton extends AbstractButton<AbstractButtonProps> {+ override icon = IconShareDoc;+ override label = 'toolbar.fileSharing';+ override tooltip = 'toolbar.fileSharing';++ /**+ * Handles clicking the button to open the file sharing panel.+ *+ * @private+ * @returns {void}+ */+ override _handleClick() {+ const { dispatch } = this.props;++ dispatch(openFileSharingPanel());+ }+}++/**+ * Maps part of the Redux state to the props of this component.+ *+ * @param {IReduxState} state - The Redux state.+ * @returns {Object} - Mapped props.+ */+function mapStateToProps(state: IReduxState) {+ return {+ visible: isFileSharingEnabled(state)+ };+}++export default translate(connect(mapStateToProps)(FileSharingButton));diff --git a/react/features/file-sharing/hooks.web.ts b/react/features/file-sharing/hooks.web.tsnew file mode 100644index 0000000000..12129b91a8--- /dev/null+++ b/react/features/file-sharing/hooks.web.ts@@ -0,0 +1,23 @@+import { useSelector } from 'react-redux';++import FileSharingButton from './components/web/FileSharingButton';+import { isFileSharingEnabled } from './functions.any';++const fileSharing = {+ key: 'filesharing',+ Content: FileSharingButton,+ group: 2+};++/**+ * A hook that returns the file sharing button if it is enabled and undefined otherwise.+ *+ * @returns {Object | undefined} - The file sharing button object or undefined.+ */+export function useFileSharingButton() {+ const isEnabled = useSelector(isFileSharingEnabled);++ if (isEnabled) {+ return fileSharing;+ }+}diff --git a/react/features/polls/components/web/PollsButton.tsx b/react/features/polls/components/web/PollsButton.tsxnew file mode 100644index 0000000000..fde337a76a--- /dev/null+++ b/react/features/polls/components/web/PollsButton.tsx@@ -0,0 +1,45 @@+import { connect } from 'react-redux';++import { IReduxState } from '../../../app/types';+import { translate } from '../../../base/i18n/functions';+import { IconInfo } from '../../../base/icons/svg';+import AbstractButton, { IProps as AbstractButtonProps } from '../../../base/toolbox/components/AbstractButton';+import { openPollsPanel } from '../../../chat/actions.any';+import { arePollsDisabled } from '../../../conference/functions.any';++/**+ * Component that renders a button to open the polls panel.+ *+ * @augments AbstractButton+ */+class PollsButton extends AbstractButton<AbstractButtonProps> {+ override icon = IconInfo;+ override label = 'toolbar.polls';+ override tooltip = 'toolbar.polls';++ /**+ * Handles clicking the button to open the polls panel.+ *+ * @private+ * @returns {void}+ */+ override _handleClick() {+ const { dispatch } = this.props;++ dispatch(openPollsPanel());+ }+}++/**+ * Maps part of the Redux state to the props of this component.+ *+ * @param {IReduxState} state - The Redux state.+ * @returns {Object} - Mapped props.+ */+function mapStateToProps(state: IReduxState) {+ return {+ visible: !arePollsDisabled(state)+ };+}++export default translate(connect(mapStateToProps)(PollsButton));diff --git a/react/features/polls/hooks.web.ts b/react/features/polls/hooks.web.tsnew file mode 100644index 0000000000..667acf9d93--- /dev/null+++ b/react/features/polls/hooks.web.ts@@ -0,0 +1,24 @@+import { useSelector } from 'react-redux';++import { arePollsDisabled } from '../conference/functions.any';++import PollsButton from './components/web/PollsButton';++const polls = {+ key: 'polls',+ Content: PollsButton,+ group: 2+};++/**+ * A hook that returns the polls button if it is enabled and undefined otherwise.+ *+ * @returns {Object | undefined} - The polls button object or undefined.+ */+export function usePollsButton() {+ const isPollsDisabled = useSelector(arePollsDisabled);++ if (!isPollsDisabled) {+ return polls;+ }+}diff --git a/react/features/toolbox/constants.ts b/react/features/toolbox/constants.tsindex 20ffa50bfa..37f1e7f7c6 100644--- a/react/features/toolbox/constants.ts+++ b/react/features/toolbox/constants.ts@@ -151,6 +151,7 @@ export const TOOLBAR_BUTTONS: ToolbarButton[] = ['embedmeeting','etherpad','feedback',+ 'filesharing','filmstrip','fullscreen','hangup',@@ -163,6 +164,7 @@ export const TOOLBAR_BUTTONS: ToolbarButton[] = ['mute-everyone','mute-video-everyone','participants-pane',+ 'polls','profile','raisehand','recording',diff --git a/react/features/toolbox/hooks.web.ts b/react/features/toolbox/hooks.web.tsindex 73a5881c4f..86719d206d 100644--- a/react/features/toolbox/hooks.web.ts+++ b/react/features/toolbox/hooks.web.ts@@ -17,6 +17,7 @@ import ChatButton from '../chat/components/web/ChatButton';import { useEmbedButton } from '../embed-meeting/hooks';import { useEtherpadButton } from '../etherpad/hooks';import { useFeedbackButton } from '../feedback/hooks.web';+import { useFileSharingButton } from '../file-sharing/hooks.web';import { setGifMenuVisibility } from '../gifs/actions';import { isGifEnabled } from '../gifs/function.any';import InviteButton from '../invite/components/add-people-dialog/web/InviteButton';@@ -32,6 +33,7 @@ import {isParticipantsPaneEnabled} from '../participants-pane/functions';import { useParticipantPaneButton } from '../participants-pane/hooks.web';+import { usePollsButton } from '../polls/hooks.web';import { addReactionToBuffer } from '../reactions/actions.any';import { toggleReactionsMenuVisibility } from '../reactions/actions.web';import RaiseHandContainerButton from '../reactions/components/web/RaiseHandContainerButtons';@@ -278,6 +280,8 @@ export function useToolboxButtons(const participants = useParticipantPaneButton();const tileview = useTileViewButton();const cc = useClosedCaptionButton();+ const polls = usePollsButton();+ const filesharing = useFileSharingButton();const recording = useRecordingButton();const liveStreaming = useLiveStreamingButton();const linktosalesforce = useLinkToSalesforceButton();@@ -309,6 +313,8 @@ export function useToolboxButtons(fullscreen: _fullscreen,security,closedcaptions: cc,+ polls,+ filesharing,recording,livestreaming: liveStreaming,linktosalesforce,diff --git a/react/features/toolbox/types.ts b/react/features/toolbox/types.tsindex 265a1d18de..84f0dcc600 100644--- a/react/features/toolbox/types.ts+++ b/react/features/toolbox/types.ts@@ -24,6 +24,7 @@ export type ToolbarButton = 'camera' |'embedmeeting' |'etherpad' |'feedback' |+ 'filesharing' |'filmstrip' |'fullscreen' |'hangup' |@@ -38,6 +39,7 @@ export type ToolbarButton = 'camera' |'noisesuppression' |'overflowmenu' |'participants-pane' |+ 'polls' |'profile' |'raisehand' |'reactions' |