From 530f9cb46dce4c5a2ab1395e409771eeb305212a Mon Sep 17 00:00:00 2001 From: Guilherme Leme Date: Mon, 9 Dec 2024 14:12:34 -0300 Subject: [PATCH] [actions-bar-set-display] - added ui-command to make it possible for the developer to display or hide the actions-bar --- .../component.tsx | 12 ++++++++++ src/ui-commands/actions-bar/commands.ts | 22 +++++++++++++++++++ src/ui-commands/actions-bar/enums.ts | 3 +++ src/ui-commands/actions-bar/types.ts | 9 ++++++++ src/ui-commands/commands.ts | 2 ++ src/ui-commands/types.ts | 2 ++ 6 files changed, 50 insertions(+) create mode 100644 src/ui-commands/actions-bar/commands.ts create mode 100644 src/ui-commands/actions-bar/enums.ts create mode 100644 src/ui-commands/actions-bar/types.ts diff --git a/samples/sample-action-button-dropdown-plugin/src/components/sample-action-button-dropdown-plugin-item/component.tsx b/samples/sample-action-button-dropdown-plugin/src/components/sample-action-button-dropdown-plugin-item/component.tsx index 26f3ca1..20bd57c 100644 --- a/samples/sample-action-button-dropdown-plugin/src/components/sample-action-button-dropdown-plugin-item/component.tsx +++ b/samples/sample-action-button-dropdown-plugin/src/components/sample-action-button-dropdown-plugin-item/component.tsx @@ -128,6 +128,18 @@ function SampleActionButtonDropdownPlugin( handleFetchPresentationData(currentPresentation); }, }), + new ActionButtonDropdownOption({ + label: 'Close actions bar for 5 seconds', + icon: 'copy', + tooltip: 'this is a button injected by plugin', + allowed: true, + onClick: () => { + pluginApi.uiCommands.actionsBar.setDisplayActionBar({ displayActionBar: false }); + setTimeout(() => { + pluginApi.uiCommands.actionsBar.setDisplayActionBar({ displayActionBar: true }); + }, 5000); + }, + }), new ActionButtonDropdownOption({ label: showingGenericContentInPresentationArea ? 'Return previous presentation content' : 'Set different content in presentation area', icon: 'copy', diff --git a/src/ui-commands/actions-bar/commands.ts b/src/ui-commands/actions-bar/commands.ts new file mode 100644 index 0000000..88bc88b --- /dev/null +++ b/src/ui-commands/actions-bar/commands.ts @@ -0,0 +1,22 @@ +import { ActionsBarEnum } from './enums'; +import { SetDisplayActionBarCommandArguments } from './types'; + +export const actionsBar = { + /** + * Decides whether to display the actions bar + * + * @param setSpeakerLevelCommandArgumentsthe volume to which the core will set the speaker + * level. + * Refer to {@link SetDisplayActionBarCommandArguments} to understand the argument structure. + */ + setDisplayActionBar: (arg: SetDisplayActionBarCommandArguments) => { + const { displayActionBar } = arg; + window.dispatchEvent(new CustomEvent< + SetDisplayActionBarCommandArguments + >(ActionsBarEnum.SET_DISPLAY_ACTIONS_BAR, { + detail: { + displayActionBar, + }, + })); + }, +}; diff --git a/src/ui-commands/actions-bar/enums.ts b/src/ui-commands/actions-bar/enums.ts new file mode 100644 index 0000000..bed2af2 --- /dev/null +++ b/src/ui-commands/actions-bar/enums.ts @@ -0,0 +1,3 @@ +export enum ActionsBarEnum { + SET_DISPLAY_ACTIONS_BAR = 'SET_DISPLAY_ACTIONS_BAR_COMMAND', +} diff --git a/src/ui-commands/actions-bar/types.ts b/src/ui-commands/actions-bar/types.ts new file mode 100644 index 0000000..94effa1 --- /dev/null +++ b/src/ui-commands/actions-bar/types.ts @@ -0,0 +1,9 @@ +export interface SetDisplayActionBarCommandArguments { + displayActionBar: boolean; +} + +export interface UiCommandsActionsBarObject { + setDisplayActionBar: ( + arg: SetDisplayActionBarCommandArguments + ) => void; +} diff --git a/src/ui-commands/commands.ts b/src/ui-commands/commands.ts index 4c493ec..f8ade1d 100644 --- a/src/ui-commands/commands.ts +++ b/src/ui-commands/commands.ts @@ -5,8 +5,10 @@ import { presentationArea } from './presentation-area/commands'; import { userStatus } from './user-status/commands'; import { conference } from './conference/commands'; import { notification } from './notification/commands'; +import { actionsBar } from './actions-bar/commands'; export const uiCommands = { + actionsBar, chat, externalVideo, sidekickOptionsContainer, diff --git a/src/ui-commands/types.ts b/src/ui-commands/types.ts index e2ea18a..1fd99b1 100644 --- a/src/ui-commands/types.ts +++ b/src/ui-commands/types.ts @@ -5,8 +5,10 @@ import { UiCommandsPresentationAreaObject } from './presentation-area/types'; import { UiCommandsUserStatusObject } from './user-status/types'; import { UiCommandsConferenceObject } from './conference/types'; import { UiCommandsNotificationObject } from './notification/types'; +import { UiCommandsActionsBarObject } from './actions-bar/types'; export interface UiCommands { + actionsBar: UiCommandsActionsBarObject; chat: UiCommandsChatObject; externalVideo: UiCommandsExternalVideoObject; sidekickOptionsContainer: UiCommandsSidekickOptionsContainerObject;