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