Skip to content

Commit 088ecfa

Browse files
authored
Merge pull request #138 from GuiLeme/set-display-navbar
feat(plugin): Add new ui-command to display nav-bar
2 parents 8f655d2 + 73c04db commit 088ecfa

File tree

6 files changed

+49
-0
lines changed

6 files changed

+49
-0
lines changed

samples/sample-action-button-dropdown-plugin/src/components/sample-action-button-dropdown-plugin-item/component.tsx

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,18 @@ function SampleActionButtonDropdownPlugin(
143143
}, 5000);
144144
},
145145
}),
146+
new ActionButtonDropdownOption({
147+
label: 'Hide nav-bar',
148+
icon: 'copy',
149+
tooltip: 'this is a button injected by plugin',
150+
allowed: true,
151+
onClick: () => {
152+
pluginApi.uiCommands.navBar.setDisplayNavBar({ displayNavBar: false });
153+
setTimeout(() => {
154+
pluginApi.uiCommands.navBar.setDisplayNavBar({ displayNavBar: true });
155+
}, 5000);
156+
},
157+
}),
146158
new ActionButtonDropdownOption({
147159
label: showingGenericContentInPresentationArea ? 'Return previous presentation content' : 'Set different content in presentation area',
148160
icon: 'copy',

src/ui-commands/commands.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,14 @@ import { conference } from './conference/commands';
77
import { notification } from './notification/commands';
88
import { actionsBar } from './actions-bar/commands';
99
import { layout } from './layout/commands';
10+
import { navBar } from './nav-bar/commands';
1011

1112
export const uiCommands = {
1213
actionsBar,
1314
chat,
1415
externalVideo,
1516
sidekickOptionsContainer,
17+
navBar,
1618
presentationArea,
1719
userStatus,
1820
conference,

src/ui-commands/nav-bar/commands.ts

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
import { NavBarEnum } from './enums';
2+
import { SetDisplayNavBarCommandArguments } from './types';
3+
4+
export const navBar = {
5+
/**
6+
* Sets the displayNavBar to true (show it) or false (hide it).
7+
*
8+
* @param setDisplayNavBarCommandArguments: object with a boolean that tells whether to display
9+
* the navbar
10+
*/
11+
setDisplayNavBar: (setDisplayNavBarCommandArguments: SetDisplayNavBarCommandArguments) => {
12+
const { displayNavBar } = setDisplayNavBarCommandArguments;
13+
window.dispatchEvent(
14+
new CustomEvent<
15+
SetDisplayNavBarCommandArguments
16+
>(NavBarEnum.SET_DISPLAY_NAV_BAR, {
17+
detail: {
18+
displayNavBar,
19+
},
20+
}),
21+
);
22+
},
23+
};

src/ui-commands/nav-bar/enums.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
export enum NavBarEnum {
2+
SET_DISPLAY_NAV_BAR = 'SET_DISPLAY_NAV_BAR_COMMAND',
3+
}

src/ui-commands/nav-bar/types.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
export interface SetDisplayNavBarCommandArguments {
2+
displayNavBar: boolean;
3+
}
4+
5+
export interface UiCommandsNavBarObject {
6+
setDisplayNavBar: (setDisplayNavBarCommandArguments: SetDisplayNavBarCommandArguments) => void;
7+
}

src/ui-commands/types.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,15 @@ import { UiCommandsConferenceObject } from './conference/types';
77
import { UiCommandsNotificationObject } from './notification/types';
88
import { UiCommandsActionsBarObject } from './actions-bar/types';
99
import { UiCommandsLayoutObject } from './layout/types';
10+
import { UiCommandsNavBarObject } from './nav-bar/types';
1011

1112
export interface UiCommands {
1213
layout: UiCommandsLayoutObject;
1314
actionsBar: UiCommandsActionsBarObject;
1415
chat: UiCommandsChatObject;
1516
externalVideo: UiCommandsExternalVideoObject;
1617
sidekickOptionsContainer: UiCommandsSidekickOptionsContainerObject;
18+
navBar: UiCommandsNavBarObject;
1719
presentationArea: UiCommandsPresentationAreaObject;
1820
userStatus: UiCommandsUserStatusObject;
1921
conference: UiCommandsConferenceObject;

0 commit comments

Comments
 (0)