Update call header title and disable hair check mute button when they are not found

This commit is contained in:
harshithpabbati 2021-11-12 17:09:29 +05:30
parent c5a077e95e
commit 1b2707f4f5
3 changed files with 7 additions and 6 deletions

View File

@ -18,7 +18,7 @@ export const Header = () => {
height="32" height="32"
/> />
<HeaderCapsule>Basic call demo</HeaderCapsule> <HeaderCapsule>{process.env.PROJECT_TITLE}</HeaderCapsule>
<HeaderCapsule> <HeaderCapsule>
{`${participantCount} ${ {`${participantCount} ${
participantCount === 1 ? 'participant' : 'participants' participantCount === 1 ? 'participant' : 'participants'

View File

@ -166,8 +166,8 @@ export const HairCheck = () => {
)} )}
</div> </div>
<div className="mute-buttons"> <div className="mute-buttons">
<MuteButton isMuted={isCamMuted} /> <MuteButton isMuted={isCamMuted} disabled={!!camError} />
<MuteButton mic isMuted={isMicMuted} /> <MuteButton mic isMuted={isMicMuted} disabled={!!micError} />
</div> </div>
{tileMemo} {tileMemo}
</div> </div>

View File

@ -8,7 +8,7 @@ import PropTypes from 'prop-types';
import { useCallState } from '../../contexts/CallProvider'; import { useCallState } from '../../contexts/CallProvider';
import Button from '../Button'; import Button from '../Button';
export const MuteButton = ({ isMuted, mic = false, className, ...props }) => { export const MuteButton = ({ isMuted, mic = false, className, disabled = false, ...props }) => {
const { callObject } = useCallState(); const { callObject } = useCallState();
const [muted, setMuted] = useState(!isMuted); const [muted, setMuted] = useState(!isMuted);
@ -28,17 +28,18 @@ export const MuteButton = ({ isMuted, mic = false, className, ...props }) => {
if (!callObject) return null; if (!callObject) return null;
const cx = classNames(className, { muted: !muted }); const cx = classNames(className, { muted: disabled || !muted });
return ( return (
<Button <Button
size="large-circle" size="large-circle"
variant="blur" variant="blur"
className={cx} className={cx}
disabled={disabled}
{...props} {...props}
onClick={() => toggleDevice(!muted)} onClick={() => toggleDevice(!muted)}
> >
{Icon[+muted]} {disabled ? Icon[0] : Icon[+muted]}
</Button> </Button>
); );
}; };