Gabriel Rochon | e3ec0d2 | 2022-10-08 14:27:03 -0400 | [diff] [blame] | 1 | /* |
| 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 | */ |
| 18 | import { Box, Card, Grid, Stack, Typography } from '@mui/material'; |
simon | 1170c32 | 2022-10-31 14:51:31 -0400 | [diff] [blame] | 19 | import React from 'react'; |
Gabriel Rochon | e3ec0d2 | 2022-10-08 14:27:03 -0400 | [diff] [blame] | 20 | |
| 21 | import { |
| 22 | CallingChatButton, |
| 23 | CallingEndButton, |
| 24 | CallingExtensionButton, |
| 25 | CallingFullscreenButton, |
| 26 | CallingGroupButton, |
| 27 | CallingMicButton, |
| 28 | CallingRecordButton, |
| 29 | CallingScreenShareButton, |
| 30 | CallingVideoCameraButton, |
| 31 | CallingVolumeButton, |
simon | 1170c32 | 2022-10-31 14:51:31 -0400 | [diff] [blame] | 32 | } from '../components/CallButtons'; |
| 33 | import CallProvider from '../contexts/CallProvider'; |
| 34 | import { useUrlParams } from '../utils/hooks'; |
| 35 | import { CallRouteParams } from './JamiMessenger'; |
Gabriel Rochon | e3ec0d2 | 2022-10-08 14:27:03 -0400 | [diff] [blame] | 36 | |
simon | 1170c32 | 2022-10-31 14:51:31 -0400 | [diff] [blame] | 37 | export default () => { |
| 38 | const { |
| 39 | queryParams: { video }, |
| 40 | } = useUrlParams<CallRouteParams>(); |
| 41 | |
| 42 | return ( |
| 43 | <CallProvider camOn={video === 'true'}> |
| 44 | <CallInterface /> |
| 45 | </CallProvider> |
| 46 | ); |
| 47 | }; |
| 48 | |
| 49 | const CallInterface = () => { |
Gabriel Rochon | e3ec0d2 | 2022-10-08 14:27:03 -0400 | [diff] [blame] | 50 | 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 | ); |
simon | 1170c32 | 2022-10-31 14:51:31 -0400 | [diff] [blame] | 96 | }; |
Gabriel Rochon | e3ec0d2 | 2022-10-08 14:27:03 -0400 | [diff] [blame] | 97 | |
| 98 | const 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 | |
| 111 | const CallInterfacePrimaryButtons = () => { |
| 112 | return ( |
| 113 | <Card sx={{ backgroundColor: 'black', textAlign: 'center' }}> |
| 114 | <CallingMicButton /> |
| 115 | <CallingEndButton /> |
| 116 | <CallingVideoCameraButton /> |
| 117 | </Card> |
| 118 | ); |
| 119 | }; |
| 120 | |
| 121 | const 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 | }; |