diff --git a/frontend/app/components/Assist/ChatControls/ChatControls.css b/frontend/app/components/Assist/ChatControls/ChatControls.css new file mode 100644 index 000000000..7ec77f758 --- /dev/null +++ b/frontend/app/components/Assist/ChatControls/ChatControls.css @@ -0,0 +1,29 @@ +.controls { + height: 38px; + /* margin-top: 5px; */ + /* background-color: white; */ + /* border-top: solid thin #CCC; */ +} + +.btnWrapper { + display: flex; + align-items: center; + height: 24px; + font-size: 12px; + color: $gray-medium; + + &.disabled { + /* background-color: red; */ + & svg { + fill: red; + } + } +} + +.endButton { + background-color: $red; + border-radius: 3px; + padding: 2px 8px; + color: white; + font-size: 12px; +} \ No newline at end of file diff --git a/frontend/app/components/Assist/ChatControls/ChatControls.tsx b/frontend/app/components/Assist/ChatControls/ChatControls.tsx new file mode 100644 index 000000000..6ca747455 --- /dev/null +++ b/frontend/app/components/Assist/ChatControls/ChatControls.tsx @@ -0,0 +1,54 @@ +import React, { useState } from 'react' +import stl from './ChatControls.css' +import cn from 'classnames' +import { Button, Icon } from 'UI' + +interface Props { + stream: MediaStream | null, + endCall: () => void +} +function ChatControls({ stream, endCall } : Props) { + const [audioEnabled, setAudioEnabled] = useState(true) + const [videoEnabled, setVideoEnabled] = useState(true) + + const toggleAudio = () => { + if (!stream) { return; } + const aEn = !audioEnabled + stream.getAudioTracks().forEach(track => track.enabled = aEn); + setAudioEnabled(aEn); + } + + const toggleVideo = () => { + if (!stream) { return; } + const vEn = !videoEnabled; + stream.getVideoTracks().forEach(track => track.enabled = vEn); + setVideoEnabled(vEn) + } + + return ( +