From f989d6e4185aa83c9e96fd4d9a9cc243962e023d Mon Sep 17 00:00:00 2001 From: Arthurk12 Date: Thu, 13 Feb 2025 09:54:46 -0300 Subject: [PATCH] feat(extensible-area): add apps gallery extensible area Until now, the only way to add an item in the apps gallery was by injecting a sidekick generic content. But as the concept of apps expanded beyond sidebar contents, it was necessary to decouple the gallery apps from the sidebar content(i.e. generic sidekick content). So this commit adds an extensible area specifically for the apps gallery. It has only one type, which is 'ENTRY' and corresponds to an apps gallery entry that won't open a sidebar content when clicked. --- README.md | 1 + src/core/api/BbbPluginSdk.ts | 1 + src/core/api/types.ts | 7 +++- .../apps-gallery-item/component.ts | 34 +++++++++++++++++++ .../apps-gallery-item/enums.ts | 3 ++ .../apps-gallery-item/index.ts | 9 +++++ .../apps-gallery-item/types.ts | 13 +++++++ src/extensible-areas/base.ts | 7 ++-- src/extensible-areas/index.ts | 1 + 9 files changed, 72 insertions(+), 4 deletions(-) create mode 100644 src/extensible-areas/apps-gallery-item/component.ts create mode 100644 src/extensible-areas/apps-gallery-item/enums.ts create mode 100644 src/extensible-areas/apps-gallery-item/index.ts create mode 100644 src/extensible-areas/apps-gallery-item/types.ts diff --git a/README.md b/README.md index 223e0209..e4c944cf 100644 --- a/README.md +++ b/README.md @@ -172,6 +172,7 @@ That being said, here are the extensible areas we have so far: - Action bar items (button, separator) - Action Button Dropdown Items (option, separator) +- Apps Gallery Items (entry) - Audio settings dropdown items (option, separator) - Camera settings dropdown items (option, separator) - Options settings dropdown items (option, separator) diff --git a/src/core/api/BbbPluginSdk.ts b/src/core/api/BbbPluginSdk.ts index c556344c..d8549ca7 100644 --- a/src/core/api/BbbPluginSdk.ts +++ b/src/core/api/BbbPluginSdk.ts @@ -176,6 +176,7 @@ export abstract class BbbPluginSdk { setActionButtonDropdownItems: () => [], setActionsBarItems: () => [], setAudioSettingsDropdownItems: () => [], + setAppsGalleryItems: () => [], setPresentationDropdownItems: () => [], setNavBarItems: () => [], setScreenshareHelperItems: () => [], diff --git a/src/core/api/types.ts b/src/core/api/types.ts index 7ca76d56..25b1f97b 100644 --- a/src/core/api/types.ts +++ b/src/core/api/types.ts @@ -29,7 +29,7 @@ import { UseMeetingFunction } from '../../data-consumption/domain/meeting/from-c import { ServerCommands } from '../../server-commands/types'; import { SendGenericDataForLearningAnalyticsDashboard } from '../../learning-analytics-dashboard/types'; import { UseUserCameraDomElementsFunction } from '../../dom-element-manipulation/user-camera/types'; -import { ScreenshareHelperInterface, UserCameraHelperInterface } from '../../extensible-areas'; +import { AppsGalleryInterface, ScreenshareHelperInterface, UserCameraHelperInterface } from '../../extensible-areas'; import { GetDataSource } from '../../remote-data/types'; import { PersistEventFunction } from '../../event-persistence/types'; import { PersistAssetFunction } from '../../asset-persistence/types'; @@ -54,6 +54,10 @@ export type SetAudioSettingsDropdownItems = ( audioSettingsDropdownItem: AudioSettingsDropdownInterface[] ) => string[]; +export type SetAppsGalleryItems = ( + appsGalleryItems: AppsGalleryInterface[] +) => string[]; + export type SetPresentationDropdownItems = ( userListDropdownItem: PresentationDropdownInterface[] ) => string[]; @@ -101,6 +105,7 @@ export interface PluginApi { setActionButtonDropdownItems: SetActionButtonDropdownItems; setActionsBarItems: SetActionsBarItems; setAudioSettingsDropdownItems: SetAudioSettingsDropdownItems; + setAppsGalleryItems: SetAppsGalleryItems; setPresentationDropdownItems: SetPresentationDropdownItems; setNavBarItems: SetNavBarItems; setScreenshareHelperItems: SetScreenshareHelperItems; diff --git a/src/extensible-areas/apps-gallery-item/component.ts b/src/extensible-areas/apps-gallery-item/component.ts new file mode 100644 index 00000000..a5ed782f --- /dev/null +++ b/src/extensible-areas/apps-gallery-item/component.ts @@ -0,0 +1,34 @@ +import { AppsGalleryType } from './enums'; +import { AppsGalleryInterface, AppsGalleryItemProps } from './types'; + +export class AppsGalleryEntry implements AppsGalleryInterface { + id: string = ''; + + name: string = ''; + + type: AppsGalleryType = AppsGalleryType.ENTRY; + + icon: string = ''; + + onClick: () => void; + + constructor({ + id, + name, + icon, + onClick, + }: AppsGalleryItemProps) { + if (id) { + this.id = id; + } + this.name = name; + this.icon = icon; + this.onClick = onClick; + } + + setItemId(id: string): void { + this.id = id; + } +} + +export default AppsGalleryEntry; diff --git a/src/extensible-areas/apps-gallery-item/enums.ts b/src/extensible-areas/apps-gallery-item/enums.ts new file mode 100644 index 00000000..4997d781 --- /dev/null +++ b/src/extensible-areas/apps-gallery-item/enums.ts @@ -0,0 +1,3 @@ +export enum AppsGalleryType { + ENTRY = 'APPS_GALLERY_ENTRY', +} diff --git a/src/extensible-areas/apps-gallery-item/index.ts b/src/extensible-areas/apps-gallery-item/index.ts new file mode 100644 index 00000000..a565952b --- /dev/null +++ b/src/extensible-areas/apps-gallery-item/index.ts @@ -0,0 +1,9 @@ +export { + AppsGalleryEntry, +} from './component'; +export { + AppsGalleryInterface, +} from './types'; +export { + AppsGalleryType, +} from './enums'; diff --git a/src/extensible-areas/apps-gallery-item/types.ts b/src/extensible-areas/apps-gallery-item/types.ts new file mode 100644 index 00000000..db656367 --- /dev/null +++ b/src/extensible-areas/apps-gallery-item/types.ts @@ -0,0 +1,13 @@ +import { PluginProvidedUiItemDescriptor } from '../base'; +import { AppsGalleryType } from './enums'; + +export interface AppsGalleryInterface extends PluginProvidedUiItemDescriptor { + type: AppsGalleryType; +} + +export interface AppsGalleryItemProps { + id?: string; + name: string; + icon: string; + onClick: () => void; +} diff --git a/src/extensible-areas/base.ts b/src/extensible-areas/base.ts index 91d637dc..1d334a4c 100644 --- a/src/extensible-areas/base.ts +++ b/src/extensible-areas/base.ts @@ -1,5 +1,6 @@ import { ActionButtonDropdownItemType } from './action-button-dropdown-item/enums'; import { ActionsBarItemType } from './actions-bar-item/enums'; +import { AppsGalleryType } from './apps-gallery-item/enums'; import { AudioSettingsDropdownItemType } from './audio-settings-dropdown-item/enums'; import { CameraSettingsDropdownItemType } from './camera-settings-dropdown-item/enums'; import { FloatingWindowType } from './floating-window/enums'; @@ -16,9 +17,9 @@ import { UserListItemAdditionalInformationType } from './user-list-item-addition type PluginProvidedUiItemType = PresentationToolbarItemType | UserListDropdownItemType | ActionButtonDropdownItemType | - ActionsBarItemType | AudioSettingsDropdownItemType | - PresentationDropdownItemType | NavBarItemType | OptionsDropdownItemType | - CameraSettingsDropdownItemType | UserCameraDropdownItemType | + ActionsBarItemType | AppsGalleryType | + AudioSettingsDropdownItemType | PresentationDropdownItemType | NavBarItemType | + OptionsDropdownItemType | CameraSettingsDropdownItemType | UserCameraDropdownItemType | UserListItemAdditionalInformationType | FloatingWindowType | GenericContentType | ScreenshareHelperItemType | UserCameraHelperItemType; diff --git a/src/extensible-areas/index.ts b/src/extensible-areas/index.ts index 4ee1b027..5ef6aa72 100644 --- a/src/extensible-areas/index.ts +++ b/src/extensible-areas/index.ts @@ -2,6 +2,7 @@ export * from './presentation-toolbar-item'; export * from './user-list-dropdown-item'; export * from './action-button-dropdown-item'; export * from './actions-bar-item'; +export * from './apps-gallery-item'; export * from './audio-settings-dropdown-item'; export * from './presentation-dropdown-item'; export * from './nav-bar-item';