Skip to content

Commit a49489c

Browse files
authored
Merge pull request bigbluebutton#23847 from germanocaumo/video-preview-hook
feat(profile): multiple camera support + useVideoPreview hook
2 parents 56b705e + 1efbe16 commit a49489c

11 files changed

Lines changed: 2379 additions & 2585 deletions

File tree

bigbluebutton-html5/imports/ui/components/actions-bar/media-area/media-sharing/camera-as-content/component.tsx

Lines changed: 32 additions & 342 deletions
Large diffs are not rendered by default.

bigbluebutton-html5/imports/ui/components/profile-settings/component.tsx

Lines changed: 572 additions & 739 deletions
Large diffs are not rendered by default.

bigbluebutton-html5/imports/ui/components/profile-settings/styles.ts

Lines changed: 172 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,13 @@
11
import styled, { css, keyframes } from 'styled-components';
22
import {
3-
colorWhite, colorText, colorPrimary,
3+
colorWhite, colorText, colorPrimary, colorDanger,
44
colorGrayDark, colorLink, listItemBgHover, colorBorder,
55
} from '/imports/ui/stylesheets/styled-components/palette';
66
import {
77
smPadding,
8-
contentSidebarGap,
98
contentSidebarPadding,
10-
contentSidebarBottomScrollPadding,
119
contentSidebarBorderRadius,
10+
lgBorderRadius,
1211
} from '/imports/ui/stylesheets/styled-components/general';
1312
import {
1413
fontSizeSmall, fontSizeBase, textFontWeight, titlesFontWeight, fontSizeLarge,
@@ -18,6 +17,9 @@ import { ScrollboxVertical } from '/imports/ui/stylesheets/styled-components/scr
1817
import CameraIcon from '@mui/icons-material/Videocam';
1918
import WbSunny from '@mui/icons-material/WbSunny';
2019
import Headphones from '@mui/icons-material/Headphones';
20+
import AddCircleIcon from '@mui/icons-material/AddCircle';
21+
import ArrowCircleLeft from '@mui/icons-material/ArrowCircleLeftTwoTone';
22+
import ArrowCircleRight from '@mui/icons-material/ArrowCircleRightTwoTone';
2123
import Mic from '@mui/icons-material/Mic';
2224
import Select from '@mui/material/Select';
2325
import Switch from '@mui/material/Switch';
@@ -27,6 +29,7 @@ import FormControlLabel from '@mui/material/FormControlLabel';
2729
import {
2830
HeaderContainer as BaseHeaderContainer,
2931
} from '/imports/ui/components/sidebar-content/styles';
32+
import Button from '/imports/ui/components/common/button/component';
3033

3134
const SimpleButton = styled.button`
3235
cursor: pointer;
@@ -36,13 +39,19 @@ const SimpleButton = styled.button`
3639
outline: none;
3740
`;
3841

39-
const ProfileSettings = styled(ScrollboxVertical)`
42+
const RootContainer = styled.div`
4043
display: flex;
44+
flex-direction: column;
4145
height: 100%;
42-
padding: ${contentSidebarPadding} 0 ${contentSidebarBottomScrollPadding} 0;
46+
background: ${colorWhite};
47+
`;
48+
49+
const ProfileSettings = styled(ScrollboxVertical)`
50+
display: flex;
51+
flex: 1;
4352
margin: 0 ${smPadding} 0;
4453
flex-direction: column;
45-
gap: ${contentSidebarGap};
54+
gap: 0.75rem;
4655
border-radius: ${contentSidebarBorderRadius};
4756
background: ${colorWhite};
4857
overflow-y: auto;
@@ -70,12 +79,50 @@ const VideoPreview = styled.video<VideoPreviewProps>`
7079
`}
7180
`;
7281

73-
const VideoPreviewContent = styled.div`
82+
const VideoPreviewContainer = styled.div`
83+
display: flex;
84+
align-items: center;
85+
justify-content: center;
86+
width: 100%;
7487
padding: 0px ${contentSidebarPadding};
88+
`;
89+
90+
const VideoPreviewWrapper = styled.div`
91+
flex-grow: 1;
92+
display: flex;
93+
justify-content: center;
94+
position: relative;
95+
overflow: hidden;
96+
border-radius: 0.5rem;
97+
`;
98+
99+
const PreviewArrowButton = styled.button<{ position: 'left' | 'right' }>`
100+
background: transparent;
101+
border: none;
102+
font-size: 2rem;
103+
cursor: pointer;
104+
padding: 0;
105+
align-self: stretch;
106+
display: flex;
107+
align-items: center;
108+
position: absolute;
109+
top: 0;
110+
bottom: 0;
111+
z-index: 2;
112+
${({ position }) => (position === 'left' ? 'left: 0;' : 'right: 0;')}
113+
114+
&:hover {
115+
& > svg {
116+
opacity: 0.8;
117+
}
118+
}
119+
`;
120+
121+
const VideoPreviewContent = styled.div`
122+
width: 100%;
75123
display: flex;
76124
justify-content: center;
77125
align-items: center;
78-
z-index: 10;
79126
background: ${colorWhite};
80127
81128
color: ${colorText};
@@ -141,7 +188,7 @@ const UsernameContainer = styled.div`
141188
flex-direction: column;
142189
align-items: flex-start;
143190
width: 100%;
144-
padding: 0px ${contentSidebarPadding};
191+
padding: 0.5rem ${contentSidebarPadding} 0px ${contentSidebarPadding};
145192
`;
146193

147194
const UsernameTitle = styled.div`
@@ -215,12 +262,15 @@ const DevicesSettingsContainer = styled.div`
215262
padding: 0px ${contentSidebarPadding};
216263
`;
217264

218-
const DeviceContainer = styled.div`
265+
const DeviceContainer = styled.div<{ extraPadding?: boolean }>`
219266
display: flex;
220267
flex-direction: row;
221268
flex-shrink: 0;
222269
gap: 1rem;
223270
align-items: center;
271+
${({ extraPadding }) => extraPadding && `
272+
padding-left: 2.5rem;
273+
`}
224274
`;
225275

226276
const Icon = `
@@ -246,9 +296,42 @@ const MicIcon = styled(Mic)`
246296
${Icon}
247297
`;
248298

299+
const ArrowLeftIcon = styled(ArrowCircleLeft)`
300+
${Icon}
301+
width: 2rem !important;
302+
height: 2rem !important;
303+
& path:first-of-type {
304+
fill: ${colorPrimary};
305+
fill-opacity: 1;
306+
opacity: 1;
307+
}
308+
309+
& path:last-of-type {
310+
fill: ${colorWhite};
311+
}
312+
`;
313+
314+
const ArrowRightIcon = styled(ArrowCircleRight)`
315+
${Icon}
316+
width: 2rem !important;
317+
height: 2rem !important;
318+
& path:first-of-type {
319+
fill: ${colorPrimary};
320+
fill-opacity: 1;
321+
opacity: 1;
322+
}
323+
324+
& path:last-of-type {
325+
fill: ${colorWhite};
326+
}
327+
`;
328+
329+
const AddCameraIcon = styled(AddCircleIcon)`
330+
${Icon}
331+
`;
332+
249333
const DeviceSelector = styled(Select)`
250-
height: 3.5rem;
251-
flex: 1;
334+
height: 3rem;
252335
border-radius: 0.5rem !important;
253336
overflow: hidden;
254337
width: 100%;
@@ -272,13 +355,28 @@ const CameraQualitySelector = styled(DeviceSelector)`
272355
width: 100%;
273356
`;
274357

275-
const VirtualBackgroundContainer = styled.div`
358+
const CameraNameLabel = styled.div`
359+
position: absolute;
360+
bottom: 0.5rem;
361+
left: 0.5rem;
362+
background-color: rgba(0, 0, 0, 0.5);
363+
color: ${colorWhite};
364+
padding: 0.25rem 0.5rem;
365+
border-radius: 0.25rem;
366+
font-size: ${fontSizeSmall};
367+
z-index: 2;
368+
`;
369+
370+
const VirtualBackgroundContainer = styled.div<{ extraPadding?: boolean }>`
276371
display: flex;
277372
flex-direction: column;
278373
align-items: flex-start;
279374
gap: ${contentSidebarPadding};
280375
align-self: stretch;
281376
padding: 0px ${contentSidebarPadding};
377+
${({ extraPadding }) => extraPadding && `
378+
padding-left: 3.5rem;
379+
`}
282380
`;
283381

284382
const SwitchTitle = styled(FormControlLabel)`
@@ -395,10 +493,62 @@ const CaptionsTermsLink = styled.a`
395493
color: ${colorLink};
396494
`;
397495

496+
const AddCameraContainer = styled.div`
497+
padding: 0 0.8rem;
498+
`;
499+
500+
const AddCameraButtonAndText = styled.div<{ disabled?: boolean }>`
501+
cursor: pointer;
502+
padding: 0.2rem;
503+
display: flex;
504+
align-items: center;
505+
gap: 1rem;
506+
&:hover {
507+
border-radius: 0.5rem;
508+
background: #E9F0FF;
509+
}
510+
511+
${({ disabled }) => disabled && `
512+
cursor: not-allowed;
513+
opacity: 0.6;
514+
pointer-events: none;
515+
`}
516+
`;
517+
518+
const SaveButtonContainer = styled.div`
519+
padding: 0.5rem 1rem 1rem 1rem;
520+
`;
521+
522+
// @ts-ignore - JS code
523+
const SaveButton = styled(Button)`
524+
border-radius: ${lgBorderRadius};
525+
height: 3.5rem;
526+
width: 100%;
527+
`;
528+
529+
const StopSharingButtonText = styled.div<{ extraPadding?: boolean }>`
530+
padding: 0 1rem;
531+
${({ extraPadding }) => extraPadding && `
532+
padding-left: 3.5rem;
533+
`}
534+
cursor: pointer;
535+
color: ${colorDanger};
536+
text-decoration-line: underline;
537+
text-decoration-style: solid;
538+
text-decoration-skip-ink: auto;
539+
text-decoration-thickness: auto;
540+
text-underline-offset: auto;
541+
text-underline-position: from-font;
542+
`;
543+
398544
export default {
545+
RootContainer,
399546
ProfileSettings,
400547
HeaderContainer,
401548
VideoPreview,
549+
VideoPreviewContainer,
550+
VideoPreviewWrapper,
551+
PreviewArrowButton,
402552
VideoPreviewContent,
403553
VideoCol,
404554
FetchingAnimation,
@@ -417,10 +567,14 @@ export default {
417567
WbSunnyIcon,
418568
HeadphonesIcon,
419569
MicIcon,
570+
ArrowLeftIcon,
571+
ArrowRightIcon,
572+
AddCameraIcon,
420573
DeviceSelector,
421574
CameraQualityContainer,
422575
CameraQualityText,
423576
CameraQualitySelector,
577+
CameraNameLabel,
424578
VirtualBackgroundContainer,
425579
SwitchTitle,
426580
MaterialSwitch,
@@ -432,4 +586,9 @@ export default {
432586
CaptionsLanguageText,
433587
CaptionsTerms,
434588
CaptionsTermsLink,
589+
SaveButton,
590+
SaveButtonContainer,
591+
AddCameraContainer,
592+
AddCameraButtonAndText,
593+
StopSharingButtonText,
435594
};

0 commit comments

Comments
 (0)