diff --git a/apps/meteor/client/views/room/contextualBar/VideoConference/VideoConfPopups/VideoConfPopup/TimedVideoConfPopup.tsx b/apps/meteor/client/views/room/contextualBar/VideoConference/VideoConfPopups/VideoConfPopup/TimedVideoConfPopup.tsx index 0cd91448563db..1094bb1821d03 100644 --- a/apps/meteor/client/views/room/contextualBar/VideoConference/VideoConfPopups/VideoConfPopup/TimedVideoConfPopup.tsx +++ b/apps/meteor/client/views/room/contextualBar/VideoConference/VideoConfPopups/VideoConfPopup/TimedVideoConfPopup.tsx @@ -9,7 +9,8 @@ import { useVideoConfDismissOutgoing, } from '@rocket.chat/ui-video-conf'; import type { ReactElement } from 'react'; -import { useState } from 'react'; +import { useEffect, useState } from 'react'; +import { useFocusManager } from 'react-aria'; import IncomingPopup from './IncomingPopup'; import OutgoingPopup from './OutgoingPopup'; @@ -38,8 +39,13 @@ const TimedVideoConfPopup = ({ const dismissCall = useVideoConfDismissCall(); const startCall = useVideoConfStartCall(); const dismissOutgoing = useVideoConfDismissOutgoing(); + const focusManager = useFocusManager(); const room = useUserRoom(rid); + useEffect(() => { + focusManager?.focusFirst(); + }, [focusManager]); + if (!room) { return null; } diff --git a/apps/meteor/client/views/room/contextualBar/VideoConference/VideoConfPopups/VideoConfPopups.tsx b/apps/meteor/client/views/room/contextualBar/VideoConference/VideoConfPopups/VideoConfPopups.tsx index 9a0c12b5b44d7..8840b15cd8728 100644 --- a/apps/meteor/client/views/room/contextualBar/VideoConference/VideoConfPopups/VideoConfPopups.tsx +++ b/apps/meteor/client/views/room/contextualBar/VideoConference/VideoConfPopups/VideoConfPopups.tsx @@ -5,14 +5,16 @@ import { useVideoConfIsCalling, useVideoConfIsRinging, useVideoConfIncomingCalls, + VideoConfPopupSkeleton, } from '@rocket.chat/ui-video-conf'; import type { ReactElement } from 'react'; -import { useEffect, useMemo } from 'react'; +import { lazy, Suspense, useEffect, useMemo } from 'react'; import { FocusScope } from 'react-aria'; -import VideoConfPopup from './VideoConfPopup'; import VideoConfPopupPortal from '../../../../../portals/VideoConfPopupPortal'; +const VideoConfPopup = lazy(() => import('./VideoConfPopup')); + const VideoConfPopups = ({ children }: { children?: VideoConfPopupPayload }): ReactElement => { const { callSounds } = useCustomSound(); const incomingCalls = useVideoConfIncomingCalls(); @@ -48,9 +50,11 @@ const VideoConfPopups = ({ children }: { children?: VideoConfPopupPayload }): Re {(children ? [children, ...popups] : popups).map(({ id, rid, isReceiving }, index = 1) => ( - - - + }> + + + + ))} diff --git a/packages/ui-video-conf/package.json b/packages/ui-video-conf/package.json index 3ee9a0c4637dc..53c0edfd32e48 100644 --- a/packages/ui-video-conf/package.json +++ b/packages/ui-video-conf/package.json @@ -8,10 +8,10 @@ "/dist" ], "scripts": { - "build": "tsc -p tsconfig.build.json", + "build": "rm -rf dist && tsc -p tsconfig.build.json", "dev": "tsc -p tsconfig.build.json --watch --preserveWatchOutput", - "eslint": "eslint --ext .js,.jsx,.ts,.tsx .", - "eslint:fix": "eslint --ext .js,.jsx,.ts,.tsx . --fix", + "lint": "eslint --ext .js,.jsx,.ts,.tsx .", + "lint:fix": "eslint --ext .js,.jsx,.ts,.tsx . --fix", "storybook": "storybook dev -p 6006", "test": "jest", "testunit": "jest", diff --git a/packages/ui-video-conf/src/VideoConfMessage/VideoConfMessageIcon.tsx b/packages/ui-video-conf/src/VideoConfMessage/VideoConfMessageIcon.tsx index ab14f69f3610d..782931a6dede7 100644 --- a/packages/ui-video-conf/src/VideoConfMessage/VideoConfMessageIcon.tsx +++ b/packages/ui-video-conf/src/VideoConfMessage/VideoConfMessageIcon.tsx @@ -1,4 +1,4 @@ -import { Box, Icon, Palette } from '@rocket.chat/fuselage'; +import { Box, Icon } from '@rocket.chat/fuselage'; import type { ReactElement } from 'react'; type VideoConfMessageIconProps = { @@ -8,18 +8,18 @@ type VideoConfMessageIconProps = { const styles = { ended: { icon: 'phone-off', - color: Palette.text['font-hint'].toString(), - backgroundColor: Palette.surface['surface-neutral'].toString(), + color: 'hint', + backgroundColor: 'surface-neutral', }, incoming: { icon: 'phone-in', - color: Palette.statusColor['status-font-on-info'].toString(), - backgroundColor: Palette.status['status-background-info'].toString(), + color: 'status-font-on-info', + backgroundColor: 'status-background-info', }, outgoing: { icon: 'phone', - color: Palette.statusColor['status-font-on-success'].toString(), - backgroundColor: Palette.status['status-background-success'].toString(), + color: 'status-font-on-success', + backgroundColor: 'status-background-success', }, } as const; diff --git a/packages/ui-video-conf/src/VideoConfPopup/VideoConfPopup.stories.tsx b/packages/ui-video-conf/src/VideoConfPopup/VideoConfPopup.stories.tsx index 30fac83da1014..0782c5f52916a 100644 --- a/packages/ui-video-conf/src/VideoConfPopup/VideoConfPopup.stories.tsx +++ b/packages/ui-video-conf/src/VideoConfPopup/VideoConfPopup.stories.tsx @@ -12,6 +12,7 @@ import VideoConfPopupFooter from './VideoConfPopupFooter'; import VideoConfPopupFooterButtons from './VideoConfPopupFooterButtons'; import VideoConfPopupHeader from './VideoConfPopupHeader'; import VideoConfPopupInfo from './VideoConfPopupInfo'; +import VideoConfPopupSkeleton from './VideoConfPopupSkeleton'; import VideoConfPopupTitle from './VideoConfPopupTitle'; export default { @@ -52,3 +53,5 @@ export const StartCall: StoryFn = () => ( ); + +export const Skeleton: StoryFn = () => ; diff --git a/packages/ui-video-conf/src/VideoConfPopup/VideoConfPopup.tsx b/packages/ui-video-conf/src/VideoConfPopup/VideoConfPopup.tsx index c7d938c7625c5..4ed266c175741 100644 --- a/packages/ui-video-conf/src/VideoConfPopup/VideoConfPopup.tsx +++ b/packages/ui-video-conf/src/VideoConfPopup/VideoConfPopup.tsx @@ -5,7 +5,7 @@ import type { ReactNode, ReactElement, HTMLAttributes } from 'react'; export const VideoConfPopupContainer = styled('div', ({ position: _position, ...props }: { position?: number }) => props)` width: 100%; - position: absolute; + position: relative; box-shadow: 0px 0px 1px 0px ${Palette.shadow['shadow-elevation-2x'].toString()}, 0px 0px 12px 0px ${Palette.shadow['shadow-elevation-2y'].toString()}; diff --git a/packages/ui-video-conf/src/VideoConfPopup/VideoConfPopupHeader.tsx b/packages/ui-video-conf/src/VideoConfPopup/VideoConfPopupHeader.tsx index 721bd20da515b..a939af1f3eba5 100644 --- a/packages/ui-video-conf/src/VideoConfPopup/VideoConfPopupHeader.tsx +++ b/packages/ui-video-conf/src/VideoConfPopup/VideoConfPopupHeader.tsx @@ -2,7 +2,7 @@ import { Box } from '@rocket.chat/fuselage'; import type { ReactNode, ReactElement } from 'react'; const VideoConfPopupHeader = ({ children }: { children: ReactNode }): ReactElement => ( - + {children} ); diff --git a/packages/ui-video-conf/src/VideoConfPopup/VideoConfPopupSkeleton.tsx b/packages/ui-video-conf/src/VideoConfPopup/VideoConfPopupSkeleton.tsx new file mode 100644 index 0000000000000..14c57b9728eb2 --- /dev/null +++ b/packages/ui-video-conf/src/VideoConfPopup/VideoConfPopupSkeleton.tsx @@ -0,0 +1,28 @@ +import { Box, Skeleton } from '@rocket.chat/fuselage'; +import { ComponentProps } from 'react'; + +import VideoConfPopup from './VideoConfPopup'; +import VideoConfPopupContent from './VideoConfPopupContent'; +import VideoConfPopupFooter from './VideoConfPopupFooter'; +import VideoConfPopupHeader from './VideoConfPopupHeader'; + +type VideoConfPopupSkeletonProps = Omit, 'children'>; + +const VideoConfPopupSkeleton = (props: VideoConfPopupSkeletonProps) => ( + + + + + + + + + + + + + + +); + +export default VideoConfPopupSkeleton; diff --git a/packages/ui-video-conf/src/VideoConfPopup/__snapshots__/VideoConfPopup.spec.tsx.snap b/packages/ui-video-conf/src/VideoConfPopup/__snapshots__/VideoConfPopup.spec.tsx.snap index c4ef86dd17ed9..35d8d27a68986 100644 --- a/packages/ui-video-conf/src/VideoConfPopup/__snapshots__/VideoConfPopup.spec.tsx.snap +++ b/packages/ui-video-conf/src/VideoConfPopup/__snapshots__/VideoConfPopup.spec.tsx.snap @@ -1,5 +1,54 @@ // Jest Snapshot v1, https://jestjs.io/docs/snapshot-testing +exports[`renders Skeleton without crashing 1`] = ` + +
+
+ +
+
+ +`; + exports[`renders StartCall without crashing 1`] = `
@@ -8,14 +57,14 @@ exports[`renders StartCall without crashing 1`] = ` >