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(CustomPanel): Implement an customizable panel.
Hristo Terezovdbb3ccc27482
diff --git a/lang/main.json b/lang/main.jsonindex e6a7541f74..2b0d335b74 100644--- a/lang/main.json+++ b/lang/main.json@@ -227,6 +227,9 @@"video_ssrc": "Video SSRC:","yes": "yes"},+ "customPanel": {+ "close": "Close"+ },"dateUtils": {"earlier": "Earlier","today": "Today",@@ -1315,6 +1318,7 @@"chat": "Open / Close chat","clap": "Clap","closeChat": "Close chat",+ "closeCustomPanel": "Close","closeMoreActions": "Close more actions menu","closeParticipantsPane": "Close participants pane","closedCaptions": "Closed captions",@@ -1420,9 +1424,11 @@"chat": "Open / Close chat","clap": "Clap","closeChat": "Close chat",+ "closeCustomPanel": "Close","closeParticipantsPane": "Close participants pane","closeReactionsMenu": "Close reactions menu","closedCaptions": "Closed captions",+ "copilot": "Copilot","disableNoiseSuppression": "Disable extra noise suppression","disableReactionSounds": "You can disable reaction sounds for this meeting","documentClose": "Close shared document",diff --git a/react/features/app/middlewares.web.ts b/react/features/app/middlewares.web.tsindex 9f46023269..e538429658 100644--- a/react/features/app/middlewares.web.ts+++ b/react/features/app/middlewares.web.ts@@ -26,5 +26,6 @@ import '../face-landmarks/middleware';import '../gifs/middleware';import '../whiteboard/middleware.web';import '../file-sharing/middleware.web';+import '../custom-panel/middleware.web';import './middlewares.any';diff --git a/react/features/app/reducers.web.ts b/react/features/app/reducers.web.tsindex 238a196793..4fc2ccd477 100644--- a/react/features/app/reducers.web.ts+++ b/react/features/app/reducers.web.ts@@ -1,5 +1,6 @@import '../base/devices/reducer';import '../base/premeeting/reducer';+import '../custom-panel/reducer';import '../base/tooltip/reducer';import '../e2ee/reducer';import '../face-landmarks/reducer';diff --git a/react/features/app/types.ts b/react/features/app/types.tsindex 0ef5d57350..2a627f7ac9 100644--- a/react/features/app/types.ts+++ b/react/features/app/types.ts@@ -31,6 +31,7 @@ import { IUserInteractionState } from '../base/user-interaction/reducer';import { IBreakoutRoomsState } from '../breakout-rooms/reducer';import { ICalendarSyncState } from '../calendar-sync/reducer';import { IChatState } from '../chat/reducer';+import { ICustomPanelState } from '../custom-panel/reducer';import { IDeepLinkingState } from '../deep-linking/reducer';import { IDropboxState } from '../dropbox/reducer';import { IDynamicBrandingState } from '../dynamic-branding/reducer';@@ -121,6 +122,7 @@ export interface IReduxState {'features/calendar-sync': ICalendarSyncState;'features/call-integration': ICallIntegrationState;'features/chat': IChatState;+ 'features/custom-panel': ICustomPanelState;'features/deep-linking': IDeepLinkingState;'features/dropbox': IDropboxState;'features/dynamic-branding': IDynamicBrandingState;diff --git a/react/features/base/icons/svg/AI.svg b/react/features/base/icons/svg/AI.svgnew file mode 100644index 0000000000..e2e7a64934--- /dev/null+++ b/react/features/base/icons/svg/AI.svg@@ -0,0 +1 @@+<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-sparkles-icon lucide-sparkles"><path d="M11.017 2.814a1 1 0 0 1 1.966 0l1.051 5.558a2 2 0 0 0 1.594 1.594l5.558 1.051a1 1 0 0 1 0 1.966l-5.558 1.051a2 2 0 0 0-1.594 1.594l-1.051 5.558a1 1 0 0 1-1.966 0l-1.051-5.558a2 2 0 0 0-1.594-1.594l-5.558-1.051a1 1 0 0 1 0-1.966l5.558-1.051a2 2 0 0 0 1.594-1.594z"/><path d="M20 2v4"/><path d="M22 4h-4"/><circle cx="4" cy="20" r="2"/></svg>\ No newline at end of filediff --git a/react/features/base/icons/svg/constants.ts b/react/features/base/icons/svg/constants.tsindex a078f43aa7..bac39f7629 100644--- a/react/features/base/icons/svg/constants.ts+++ b/react/features/base/icons/svg/constants.ts@@ -1,3 +1,4 @@+import { default as IconAI } from './AI.svg';import { default as IconRecordAccount } from './account-record.svg';import { default as IconAddUser } from './add-user.svg';import { default as IconArrowBack } from './arrow-back.svg';@@ -112,6 +113,7 @@ import { default as IconYahoo } from './yahoo.svg';*/export const DEFAULT_ICON: Record<string, any> = {IconAddUser,+ IconAI,IconArrowBack,IconArrowDown,IconArrowDownLarge,diff --git a/react/features/base/icons/svg/index.ts b/react/features/base/icons/svg/index.tsindex ee0ad94168..8d3a5fadf4 100644--- a/react/features/base/icons/svg/index.ts+++ b/react/features/base/icons/svg/index.ts@@ -4,6 +4,7 @@ import { DEFAULT_ICON } from './constants';const {IconAddUser,+ IconAI,IconArrowBack,IconArrowDown,IconArrowDownLarge,@@ -123,6 +124,7 @@ const {export {IconAddUser,+ IconAI,IconArrowBack,IconArrowDown,IconArrowDownLarge,diff --git a/react/features/base/responsive-ui/actions.ts b/react/features/base/responsive-ui/actions.tsindex bc4accfe2d..80fe96cd2e 100644--- a/react/features/base/responsive-ui/actions.ts+++ b/react/features/base/responsive-ui/actions.ts@@ -2,6 +2,7 @@ import { batch } from 'react-redux';import { IStore } from '../../app/types';import { CHAT_SIZE } from '../../chat/constants';+import { getCustomPanelWidth } from '../../custom-panel/functions';import { getParticipantsPaneWidth } from '../../participants-pane/functions';import {@@ -51,6 +52,7 @@ export function clientResized(clientWidth: number, clientHeight: number) {}availableWidth -= getParticipantsPaneWidth(state);+ availableWidth -= getCustomPanelWidth(state);reducedUIEnabled && dispatch(setReducedUI(availableWidth, clientHeight));}diff --git a/react/features/conference/components/web/Conference.tsx b/react/features/conference/components/web/Conference.tsxindex 0938778da0..0813f351d2 100644--- a/react/features/conference/components/web/Conference.tsx+++ b/react/features/conference/components/web/Conference.tsx@@ -14,6 +14,7 @@ import { setColorAlpha } from '../../../base/util/helpers';import { openChat, setFocusedTab } from '../../../chat/actions.web';import Chat from '../../../chat/components/web/Chat';import { ChatTabs } from '../../../chat/constants';+import CustomPanel from '../../../custom-panel/components/web/CustomPanel';import { isFileUploadingEnabled, processFiles } from '../../../file-sharing/functions.any';import MainFilmstrip from '../../../filmstrip/components/web/MainFilmstrip';import ScreenshareFilmstrip from '../../../filmstrip/components/web/ScreenshareFilmstrip';@@ -326,6 +327,7 @@ class Conference extends AbstractConference<IProps, any> {{ _showVisitorsQueue && <VisitorsQueue />}</div><ParticipantsPane />+ <CustomPanel /><ReactionAnimations /></div>);diff --git a/react/features/custom-panel/actionTypes.ts b/react/features/custom-panel/actionTypes.tsnew file mode 100644index 0000000000..d11231a523--- /dev/null+++ b/react/features/custom-panel/actionTypes.ts@@ -0,0 +1,14 @@+/**+ * Action type to signal the closing of the custom panel.+ */+export const CUSTOM_PANEL_CLOSE = 'CUSTOM_PANEL_CLOSE';++/**+ * Action type to signal the opening of the custom panel.+ */+export const CUSTOM_PANEL_OPEN = 'CUSTOM_PANEL_OPEN';++/**+ * Action type to enable or disable the custom panel dynamically.+ */+export const SET_CUSTOM_PANEL_ENABLED = 'SET_CUSTOM_PANEL_ENABLED';diff --git a/react/features/custom-panel/actions.web.ts b/react/features/custom-panel/actions.web.tsnew file mode 100644index 0000000000..037cb5df55--- /dev/null+++ b/react/features/custom-panel/actions.web.ts@@ -0,0 +1,40 @@+import {+ CUSTOM_PANEL_CLOSE,+ CUSTOM_PANEL_OPEN,+ SET_CUSTOM_PANEL_ENABLED+} from './actionTypes';++/**+ * Action to close the custom panel.+ *+ * @returns {Object} The action object.+ */+export function close() {+ return {+ type: CUSTOM_PANEL_CLOSE+ };+}++/**+ * Action to open the custom panel.+ *+ * @returns {Object} The action object.+ */+export function open() {+ return {+ type: CUSTOM_PANEL_OPEN+ };+}++/**+ * Action to enable or disable the custom panel dynamically.+ *+ * @param {boolean} enabled - Whether the custom panel should be enabled.+ * @returns {Object} The action object.+ */+export function setCustomPanelEnabled(enabled: boolean) {+ return {+ type: SET_CUSTOM_PANEL_ENABLED,+ enabled+ };+}diff --git a/react/features/custom-panel/components/web/CustomPanel.tsx b/react/features/custom-panel/components/web/CustomPanel.tsxnew file mode 100644index 0000000000..4a0a97f775--- /dev/null+++ b/react/features/custom-panel/components/web/CustomPanel.tsx@@ -0,0 +1,10 @@+/**+ * Custom panel placeholder component.+ * This file is overridden by jitsi-meet-branding at build time+ * to provide the actual panel implementation with iframe content.+ *+ * @returns {null} This placeholder renders nothing.+ */+const CustomPanel = (): null => null;++export default CustomPanel;diff --git a/react/features/custom-panel/components/web/CustomPanelButton.tsx b/react/features/custom-panel/components/web/CustomPanelButton.tsxnew file mode 100644index 0000000000..ef7b733414--- /dev/null+++ b/react/features/custom-panel/components/web/CustomPanelButton.tsx@@ -0,0 +1,10 @@+/**+ * Custom panel button placeholder component.+ * This file is overridden by jitsi-meet-branding at build time+ * to provide the actual button implementation with custom icon.+ *+ * @returns {null} This placeholder renders nothing.+ */+const CustomPanelButton = (): null => null;++export default CustomPanelButton;diff --git a/react/features/custom-panel/constants.ts b/react/features/custom-panel/constants.tsnew file mode 100644index 0000000000..7650096544--- /dev/null+++ b/react/features/custom-panel/constants.ts@@ -0,0 +1,4 @@+/**+ * Default width for the custom panel in pixels.+ */+export const DEFAULT_CUSTOM_PANEL_WIDTH = 315;diff --git a/react/features/custom-panel/functions.ts b/react/features/custom-panel/functions.tsnew file mode 100644index 0000000000..303a26ceed--- /dev/null+++ b/react/features/custom-panel/functions.ts@@ -0,0 +1,67 @@+import { IReduxState } from '../app/types';++import { DEFAULT_CUSTOM_PANEL_WIDTH } from './constants';++/**+ * Returns whether the custom panel is enabled based on Redux state.+ * The feature is disabled by default and can be enabled dynamically via console.+ *+ * @param {IReduxState} state - The Redux state.+ * @returns {boolean} Whether the custom panel is enabled.+ */+export function isCustomPanelEnabled(state: IReduxState): boolean {+ return Boolean(state['features/custom-panel']?.enabled);+}++/**+ * Returns the custom panel URL.+ * Override to provide the actual URL.+ *+ * @returns {string} The custom panel URL.+ */+export function getCustomPanelUrl(): string {+ return '';+}++/**+ * Returns the custom panel button icon.+ * Override to provide the actual icon.+ *+ * @returns {Function | undefined} The icon component.+ */+export function getCustomPanelIcon(): Function | undefined {+ return undefined;+}++/**+ * Returns the configured panel width.+ *+ * @returns {number} The panel width in pixels.+ */+export function getCustomPanelConfiguredWidth(): number {+ return DEFAULT_CUSTOM_PANEL_WIDTH;+}++/**+ * Returns whether the custom panel is currently open.+ *+ * @param {IReduxState} state - The Redux state.+ * @returns {boolean} Whether the custom panel is open.+ */+export function getCustomPanelOpen(state: IReduxState): boolean {+ return Boolean(state['features/custom-panel']?.isOpen);+}++/**+ * Returns the current panel width (0 if closed or disabled).+ *+ * @param {IReduxState} state - The Redux state.+ * @returns {number} The panel width in pixels.+ */+export function getCustomPanelWidth(state: IReduxState): number {+ if (!isCustomPanelEnabled(state)) {+ return 0;+ }++ return getCustomPanelOpen(state) ? getCustomPanelConfiguredWidth() : 0;+}diff --git a/react/features/custom-panel/hooks.web.ts b/react/features/custom-panel/hooks.web.tsnew file mode 100644index 0000000000..395ca1b065--- /dev/null+++ b/react/features/custom-panel/hooks.web.ts@@ -0,0 +1,29 @@+import { useSelector } from 'react-redux';++import CustomPanelButton from './components/web/CustomPanelButton';+import { isCustomPanelEnabled } from './functions';++/**+ * Configuration for the custom panel toolbar button.+ */+const customPanel = {+ key: 'custom-panel',+ Content: CustomPanelButton,+ group: 2+};++/**+ * A hook that returns the custom panel button if the feature is enabled.+ * Uses useSelector for reactive updates when the feature is toggled dynamically.+ *+ * @returns {Object | undefined} The button configuration or undefined if disabled.+ */+export function useCustomPanelButton() {+ const enabled = useSelector(isCustomPanelEnabled);++ if (enabled) {+ return customPanel;+ }++ return undefined;+}diff --git a/react/features/custom-panel/middleware.web.ts b/react/features/custom-panel/middleware.web.tsnew file mode 100644index 0000000000..ff248efda5--- /dev/null+++ b/react/features/custom-panel/middleware.web.ts@@ -0,0 +1,4 @@+/**+ * Custom panel middleware placeholder.+ * Override to add custom panel functionality.+ */diff --git a/react/features/custom-panel/reducer.ts b/react/features/custom-panel/reducer.tsnew file mode 100644index 0000000000..28e078f4f8--- /dev/null+++ b/react/features/custom-panel/reducer.ts@@ -0,0 +1,59 @@+import ReducerRegistry from '../base/redux/ReducerRegistry';++import {+ CUSTOM_PANEL_CLOSE,+ CUSTOM_PANEL_OPEN,+ SET_CUSTOM_PANEL_ENABLED+} from './actionTypes';++/**+ * The state of the custom panel feature.+ */+export interface ICustomPanelState {++ /**+ * Whether the custom panel feature is enabled.+ * This can be toggled dynamically via console.+ */+ enabled: boolean;++ /**+ * Whether the custom panel is currently open.+ */+ isOpen: boolean;+}++const DEFAULT_STATE: ICustomPanelState = {+ enabled: false,+ isOpen: false+};++/**+ * Listen for actions that mutate the custom panel state.+ */+ReducerRegistry.register(+ 'features/custom-panel', (state: ICustomPanelState = DEFAULT_STATE, action): ICustomPanelState => {+ switch (action.type) {+ case CUSTOM_PANEL_CLOSE:+ return {+ ...state,+ isOpen: false+ };++ case CUSTOM_PANEL_OPEN:+ return {+ ...state,+ isOpen: true+ };++ case SET_CUSTOM_PANEL_ENABLED:+ return {+ ...state,+ enabled: action.enabled+ };++ default:+ return state;+ }+ }+);diff --git a/react/features/toolbox/constants.ts b/react/features/toolbox/constants.tsindex 4ed35f942d..5116c6e573 100644--- a/react/features/toolbox/constants.ts+++ b/react/features/toolbox/constants.ts@@ -123,7 +123,8 @@ export const MAIN_TOOLBAR_BUTTONS_PRIORITY = ['embedmeeting','feedback','download',- 'help'+ 'help',+ 'custom-panel'];export const TOOLBAR_TIMEOUT = 4000;@@ -148,6 +149,7 @@ export const TOOLBAR_BUTTONS: ToolbarButton[] = ['camera','chat','closedcaptions',+ 'custom-panel','desktop','download','embedmeeting',diff --git a/react/features/toolbox/hooks.web.ts b/react/features/toolbox/hooks.web.tsindex a416e0d2b6..c36fe18164 100644--- a/react/features/toolbox/hooks.web.ts+++ b/react/features/toolbox/hooks.web.ts@@ -15,6 +15,7 @@ import { isToggleCameraEnabled } from '../base/tracks/functions.web';import { toggleChat } from '../chat/actions.web';import { isChatDisabled } from '../chat/functions';import { useChatButton } from '../chat/hooks.web';+import { useCustomPanelButton } from '../custom-panel/hooks.web';import { useEmbedButton } from '../embed-meeting/hooks';import { useEtherpadButton } from '../etherpad/hooks';import { useFeedbackButton } from '../feedback/hooks.web';@@ -292,6 +293,7 @@ export function useToolboxButtons(const feedback = useFeedbackButton();const _download = useDownloadButton();const _help = useHelpButton();+ const customPanel = useCustomPanelButton();const buttons: { [key in ToolbarButton]?: IToolboxButton; } = {microphone,@@ -326,7 +328,8 @@ export function useToolboxButtons(embedmeeting: embed,feedback,download: _download,- help: _help+ help: _help,+ 'custom-panel': customPanel};const buttonKeys = Object.keys(buttons) as ToolbarButton[];diff --git a/react/features/toolbox/types.ts b/react/features/toolbox/types.tsindex 81ff614212..e3bbb48580 100644--- a/react/features/toolbox/types.ts+++ b/react/features/toolbox/types.ts@@ -19,6 +19,7 @@ export interface IToolboxNativeButton {export type ToolbarButton = 'camera' |'chat' |'closedcaptions' |+ 'custom-panel' |'desktop' |'download' |'embedmeeting' |