Files
jitsi-meet/react/features/custom-panel/hooks.web.ts
Hristo Terezov f4a6036c1b fix(custom-panel): Button group
Since we render the button last when it has group 2 out of 4 React prints console.error.
2026-03-11 15:15:45 -05:00

30 lines
749 B
TypeScript

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: 5
};
/**
* 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;
}