Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(plugin): add setDisplayActionsBar ui-command #137

Merged
merged 1 commit into from
Dec 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading