blob: adc12c75b6fb646d7a0c1d379d148ecd737cd91a [file] [log] [blame]
Gabriel Rochone3ec0d22022-10-08 14:27:03 -04001/*
2 * Copyright (C) 2022 Savoir-faire Linux Inc.
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU Affero General Public License as
6 * published by the Free Software Foundation; either version 3 of the
7 * License, or (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU Affero General Public License for more details.
13 *
14 * You should have received a copy of the GNU Affero General Public
15 * License along with this program. If not, see
16 * <https://www.gnu.org/licenses/>.
17 */
18import { Box, Card, Grid, Stack, Typography } from '@mui/material';
simon1170c322022-10-31 14:51:31 -040019import React from 'react';
Gabriel Rochone3ec0d22022-10-08 14:27:03 -040020
21import {
22 CallingChatButton,
23 CallingEndButton,
24 CallingExtensionButton,
25 CallingFullscreenButton,
26 CallingGroupButton,
27 CallingMicButton,
28 CallingRecordButton,
29 CallingScreenShareButton,
30 CallingVideoCameraButton,
31 CallingVolumeButton,
simon1170c322022-10-31 14:51:31 -040032} from '../components/CallButtons';
33import CallProvider from '../contexts/CallProvider';
34import { useUrlParams } from '../utils/hooks';
35import { CallRouteParams } from './JamiMessenger';
Gabriel Rochone3ec0d22022-10-08 14:27:03 -040036
simon1170c322022-10-31 14:51:31 -040037export default () => {
38 const {
39 queryParams: { video },
40 } = useUrlParams<CallRouteParams>();
41
42 return (
43 <CallProvider camOn={video === 'true'}>
44 <CallInterface />
45 </CallProvider>
46 );
47};
48
49const CallInterface = () => {
Gabriel Rochone3ec0d22022-10-08 14:27:03 -040050 return (
51 <>
52 <Box sx={{ backgroundColor: 'blue', width: '100%', height: '100%', position: 'absolute' }}>
53 {/* Host video will be shown here */}
54 </Box>
55 <Stack
56 position="absolute"
57 direction="column"
58 spacing={1}
59 margin={2}
60 sx={{ left: 0, right: 0, top: 0, bottom: 0 }}
61 >
62 {/* Top panel with guest information */}
63 <Box>
64 <CallInterfaceInformation />
65 </Box>
66 {/* Guest video, with empty space to be moved around and stickied to walls */}
67 <Box height="100%">
68 <Box
69 sx={{
70 aspectRatio: '16/9',
71 position: 'absolute',
72 right: 0,
73 zIndex: 2,
74 backgroundColor: 'white',
75 borderRadius: '12px',
76 minWidth: '25%',
77 minHeight: '25%',
78 maxWidth: '50%',
79 maxHeight: '50%',
80 }}
81 />
82 </Box>
83 {/* Bottom panel with calling buttons */}
84 <Grid container justifyContent="space-between">
85 <Grid item xs />
86 <Grid item>
87 <CallInterfacePrimaryButtons />
88 </Grid>
89 <Grid item xs sx={{ display: 'flex', justifyContent: 'flex-end' }}>
90 <CallInterfaceSecondaryButtons />
91 </Grid>
92 </Grid>
93 </Stack>
94 </>
95 );
simon1170c322022-10-31 14:51:31 -040096};
Gabriel Rochone3ec0d22022-10-08 14:27:03 -040097
98const CallInterfaceInformation = () => {
99 return (
100 <Stack direction="row" justifyContent="space-between" alignItems="center">
101 <Typography color="white" component="p">
102 Alain Thérieur
103 </Typography>
104 <Typography color="white" component="p">
105 01:23
106 </Typography>
107 </Stack>
108 );
109};
110
111const CallInterfacePrimaryButtons = () => {
112 return (
113 <Card sx={{ backgroundColor: 'black', textAlign: 'center' }}>
114 <CallingMicButton />
115 <CallingEndButton />
116 <CallingVideoCameraButton />
117 </Card>
118 );
119};
120
121const CallInterfaceSecondaryButtons = () => {
122 return (
123 <Card style={{ backgroundColor: 'black' }}>
124 <CallingVolumeButton />
125 <CallingGroupButton />
126 <CallingChatButton />
127 <CallingScreenShareButton />
128 <CallingRecordButton />
129 <CallingExtensionButton />
130 <CallingFullscreenButton />
131 </Card>
132 );
133};