Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
43 commits
Select commit Hold shift + click to select a range
aa29943
patch useOverlayPosition
gabriellsh Apr 17, 2026
6bf4f7a
Fix patch
gabriellsh Apr 23, 2026
88bcbca
feat: Open call in a popup window (WIP)
gabriellsh Apr 14, 2026
0807561
Prevent multiple roots from being added
gabriellsh Apr 14, 2026
eab26c9
fix stream stops playing when switching between popup and regular view
gabriellsh Apr 14, 2026
532da52
refactor: Update document contexts and improve unload callbacks
gabriellsh Apr 30, 2026
1ef4b1d
refactor: Implement global view state
gabriellsh Apr 30, 2026
5981194
fix core provider
gabriellsh Apr 30, 2026
df315ed
Remove widget component from MediaCallViewProvider
gabriellsh Apr 30, 2026
9a4b9d9
refactor: move popout rendering to its own component
gabriellsh Apr 30, 2026
1f054e8
Add Widget and Popout to main provider root
gabriellsh Apr 30, 2026
aec1e1b
Close popout when call ends
gabriellsh Apr 30, 2026
f1ec1a9
feat: Implement a proper view for popout
gabriellsh Apr 30, 2026
57a2511
feat: fullscreen support
gabriellsh Apr 30, 2026
38275e6
feat: Add non-danger variant to ToggleButton
gabriellsh Apr 30, 2026
8a9730c
WIP: Call open in popout warning
gabriellsh Apr 30, 2026
9a307ad
refactor: export callbacks to open/close popout from view context
gabriellsh May 4, 2026
3445035
feat: Translation strings
gabriellsh May 5, 2026
811cf01
fix: Update "document" contexts import
gabriellsh May 7, 2026
53cc2d2
Update Icons
gabriellsh May 7, 2026
ef955ce
chore: Remove "go to dm" button from popout view
gabriellsh May 7, 2026
ed7e14b
fix: Widget "Show call here" buttons styles
gabriellsh May 7, 2026
20e4d61
Remove comments
gabriellsh May 7, 2026
5800c64
refactor: Improve available views tracking logic and reliability
gabriellsh May 11, 2026
8762c53
refactor: Improve popout window opening/closing logic
gabriellsh May 11, 2026
3fe34c7
fix: useAvailableViewTracker filter being applied twice
gabriellsh May 12, 2026
5032343
fix: MediaCallProvider (core) unauthorized context value
gabriellsh May 12, 2026
1511439
chore: Remove old "inRoomView" logic from mocked provider
gabriellsh May 12, 2026
3594937
refactor: Accept onBeforeUnload through usePopoutWindow hook paramete…
gabriellsh May 12, 2026
d0dbe1c
update icons
gabriellsh Jun 2, 2026
fc63946
chore: Generate static landing page for popout
gabriellsh Jun 5, 2026
64d80ae
chore: Add symbolic link for popup landing page to `public` folder
gabriellsh Jun 5, 2026
e1a446b
chore: Missing translation for landing page
gabriellsh Jun 5, 2026
99b76e6
chore: Update `usePopoutWindow` to open in landing page
gabriellsh Jun 5, 2026
7630ad7
chore: Fix landing view generation message
gabriellsh Jun 5, 2026
9ac6734
fix: Packages versions
gabriellsh Jun 5, 2026
14eff1f
fix: Mocked provider types
gabriellsh Jun 5, 2026
e0b53bd
fix: Widget unit tests
gabriellsh Jun 5, 2026
8db281e
fix: Tooltip not showing inside popout
gabriellsh Jun 5, 2026
4af9fa5
chore: Add sharing screen warning on widget when popout is open
gabriellsh Jun 5, 2026
01c9dad
Merge branch 'patch/useOverlayPosition' into feat/mediaCallPopup
gabriellsh Jun 9, 2026
76a2a71
fix: Theme not applied on page open
gabriellsh Jun 11, 2026
784357c
chore: yarn lock
gabriellsh Jun 12, 2026
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
351 changes: 351 additions & 0 deletions .yarn/patches/@react-aria-overlays-npm-3.25.0-2628866e6e.patch

