simon | 1170c32 | 2022-10-31 14:51:31 -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 | */ |
simon | 33c0618 | 2022-11-02 17:39:31 -0400 | [diff] [blame] | 18 | |
simon | f929a36 | 2022-11-18 16:53:45 -0500 | [diff] [blame] | 19 | import { IconButton, IconButtonProps, PaletteColor } from '@mui/material'; |
| 20 | import { styled, Theme } from '@mui/material/styles'; |
simon | 492e840 | 2022-11-29 16:48:37 -0500 | [diff] [blame] | 21 | import { ChangeEvent, useContext, useMemo } from 'react'; |
simon | 4e7445c | 2022-11-16 21:18:46 -0500 | [diff] [blame] | 22 | import { useTranslation } from 'react-i18next'; |
simon | 1170c32 | 2022-10-31 14:51:31 -0400 | [diff] [blame] | 23 | |
Charlie | 9c8779e | 2022-11-29 20:10:56 -0500 | [diff] [blame] | 24 | import { CallContext, CallStatus } from '../contexts/CallProvider'; |
simon | 9076a9a | 2022-11-29 17:13:01 -0500 | [diff] [blame] | 25 | import { |
| 26 | ExpandableButton, |
| 27 | ExpandableButtonProps, |
| 28 | ExpandMenuRadioOption, |
| 29 | ShapedButtonProps, |
| 30 | ToggleIconButton, |
| 31 | } from './Button'; |
simon | 1170c32 | 2022-10-31 14:51:31 -0400 | [diff] [blame] | 32 | import { |
| 33 | CallEndIcon, |
| 34 | ChatBubbleIcon, |
| 35 | ExtensionIcon, |
simon | 33c0618 | 2022-11-02 17:39:31 -0400 | [diff] [blame] | 36 | FileIcon, |
| 37 | FullScreenIcon, |
simon | 1170c32 | 2022-10-31 14:51:31 -0400 | [diff] [blame] | 38 | GroupAddIcon, |
| 39 | MicroIcon, |
| 40 | MicroOffIcon, |
simon | 33c0618 | 2022-11-02 17:39:31 -0400 | [diff] [blame] | 41 | MoreVerticalIcon, |
simon | 2d3b653 | 2022-11-08 21:01:57 -0500 | [diff] [blame] | 42 | PlaceAudioCallIcon, |
simon | 1170c32 | 2022-10-31 14:51:31 -0400 | [diff] [blame] | 43 | RecordingIcon, |
simon | 2d3b653 | 2022-11-08 21:01:57 -0500 | [diff] [blame] | 44 | RoundCloseIcon, |
simon | 33c0618 | 2022-11-02 17:39:31 -0400 | [diff] [blame] | 45 | ScreenShareArrowIcon, |
| 46 | ScreenShareRegularIcon, |
| 47 | ScreenShareScreenAreaIcon, |
simon | 1170c32 | 2022-10-31 14:51:31 -0400 | [diff] [blame] | 48 | VideoCameraIcon, |
| 49 | VideoCameraOffIcon, |
| 50 | VolumeIcon, |
Gabriel Rochon | 8321a0d | 2022-11-06 23:18:36 -0500 | [diff] [blame] | 51 | WindowIcon, |
simon | 1170c32 | 2022-10-31 14:51:31 -0400 | [diff] [blame] | 52 | } from './SvgIcon'; |
| 53 | |
Gabriel Rochon | 8321a0d | 2022-11-06 23:18:36 -0500 | [diff] [blame] | 54 | const CallButton = styled((props: ExpandableButtonProps) => { |
| 55 | return <ExpandableButton {...props} />; |
| 56 | })({ |
simon | 2d3b653 | 2022-11-08 21:01:57 -0500 | [diff] [blame] | 57 | color: 'white', |
Gabriel Rochon | 8321a0d | 2022-11-06 23:18:36 -0500 | [diff] [blame] | 58 | '&:hover': { |
| 59 | backgroundColor: 'rgba(255, 255, 255, 0.15)', |
| 60 | }, |
Gabriel Rochon | 8321a0d | 2022-11-06 23:18:36 -0500 | [diff] [blame] | 61 | }); |
| 62 | |
simon | 2d3b653 | 2022-11-08 21:01:57 -0500 | [diff] [blame] | 63 | const ColoredCallButton = styled( |
| 64 | ({ |
simon | f929a36 | 2022-11-18 16:53:45 -0500 | [diff] [blame] | 65 | paletteColor, |
| 66 | Icon, |
simon | 2d3b653 | 2022-11-08 21:01:57 -0500 | [diff] [blame] | 67 | ...props |
simon | f929a36 | 2022-11-18 16:53:45 -0500 | [diff] [blame] | 68 | }: ShapedButtonProps & { |
| 69 | paletteColor?: PaletteColor | ((theme: Theme) => PaletteColor); |
simon | 2d3b653 | 2022-11-08 21:01:57 -0500 | [diff] [blame] | 70 | }) => { |
simon | f929a36 | 2022-11-18 16:53:45 -0500 | [diff] [blame] | 71 | return ( |
| 72 | <IconButton {...props} disableRipple={true}> |
| 73 | <Icon fontSize="inherit" /> |
| 74 | </IconButton> |
| 75 | ); |
simon | 2d3b653 | 2022-11-08 21:01:57 -0500 | [diff] [blame] | 76 | } |
simon | f929a36 | 2022-11-18 16:53:45 -0500 | [diff] [blame] | 77 | )(({ theme, paletteColor = theme.palette.primary }) => { |
| 78 | if (typeof paletteColor === 'function') { |
| 79 | paletteColor = paletteColor(theme); |
| 80 | } |
| 81 | |
simon | 2d3b653 | 2022-11-08 21:01:57 -0500 | [diff] [blame] | 82 | return { |
simon | f929a36 | 2022-11-18 16:53:45 -0500 | [diff] [blame] | 83 | color: paletteColor.contrastText, |
| 84 | backgroundColor: paletteColor.dark, |
simon | 2d3b653 | 2022-11-08 21:01:57 -0500 | [diff] [blame] | 85 | '&:hover': { |
simon | f929a36 | 2022-11-18 16:53:45 -0500 | [diff] [blame] | 86 | backgroundColor: paletteColor.main, |
simon | 2d3b653 | 2022-11-08 21:01:57 -0500 | [diff] [blame] | 87 | }, |
| 88 | }; |
Gabriel Rochon | 8321a0d | 2022-11-06 23:18:36 -0500 | [diff] [blame] | 89 | }); |
| 90 | |
simon | 33c0618 | 2022-11-02 17:39:31 -0400 | [diff] [blame] | 91 | export const CallingChatButton = (props: ExpandableButtonProps) => { |
simon | f9d78f2 | 2022-11-25 15:47:15 -0500 | [diff] [blame] | 92 | const { setIsChatShown } = useContext(CallContext); |
| 93 | return ( |
| 94 | <CallButton |
| 95 | aria-label="chat" |
| 96 | Icon={ChatBubbleIcon} |
| 97 | onClick={() => { |
| 98 | setIsChatShown((v) => !v); |
| 99 | }} |
| 100 | {...props} |
| 101 | /> |
| 102 | ); |
simon | 1170c32 | 2022-10-31 14:51:31 -0400 | [diff] [blame] | 103 | }; |
simon | 33c0618 | 2022-11-02 17:39:31 -0400 | [diff] [blame] | 104 | |
| 105 | export const CallingEndButton = (props: ExpandableButtonProps) => { |
simon | accd802 | 2022-11-24 15:04:53 -0500 | [diff] [blame] | 106 | const { endCall } = useContext(CallContext); |
simon | f929a36 | 2022-11-18 16:53:45 -0500 | [diff] [blame] | 107 | return ( |
| 108 | <ColoredCallButton |
| 109 | paletteColor={(theme) => theme.palette.error} |
| 110 | onClick={() => { |
simon | accd802 | 2022-11-24 15:04:53 -0500 | [diff] [blame] | 111 | endCall(); |
simon | f929a36 | 2022-11-18 16:53:45 -0500 | [diff] [blame] | 112 | }} |
| 113 | aria-label="call end" |
| 114 | Icon={CallEndIcon} |
| 115 | {...props} |
| 116 | /> |
| 117 | ); |
simon | 1170c32 | 2022-10-31 14:51:31 -0400 | [diff] [blame] | 118 | }; |
simon | 33c0618 | 2022-11-02 17:39:31 -0400 | [diff] [blame] | 119 | |
| 120 | export const CallingExtensionButton = (props: ExpandableButtonProps) => { |
Gabriel Rochon | 8321a0d | 2022-11-06 23:18:36 -0500 | [diff] [blame] | 121 | return <CallButton aria-label="extensions" Icon={ExtensionIcon} {...props} />; |
simon | 1170c32 | 2022-10-31 14:51:31 -0400 | [diff] [blame] | 122 | }; |
simon | 33c0618 | 2022-11-02 17:39:31 -0400 | [diff] [blame] | 123 | |
| 124 | export const CallingFullScreenButton = (props: ExpandableButtonProps) => { |
simon | 2a5cf14 | 2022-11-25 15:47:35 -0500 | [diff] [blame] | 125 | const { setIsFullscreen } = useContext(CallContext); |
| 126 | return ( |
| 127 | <CallButton |
| 128 | aria-label="full screen" |
| 129 | Icon={FullScreenIcon} |
| 130 | onClick={() => { |
| 131 | setIsFullscreen((v) => !v); |
| 132 | }} |
| 133 | {...props} |
| 134 | /> |
| 135 | ); |
simon | 1170c32 | 2022-10-31 14:51:31 -0400 | [diff] [blame] | 136 | }; |
simon | 33c0618 | 2022-11-02 17:39:31 -0400 | [diff] [blame] | 137 | |
| 138 | export const CallingGroupButton = (props: ExpandableButtonProps) => { |
Gabriel Rochon | 8321a0d | 2022-11-06 23:18:36 -0500 | [diff] [blame] | 139 | return <CallButton aria-label="group options" Icon={GroupAddIcon} {...props} />; |
simon | 1170c32 | 2022-10-31 14:51:31 -0400 | [diff] [blame] | 140 | }; |
simon | 33c0618 | 2022-11-02 17:39:31 -0400 | [diff] [blame] | 141 | |
| 142 | export const CallingMoreVerticalButton = (props: ExpandableButtonProps) => { |
Gabriel Rochon | 8321a0d | 2022-11-06 23:18:36 -0500 | [diff] [blame] | 143 | return <CallButton aria-label="more vertical" Icon={MoreVerticalIcon} {...props} />; |
simon | 1170c32 | 2022-10-31 14:51:31 -0400 | [diff] [blame] | 144 | }; |
simon | 33c0618 | 2022-11-02 17:39:31 -0400 | [diff] [blame] | 145 | |
| 146 | export const CallingRecordButton = (props: ExpandableButtonProps) => { |
Gabriel Rochon | 8321a0d | 2022-11-06 23:18:36 -0500 | [diff] [blame] | 147 | return <CallButton aria-label="recording options" Icon={RecordingIcon} {...props} />; |
simon | 33c0618 | 2022-11-02 17:39:31 -0400 | [diff] [blame] | 148 | }; |
| 149 | |
| 150 | export const CallingScreenShareButton = (props: ExpandableButtonProps) => { |
simon | 4e7445c | 2022-11-16 21:18:46 -0500 | [diff] [blame] | 151 | const { t } = useTranslation(); |
simon | 1170c32 | 2022-10-31 14:51:31 -0400 | [diff] [blame] | 152 | return ( |
Gabriel Rochon | 8321a0d | 2022-11-06 23:18:36 -0500 | [diff] [blame] | 153 | <CallButton |
simon | 33c0618 | 2022-11-02 17:39:31 -0400 | [diff] [blame] | 154 | aria-label="screen share" |
simon | 571240f | 2022-11-29 23:59:27 -0500 | [diff] [blame] | 155 | expandMenuOnClick |
simon | 33c0618 | 2022-11-02 17:39:31 -0400 | [diff] [blame] | 156 | Icon={ScreenShareArrowIcon} |
| 157 | expandMenuOptions={[ |
| 158 | { |
simon | 4e7445c | 2022-11-16 21:18:46 -0500 | [diff] [blame] | 159 | description: t('share_screen'), |
simon | 33c0618 | 2022-11-02 17:39:31 -0400 | [diff] [blame] | 160 | icon: <ScreenShareRegularIcon />, |
| 161 | }, |
| 162 | { |
simon | 4e7445c | 2022-11-16 21:18:46 -0500 | [diff] [blame] | 163 | description: t('share_window'), |
Gabriel Rochon | 8321a0d | 2022-11-06 23:18:36 -0500 | [diff] [blame] | 164 | icon: <WindowIcon />, |
| 165 | }, |
| 166 | { |
simon | 4e7445c | 2022-11-16 21:18:46 -0500 | [diff] [blame] | 167 | description: t('share_screen_area'), |
simon | 33c0618 | 2022-11-02 17:39:31 -0400 | [diff] [blame] | 168 | icon: <ScreenShareScreenAreaIcon />, |
| 169 | }, |
| 170 | { |
simon | 4e7445c | 2022-11-16 21:18:46 -0500 | [diff] [blame] | 171 | description: t('share_file'), |
simon | 33c0618 | 2022-11-02 17:39:31 -0400 | [diff] [blame] | 172 | icon: <FileIcon />, |
| 173 | }, |
| 174 | ]} |
| 175 | {...props} |
| 176 | /> |
simon | 1170c32 | 2022-10-31 14:51:31 -0400 | [diff] [blame] | 177 | ); |
| 178 | }; |
| 179 | |
simon | 9076a9a | 2022-11-29 17:13:01 -0500 | [diff] [blame] | 180 | const useMediaDeviceExpandMenuOptions = (kind: MediaDeviceKind): ExpandMenuRadioOption[] | undefined => { |
simon | 492e840 | 2022-11-29 16:48:37 -0500 | [diff] [blame] | 181 | const { currentMediaDeviceIds, mediaDevices } = useContext(CallContext); |
simon | 9a8fe20 | 2022-11-15 18:25:49 -0500 | [diff] [blame] | 182 | |
simon | 9076a9a | 2022-11-29 17:13:01 -0500 | [diff] [blame] | 183 | const options = useMemo( |
simon | 9a8fe20 | 2022-11-15 18:25:49 -0500 | [diff] [blame] | 184 | () => |
| 185 | mediaDevices[kind].map((device) => ({ |
| 186 | key: device.deviceId, |
| 187 | description: device.label, |
| 188 | })), |
| 189 | [mediaDevices, kind] |
| 190 | ); |
simon | 9076a9a | 2022-11-29 17:13:01 -0500 | [diff] [blame] | 191 | |
simon | 492e840 | 2022-11-29 16:48:37 -0500 | [diff] [blame] | 192 | const currentDevice = currentMediaDeviceIds[kind]; |
| 193 | |
| 194 | if (options.length === 0) { |
| 195 | return undefined; |
| 196 | } |
| 197 | return [ |
| 198 | { |
| 199 | options, |
| 200 | value: currentDevice.id ?? '', |
| 201 | onChange: (e: ChangeEvent<HTMLInputElement>) => { |
| 202 | currentDevice.setId(e.target.value); |
| 203 | }, |
| 204 | }, |
| 205 | ]; |
simon | 9a8fe20 | 2022-11-15 18:25:49 -0500 | [diff] [blame] | 206 | }; |
| 207 | |
simon | 33c0618 | 2022-11-02 17:39:31 -0400 | [diff] [blame] | 208 | export const CallingVolumeButton = (props: ExpandableButtonProps) => { |
simon | 9a8fe20 | 2022-11-15 18:25:49 -0500 | [diff] [blame] | 209 | const options = useMediaDeviceExpandMenuOptions('audiooutput'); |
simon | 492e840 | 2022-11-29 16:48:37 -0500 | [diff] [blame] | 210 | |
| 211 | return ( |
| 212 | <CallButton |
| 213 | aria-label="volume options" |
simon | 571240f | 2022-11-29 23:59:27 -0500 | [diff] [blame] | 214 | expandMenuOnClick |
simon | 492e840 | 2022-11-29 16:48:37 -0500 | [diff] [blame] | 215 | Icon={VolumeIcon} |
simon | 571240f | 2022-11-29 23:59:27 -0500 | [diff] [blame] | 216 | expandMenuOptions={options} |
simon | 492e840 | 2022-11-29 16:48:37 -0500 | [diff] [blame] | 217 | {...props} |
| 218 | /> |
| 219 | ); |
simon | 33c0618 | 2022-11-02 17:39:31 -0400 | [diff] [blame] | 220 | }; |
Gabriel Rochon | 8321a0d | 2022-11-06 23:18:36 -0500 | [diff] [blame] | 221 | |
| 222 | export const CallingMicButton = (props: ExpandableButtonProps) => { |
simon | 9a8fe20 | 2022-11-15 18:25:49 -0500 | [diff] [blame] | 223 | const options = useMediaDeviceExpandMenuOptions('audioinput'); |
simon | 1170c32 | 2022-10-31 14:51:31 -0400 | [diff] [blame] | 224 | |
| 225 | return ( |
Gabriel Rochon | 8321a0d | 2022-11-06 23:18:36 -0500 | [diff] [blame] | 226 | <CallButton |
simon | 1170c32 | 2022-10-31 14:51:31 -0400 | [diff] [blame] | 227 | aria-label="microphone options" |
simon | 9076a9a | 2022-11-29 17:13:01 -0500 | [diff] [blame] | 228 | expandMenuOptions={options} |
simon | f929a36 | 2022-11-18 16:53:45 -0500 | [diff] [blame] | 229 | IconButtonComp={ToggleAudioCameraIconButton} |
| 230 | {...props} |
| 231 | /> |
| 232 | ); |
| 233 | }; |
| 234 | |
| 235 | const ToggleAudioCameraIconButton = (props: IconButtonProps) => { |
simon | 9076a9a | 2022-11-29 17:13:01 -0500 | [diff] [blame] | 236 | const { isAudioOn, setIsAudioOn } = useContext(CallContext); |
simon | f929a36 | 2022-11-18 16:53:45 -0500 | [diff] [blame] | 237 | return ( |
| 238 | <ToggleIconButton |
| 239 | IconOn={MicroIcon} |
| 240 | IconOff={MicroOffIcon} |
| 241 | selected={isAudioOn} |
simon | 9076a9a | 2022-11-29 17:13:01 -0500 | [diff] [blame] | 242 | toggle={() => setIsAudioOn((v) => !v)} |
simon | 1170c32 | 2022-10-31 14:51:31 -0400 | [diff] [blame] | 243 | {...props} |
| 244 | /> |
| 245 | ); |
| 246 | }; |
| 247 | |
Gabriel Rochon | 8321a0d | 2022-11-06 23:18:36 -0500 | [diff] [blame] | 248 | export const CallingVideoCameraButton = (props: ExpandableButtonProps) => { |
simon | 9a8fe20 | 2022-11-15 18:25:49 -0500 | [diff] [blame] | 249 | const options = useMediaDeviceExpandMenuOptions('videoinput'); |
| 250 | |
simon | 1170c32 | 2022-10-31 14:51:31 -0400 | [diff] [blame] | 251 | return ( |
Gabriel Rochon | 8321a0d | 2022-11-06 23:18:36 -0500 | [diff] [blame] | 252 | <CallButton |
simon | 1170c32 | 2022-10-31 14:51:31 -0400 | [diff] [blame] | 253 | aria-label="camera options" |
simon | 9076a9a | 2022-11-29 17:13:01 -0500 | [diff] [blame] | 254 | expandMenuOptions={options} |
simon | f929a36 | 2022-11-18 16:53:45 -0500 | [diff] [blame] | 255 | IconButtonComp={ToggleVideoCameraIconButton} |
| 256 | {...props} |
| 257 | /> |
| 258 | ); |
| 259 | }; |
| 260 | |
| 261 | const ToggleVideoCameraIconButton = (props: IconButtonProps) => { |
simon | 9076a9a | 2022-11-29 17:13:01 -0500 | [diff] [blame] | 262 | const { isVideoOn, setIsVideoOn } = useContext(CallContext); |
simon | f929a36 | 2022-11-18 16:53:45 -0500 | [diff] [blame] | 263 | return ( |
| 264 | <ToggleIconButton |
| 265 | IconOn={VideoCameraIcon} |
| 266 | IconOff={VideoCameraOffIcon} |
| 267 | selected={isVideoOn} |
simon | 9076a9a | 2022-11-29 17:13:01 -0500 | [diff] [blame] | 268 | toggle={() => setIsVideoOn((v) => !v)} |
simon | 1170c32 | 2022-10-31 14:51:31 -0400 | [diff] [blame] | 269 | {...props} |
| 270 | /> |
| 271 | ); |
| 272 | }; |
simon | 2d3b653 | 2022-11-08 21:01:57 -0500 | [diff] [blame] | 273 | |
| 274 | // Calling pending/receiving interface |
simon | f929a36 | 2022-11-18 16:53:45 -0500 | [diff] [blame] | 275 | export const CallingCancelButton = (props: IconButtonProps) => { |
simon | accd802 | 2022-11-24 15:04:53 -0500 | [diff] [blame] | 276 | const { endCall } = useContext(CallContext); |
simon | f929a36 | 2022-11-18 16:53:45 -0500 | [diff] [blame] | 277 | |
| 278 | return ( |
| 279 | <ColoredCallButton |
| 280 | aria-label="cancel call" |
| 281 | onClick={() => { |
simon | accd802 | 2022-11-24 15:04:53 -0500 | [diff] [blame] | 282 | endCall(); |
simon | f929a36 | 2022-11-18 16:53:45 -0500 | [diff] [blame] | 283 | }} |
| 284 | Icon={CallEndIcon} |
| 285 | paletteColor={(theme) => theme.palette.error} |
| 286 | {...props} |
| 287 | /> |
| 288 | ); |
simon | 2d3b653 | 2022-11-08 21:01:57 -0500 | [diff] [blame] | 289 | }; |
| 290 | |
simon | f929a36 | 2022-11-18 16:53:45 -0500 | [diff] [blame] | 291 | export const CallingAnswerAudioButton = (props: IconButtonProps) => { |
Charlie | 9c8779e | 2022-11-29 20:10:56 -0500 | [diff] [blame] | 292 | const { acceptCall, callStatus } = useContext(CallContext); |
simon | f929a36 | 2022-11-18 16:53:45 -0500 | [diff] [blame] | 293 | |
| 294 | return ( |
| 295 | <ColoredCallButton |
Charlie | 9c8779e | 2022-11-29 20:10:56 -0500 | [diff] [blame] | 296 | disabled={callStatus === CallStatus.Loading || callStatus === CallStatus.Connecting} |
simon | f929a36 | 2022-11-18 16:53:45 -0500 | [diff] [blame] | 297 | aria-label="answer call audio" |
| 298 | onClick={() => { |
MichelleSS | 5516420 | 2022-11-25 18:36:14 -0500 | [diff] [blame] | 299 | acceptCall(false); |
simon | f929a36 | 2022-11-18 16:53:45 -0500 | [diff] [blame] | 300 | }} |
| 301 | Icon={PlaceAudioCallIcon} |
| 302 | paletteColor={(theme) => theme.palette.success} |
| 303 | {...props} |
| 304 | /> |
| 305 | ); |
simon | 2d3b653 | 2022-11-08 21:01:57 -0500 | [diff] [blame] | 306 | }; |
| 307 | |
simon | f929a36 | 2022-11-18 16:53:45 -0500 | [diff] [blame] | 308 | export const CallingAnswerVideoButton = (props: IconButtonProps) => { |
Charlie | 9c8779e | 2022-11-29 20:10:56 -0500 | [diff] [blame] | 309 | const { acceptCall, callStatus } = useContext(CallContext); |
simon | f929a36 | 2022-11-18 16:53:45 -0500 | [diff] [blame] | 310 | return ( |
| 311 | <ColoredCallButton |
Charlie | 9c8779e | 2022-11-29 20:10:56 -0500 | [diff] [blame] | 312 | disabled={callStatus === CallStatus.Connecting || callStatus === CallStatus.Loading} |
simon | f929a36 | 2022-11-18 16:53:45 -0500 | [diff] [blame] | 313 | aria-label="answer call video" |
| 314 | onClick={() => { |
MichelleSS | 5516420 | 2022-11-25 18:36:14 -0500 | [diff] [blame] | 315 | acceptCall(true); |
simon | f929a36 | 2022-11-18 16:53:45 -0500 | [diff] [blame] | 316 | }} |
| 317 | paletteColor={(theme) => theme.palette.success} |
| 318 | Icon={VideoCameraIcon} |
| 319 | {...props} |
| 320 | /> |
| 321 | ); |
| 322 | }; |
| 323 | |
| 324 | export const CallingRefuseButton = (props: IconButtonProps) => { |
simon | accd802 | 2022-11-24 15:04:53 -0500 | [diff] [blame] | 325 | const { endCall } = useContext(CallContext); |
simon | f929a36 | 2022-11-18 16:53:45 -0500 | [diff] [blame] | 326 | return ( |
| 327 | <ColoredCallButton |
| 328 | aria-label="refuse call" |
| 329 | onClick={() => { |
simon | accd802 | 2022-11-24 15:04:53 -0500 | [diff] [blame] | 330 | endCall(); |
simon | f929a36 | 2022-11-18 16:53:45 -0500 | [diff] [blame] | 331 | }} |
| 332 | paletteColor={(theme) => theme.palette.error} |
| 333 | Icon={RoundCloseIcon} |
| 334 | {...props} |
| 335 | /> |
| 336 | ); |
simon | 2d3b653 | 2022-11-08 21:01:57 -0500 | [diff] [blame] | 337 | }; |