Skip to content

Commit

Permalink
[actions-bar-set-display] - added ui-command to make it possible for …
Browse files Browse the repository at this point in the history
…the developer to display or hide the actions-bar
  • Loading branch information
GuiLeme committed Dec 9, 2024
1 parent 92a1e8c commit 530f9cb
Show file tree
Hide file tree
Showing 6 changed files with 50 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down
22 changes: 22 additions & 0 deletions src/ui-commands/actions-bar/commands.ts
Original file line number Diff line number Diff line change
@@ -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,
},
}));
},
};
3 changes: 3 additions & 0 deletions src/ui-commands/actions-bar/enums.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
export enum ActionsBarEnum {
SET_DISPLAY_ACTIONS_BAR = 'SET_DISPLAY_ACTIONS_BAR_COMMAND',
}
9 changes: 9 additions & 0 deletions src/ui-commands/actions-bar/types.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
export interface SetDisplayActionBarCommandArguments {
displayActionBar: boolean;
}

export interface UiCommandsActionsBarObject {
setDisplayActionBar: (
arg: SetDisplayActionBarCommandArguments
) => void;
}
2 changes: 2 additions & 0 deletions src/ui-commands/commands.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
2 changes: 2 additions & 0 deletions src/ui-commands/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 530f9cb

Please sign in to comment.