Skip to content

Commit

Permalink
Merge pull request #138 from GuiLeme/set-display-navbar
Browse files Browse the repository at this point in the history
feat(plugin): Add new ui-command to display nav-bar
  • Loading branch information
GuiLeme authored Dec 13, 2024
2 parents 8f655d2 + 73c04db commit 088ecfa
Show file tree
Hide file tree
Showing 6 changed files with 49 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,18 @@ function SampleActionButtonDropdownPlugin(
}, 5000);
},
}),
new ActionButtonDropdownOption({
label: 'Hide nav-bar',
icon: 'copy',
tooltip: 'this is a button injected by plugin',
allowed: true,
onClick: () => {
pluginApi.uiCommands.navBar.setDisplayNavBar({ displayNavBar: false });
setTimeout(() => {
pluginApi.uiCommands.navBar.setDisplayNavBar({ displayNavBar: true });
}, 5000);
},
}),
new ActionButtonDropdownOption({
label: showingGenericContentInPresentationArea ? 'Return previous presentation content' : 'Set different content in presentation area',
icon: 'copy',
Expand Down
2 changes: 2 additions & 0 deletions src/ui-commands/commands.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,14 @@ import { conference } from './conference/commands';
import { notification } from './notification/commands';
import { actionsBar } from './actions-bar/commands';
import { layout } from './layout/commands';
import { navBar } from './nav-bar/commands';

export const uiCommands = {
actionsBar,
chat,
externalVideo,
sidekickOptionsContainer,
navBar,
presentationArea,
userStatus,
conference,
Expand Down
23 changes: 23 additions & 0 deletions src/ui-commands/nav-bar/commands.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import { NavBarEnum } from './enums';
import { SetDisplayNavBarCommandArguments } from './types';

export const navBar = {
/**
* Sets the displayNavBar to true (show it) or false (hide it).
*
* @param setDisplayNavBarCommandArguments: object with a boolean that tells whether to display
* the navbar
*/
setDisplayNavBar: (setDisplayNavBarCommandArguments: SetDisplayNavBarCommandArguments) => {
const { displayNavBar } = setDisplayNavBarCommandArguments;
window.dispatchEvent(
new CustomEvent<
SetDisplayNavBarCommandArguments
>(NavBarEnum.SET_DISPLAY_NAV_BAR, {
detail: {
displayNavBar,
},
}),
);
},
};
3 changes: 3 additions & 0 deletions src/ui-commands/nav-bar/enums.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
export enum NavBarEnum {
SET_DISPLAY_NAV_BAR = 'SET_DISPLAY_NAV_BAR_COMMAND',
}
7 changes: 7 additions & 0 deletions src/ui-commands/nav-bar/types.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
export interface SetDisplayNavBarCommandArguments {
displayNavBar: boolean;
}

export interface UiCommandsNavBarObject {
setDisplayNavBar: (setDisplayNavBarCommandArguments: SetDisplayNavBarCommandArguments) => void;
}
2 changes: 2 additions & 0 deletions src/ui-commands/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,15 @@ import { UiCommandsConferenceObject } from './conference/types';
import { UiCommandsNotificationObject } from './notification/types';
import { UiCommandsActionsBarObject } from './actions-bar/types';
import { UiCommandsLayoutObject } from './layout/types';
import { UiCommandsNavBarObject } from './nav-bar/types';

export interface UiCommands {
layout: UiCommandsLayoutObject;
actionsBar: UiCommandsActionsBarObject;
chat: UiCommandsChatObject;
externalVideo: UiCommandsExternalVideoObject;
sidekickOptionsContainer: UiCommandsSidekickOptionsContainerObject;
navBar: UiCommandsNavBarObject;
presentationArea: UiCommandsPresentationAreaObject;
userStatus: UiCommandsUserStatusObject;
conference: UiCommandsConferenceObject;
Expand Down

0 comments on commit 088ecfa

Please sign in to comment.