Large diffs are not rendered by default.

5 changes: 3 additions & 2 deletions apps/meteor/client/providers/MediaCallProvider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,9 @@ const MediaCallProvider = ({ children }: { children: ReactNode }) => {

const unauthorizedContextValue = useMemo(
() => ({
inRoomView: false,
setInRoomView: () => undefined,
currentViews: [],
registerView: () => undefined,
unregisterView: () => undefined,
instance: undefined,
signalEmitter: new Emitter<any>(),
audioElement: undefined,
Expand Down
2 changes: 1 addition & 1 deletion apps/meteor/ee/server/services/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
"ws": "~8.19.0"
},
"devDependencies": {
"@rocket.chat/icons": "~0.47.0",
"@rocket.chat/icons": "^0.48.0",
"@types/cookie": "^0.5.4",
"@types/cookie-parser": "^1.4.10",
"@types/ejson": "^2.2.2",
Expand Down
2 changes: 1 addition & 1 deletion apps/meteor/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@
"@rocket.chat/gazzodown": "workspace:^",
"@rocket.chat/http-router": "workspace:^",
"@rocket.chat/i18n": "workspace:^",
"@rocket.chat/icons": "~0.47.0",
"@rocket.chat/icons": "^0.48.0",
"@rocket.chat/instance-status": "workspace:^",
"@rocket.chat/jwt": "workspace:^",
"@rocket.chat/layout": "^0.34.2",
Expand Down
2 changes: 2 additions & 0 deletions apps/meteor/packages/meteor-inject-initial/lib/inject-core.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@ Inject.appUrl = function (url) {
// Avoid serving app HTML for declared routes such as /sockjs/.
if (typeof RoutePolicy !== 'undefined' && RoutePolicy.classify(url)) return false;

if (url === '/voice-call-popup.html') return false;

// we currently return app HTML on all URLs by default
return true;
};
1 change: 1 addition & 0 deletions apps/meteor/public/voice-call-popup.html
2 changes: 1 addition & 1 deletion apps/uikit-playground/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
"@rocket.chat/fuselage-toastbar": "^0.35.2",
"@rocket.chat/fuselage-tokens": "~0.33.2",
"@rocket.chat/fuselage-ui-kit": "workspace:~",
"@rocket.chat/icons": "~0.47.0",
"@rocket.chat/icons": "^0.48.0",
"@rocket.chat/logo": "^0.32.5",
"@rocket.chat/styled": "^0.33.0",
"@rocket.chat/ui-avatar": "workspace:^",
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,7 @@
"@react-aria/i18n@npm:^3.12.5": "patch:@react-aria/i18n@npm%3A3.12.5#~/.yarn/patches/@react-aria-i18n-npm-3.12.5-435edff786.patch",
"@react-aria/toolbar@npm:^3.0.0-nightly.5042": "3.0.0-nightly-fb28ab3b4-241024",
"xml-crypto/@xmldom/xmldom": "0.8.13",
"@react-aria/overlays@npm:^3.25.0": "patch:@react-aria/overlays@npm%3A3.25.0#~/.yarn/patches/@react-aria-overlays-npm-3.25.0-2628866e6e.patch",
"xml-encryption/@xmldom/xmldom": "0.8.13",
"form-data@npm:^2.5.0": "2.5.5",
"form-data@npm:^4.0.0": "4.0.5",
Expand Down
2 changes: 1 addition & 1 deletion packages/core-services/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
"@rocket.chat/core-typings": "workspace:^",
"@rocket.chat/federation-sdk": "0.6.3",
"@rocket.chat/http-router": "workspace:^",
"@rocket.chat/icons": "~0.47.0",
"@rocket.chat/icons": "^0.48.0",
"@rocket.chat/media-signaling": "workspace:^",
"@rocket.chat/message-parser": "workspace:^",
"@rocket.chat/models": "workspace:^",
Expand Down
2 changes: 1 addition & 1 deletion packages/core-typings/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
"test": "echo \"no tests\" && exit 1"
},
"dependencies": {
"@rocket.chat/icons": "~0.47.0",
"@rocket.chat/icons": "^0.48.0",
"@rocket.chat/message-parser": "workspace:^",
"@rocket.chat/ui-kit": "workspace:~",
"typia": "patch:typia@npm%3A9.7.2#~/.yarn/patches/typia-npm-9.7.2-5c5d9c80b4.patch",
Expand Down
2 changes: 1 addition & 1 deletion packages/fuselage-ui-kit/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
"@rocket.chat/fuselage": "^0.78.0",
"@rocket.chat/fuselage-hooks": "^0.41.0",
"@rocket.chat/fuselage-tokens": "~0.33.2",
"@rocket.chat/icons": "~0.47.0",
"@rocket.chat/icons": "^0.48.0",
"@rocket.chat/jest-presets": "workspace:~",
"@rocket.chat/mock-providers": "workspace:^",
"@rocket.chat/styled": "^0.33.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/gazzodown/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
"@rocket.chat/fuselage": "^0.78.0",
"@rocket.chat/fuselage-hooks": "^0.41.0",
"@rocket.chat/fuselage-tokens": "~0.33.2",
"@rocket.chat/icons": "~0.47.0",
"@rocket.chat/icons": "^0.48.0",
"@rocket.chat/jest-presets": "workspace:~",
"@rocket.chat/message-parser": "workspace:^",
"@rocket.chat/styled": "^0.33.0",
Expand Down
8 changes: 7 additions & 1 deletion packages/i18n/src/locales/en.i18n.json
Original file line number Diff line number Diff line change
Expand Up @@ -1052,6 +1052,7 @@
"Call_not_found": "Call not found",
"Call_not_found_error": "This could happen when the call URL is not valid, or you're having connection issues. Please check with the source of the call URL and try again, or talk to your workspace administrator if the problem persists",
"Call_ongoing": "Call ongoing",
"Call_open_separate_window": "Call open in a separate window",
"Call_provider": "Call Provider",
"Call_ringer_volume": "Call ringer volume",
"Call_ringer_volume_hint": "For all incoming voice and video call notifications",
Expand Down Expand Up @@ -2154,6 +2155,7 @@
"Exclude_pinned": "Exclude pinned messages",
"Execute_Synchronization_Now": "Execute Synchronization Now",
"Exit_Full_Screen": "Exit Full Screen",
"Exit_fullscreen": "Exit fullscreen",
"Expand": "Expand",
"Expand_group": "Expand {{group}}",
"Expand_all": "Expand all",
Expand Down Expand Up @@ -4063,6 +4065,7 @@
"Open_Days": "Open days",
"Open_Dialpad": "Open Dialpad",
"Open_dialpad": "Open dialpad",
"Open_in_new_window": "Open in new window",
"Open_Livechats": "Chats in progress",
"Open_Outlook": "Open Outlook",
"Open_call": "Open call",
Expand Down Expand Up @@ -4608,6 +4611,7 @@
"Retrying": "Retrying",
"Retry_Count": "Retry Count",
"Return_to_home": "Return to home",
"Return_to_main_window": "Return to main window",
"Return_to_previous_page": "Return to previous page",
"Return_to_the_queue": "Return back to the Queue",
"Review": "Review",
Expand Down Expand Up @@ -4978,6 +4982,7 @@
"Show_agent_email": "Show agent email",
"Show_agent_info": "Show agent information",
"Show_all": "Show All",
"Show_call_here": "Show call here",
"Show_counter": "Mark as unread",
"Show_default_content": "Show default content",
"Show_email_field": "Show email field",
Expand Down Expand Up @@ -6025,6 +6030,7 @@
"You_are_not_authorized_to_access_this_feature": "You are not authorized to access this feature.",
"You_are_sharing_your_screen": "You are sharing your screen",
"You_can_change_a_different_avatar_too": "You can override the avatar used to post from this integration.",
"You_can_close_this_window": "You can close this window",
"You_can_close_this_window_now": "You can close this window now.",
"You_can_do_from_account_preferences": "You can do this later from your account preferences",
"You_can_search_using_RegExp_eg": "You can search using <a href=\"https://en.wikipedia.org/wiki/Regular_expression\" target=\"_blank\">Regular Expression</a>. e.g. <code class='code-colors inline'>/^text$/i</code>",
Expand Down Expand Up @@ -7267,4 +7273,4 @@
"Avatar_preview_updated": "Avatar preview updated",
"Select_message_from_user": "Select message from {{username}}",
"Select_message_from_user_with_preview": "Select message from {{username}}: {{message}}"
}
}
2 changes: 1 addition & 1 deletion packages/storybook-config/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
},
"devDependencies": {
"@rocket.chat/fuselage": "^0.78.0",
"@rocket.chat/icons": "~0.47.0",
"@rocket.chat/icons": "^0.48.0",
"@rocket.chat/tsconfig": "workspace:*",
"@storybook/react": "^8.6.18",
"eslint": "~9.39.4",
Expand Down
2 changes: 1 addition & 1 deletion packages/ui-avatar/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
"@rocket.chat/fuselage": "^0.78.0",
"@rocket.chat/fuselage-hooks": "^0.41.0",
"@rocket.chat/fuselage-tokens": "~0.33.2",
"@rocket.chat/icons": "~0.47.0",
"@rocket.chat/icons": "^0.48.0",
"@rocket.chat/ui-contexts": "workspace:^",
"@types/react": "~18.3.28",
"@types/react-dom": "~18.3.7",
Expand Down
2 changes: 1 addition & 1 deletion packages/ui-client/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
"@rocket.chat/fuselage": "^0.78.0",
"@rocket.chat/fuselage-hooks": "^0.41.0",
"@rocket.chat/fuselage-tokens": "~0.33.2",
"@rocket.chat/icons": "~0.47.0",
"@rocket.chat/icons": "^0.48.0",
"@rocket.chat/jest-presets": "workspace:~",
"@rocket.chat/layout": "^0.34.2",
"@rocket.chat/logo": "^0.32.5",
Expand Down
2 changes: 1 addition & 1 deletion packages/ui-composer/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
"@rocket.chat/fuselage": "^0.78.0",
"@rocket.chat/fuselage-hooks": "^0.41.0",
"@rocket.chat/fuselage-tokens": "~0.33.2",
"@rocket.chat/icons": "~0.47.0",
"@rocket.chat/icons": "^0.48.0",
"@rocket.chat/jest-presets": "workspace:~",
"@rocket.chat/tsconfig": "workspace:*",
"@rocket.chat/ui-client": "workspace:~",
Expand Down
2 changes: 1 addition & 1 deletion packages/ui-contexts/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
"@rocket.chat/fuselage-hooks": "^0.41.0",
"@rocket.chat/fuselage-tokens": "~0.33.2",
"@rocket.chat/i18n": "workspace:~",
"@rocket.chat/icons": "~0.47.0",
"@rocket.chat/icons": "^0.48.0",
"@rocket.chat/jest-presets": "workspace:~",
"@rocket.chat/rest-typings": "workspace:^",
"@rocket.chat/tools": "workspace:~",
Expand Down
2 changes: 1 addition & 1 deletion packages/ui-kit/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
"typia": "patch:typia@npm%3A9.7.2#~/.yarn/patches/typia-npm-9.7.2-5c5d9c80b4.patch"
},
"devDependencies": {
"@rocket.chat/icons": "~0.47.0",
"@rocket.chat/icons": "^0.48.0",
"@rocket.chat/jest-presets": "workspace:~",
"@rocket.chat/tsconfig": "workspace:*",
"@types/jest": "~30.0.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/ui-video-conf/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
"@rocket.chat/fuselage": "^0.78.0",
"@rocket.chat/fuselage-hooks": "^0.41.0",
"@rocket.chat/fuselage-tokens": "~0.33.2",
"@rocket.chat/icons": "~0.47.0",
"@rocket.chat/icons": "^0.48.0",
"@rocket.chat/jest-presets": "workspace:~",
"@rocket.chat/styled": "^0.33.0",
"@rocket.chat/tsconfig": "workspace:*",
Expand Down
7 changes: 5 additions & 2 deletions packages/ui-voip/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@
"/dist"
],
"scripts": {
"build": "rm -rf dist && tsc -p tsconfig.build.json",
"build": "rm -rf dist && tsc -p tsconfig.build.json && yarn build:post",
"build:post": "node --no-warnings dist/generate-landing-view.js && rm -f dist/generate-landing-view.*",
"dev": "tsc -p tsconfig.build.json --watch --preserveWatchOutput",
"lint": "eslint .",
"lint:fix": "eslint --fix .",
Expand All @@ -34,7 +35,7 @@
"@rocket.chat/fuselage-hooks": "^0.41.0",
"@rocket.chat/fuselage-tokens": "~0.33.2",
"@rocket.chat/fuselage-ui-kit": "workspace:^",
"@rocket.chat/icons": "~0.47.0",
"@rocket.chat/icons": "^0.48.0",
"@rocket.chat/jest-presets": "workspace:~",
"@rocket.chat/mock-providers": "workspace:~",
"@rocket.chat/styled": "^0.33.0",
Expand All @@ -58,13 +59,15 @@
"@testing-library/user-event": "~14.6.1",
"@types/jest": "~30.0.0",
"@types/jest-axe": "~3.5.9",
"@types/node": "~22.19.17",
"@types/react": "~18.3.28",
"@types/react-dom": "~18.3.7",
"date-fns": "~4.1.0",
"eslint": "~9.39.4",
"i18next": "~23.4.9",
"jest": "~30.2.0",
"jest-axe": "~10.0.0",
"jsdom": "^26.1.0",
"react": "~18.3.1",
"react-dom": "~18.3.1",
"react-virtuoso": "~4.12.8",
Expand Down
22 changes: 17 additions & 5 deletions packages/ui-voip/src/components/ToggleButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,20 +11,32 @@ type ToggleButtonProps = {
onToggle?: () => void;
} & Omit<ComponentProps<typeof IconButton>, 'icon' | 'title' | 'aria-label' | 'disabled' | 'onClick'>;

const ToggleButton = ({ disabled, label, pressed, icons, titles, onToggle, ...props }: ToggleButtonProps) => {
const ToggleButton = ({
disabled,
label,
pressed,
icons,
titles,
onToggle,
danger = true,
secondary = true,
tiny = false,
...props
}: ToggleButtonProps) => {
const iconName = icons[pressed ? 1 : 0];
const title = titles[pressed ? 1 : 0];
const iconColor = pressed ? 'font-danger' : undefined;
const iconColor = pressed && danger ? 'font-danger' : undefined;

const size = tiny ? { tiny: true } : { medium: true };

return (
<IconButton
{...props}
label={label}
medium
secondary
{...size}
secondary={secondary}
icon={<Icon size={16} color={iconColor} name={iconName} />}
title={title}
pressed={pressed}
aria-label={label}
disabled={disabled}
onClick={onToggle}
Expand Down
15 changes: 11 additions & 4 deletions packages/ui-voip/src/context/MediaCallInstanceContext.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,21 @@ export type Signals = {
toggleWidget: { peerInfo?: PeerInfo };
};

export type AvailableViews = 'room' | 'popout' | 'widget';

type RegisterView = (view: AvailableViews) => void;
type UnregisterView = (view: AvailableViews) => void;

type MediaCallInstanceContextValue = {
instance: MediaSignalingSession | undefined;
signalEmitter: Emitter<Signals>;
audioElement: RefObject<HTMLAudioElement | null> | undefined;
openRoomId: string | undefined;
inRoomView: boolean;
currentViews: AvailableViews[];
setOpenRoomId: (openRoomId: string | undefined) => void;
getAutocompleteOptions: (filter: string) => Promise<PeerAutocompleteOptions[]>;
setInRoomView: (inRoomView: boolean) => void;
registerView: RegisterView;
unregisterView: UnregisterView;
};

export const MediaCallInstanceContext = createContext<MediaCallInstanceContextValue>({
Expand All @@ -28,8 +34,9 @@ export const MediaCallInstanceContext = createContext<MediaCallInstanceContextVa
openRoomId: undefined,
setOpenRoomId: () => undefined,
getAutocompleteOptions: () => Promise.resolve([]),
inRoomView: false,
setInRoomView: () => undefined,
currentViews: [],
registerView: () => undefined,
unregisterView: () => undefined,
});

export const useMediaCallInstance = (): MediaCallInstanceContextValue => useContext(MediaCallInstanceContext);
4 changes: 4 additions & 0 deletions packages/ui-voip/src/context/MediaCallViewContext.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ type MediaCallViewContextValue = {
onAccept: () => Promise<void>;
onSelectPeer: (peerInfo: PeerInfo) => void;
onToggleScreenSharing: () => void;
onOpenPopout: () => void;
onClosePopout: () => void;
streams: MediaCallStreams;
widgetPositionTracker?: {
onChangePosition: (position: LastKnownPosition | null) => void;
Expand Down Expand Up @@ -56,6 +58,8 @@ export const defaultMediaCallContextValue: MediaCallViewContextValue = {
onAccept: () => Promise.resolve(undefined),
onSelectPeer: () => undefined,
onToggleScreenSharing: () => undefined,
onOpenPopout: () => undefined,
onClosePopout: () => undefined,
streams: {},
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,9 @@ const createWrapper = (instance: MockInstance | undefined) => {
const wrapper = ({ children }: { children?: ReactNode }) => (
<MediaCallInstanceContext.Provider
value={{
inRoomView: false,
setInRoomView: () => undefined,
currentViews: [],
registerView: () => undefined,
unregisterView: () => undefined,
instance: instance as any,
signalEmitter: new Emitter<Signals>(),
audioElement: undefined,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,9 @@ const createWrapper = (instance: MockInstance | undefined) => {
const wrapper = ({ children }: { children?: ReactNode }) => (
<MediaCallInstanceContext.Provider
value={{
inRoomView: false,
setInRoomView: () => undefined,
currentViews: [],
registerView: () => undefined,
unregisterView: () => undefined,
instance: instance as any,
signalEmitter: new Emitter<Signals>(),
audioElement: undefined,
Expand Down
5 changes: 3 additions & 2 deletions packages/ui-voip/src/context/usePeerAutocomplete.spec.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,9 @@ const appRoot = () =>
.wrap((children) => (
<MediaCallInstanceContext.Provider
value={{
inRoomView: false,
setInRoomView: () => undefined,
currentViews: [],
registerView: () => undefined,
unregisterView: () => undefined,
instance: undefined,
signalEmitter: new Emitter<Signals>(),
audioElement: undefined,
Expand Down
18 changes: 18 additions & 0 deletions packages/ui-voip/src/context/useRegisterView.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import { useLayoutEffect } from 'react';

import { useMediaCallInstance } from '.';
import type { AvailableViews } from './MediaCallInstanceContext';

const useRegisterView = (view: AvailableViews): AvailableViews[] => {
const { currentViews, registerView, unregisterView } = useMediaCallInstance();

useLayoutEffect(() => {
registerView(view);

return () => unregisterView(view);
}, [view, registerView, unregisterView]);

return currentViews;
};

export default useRegisterView;
Loading
Loading