// import React from 'react'; import { useAppSelector } from '../../app/store'; import User from '../../common/component/User'; import IconMic from '../../assets/icons/mic.on.svg'; import IconMicOff from '../../assets/icons/mic.off.svg'; import IconCallOff from '../../assets/icons/headphone.svg'; import IconSoundOn from '../../assets/icons/sound.on.svg'; import IconSoundOff from '../../assets/icons/sound.off.svg'; import { useVoice } from '../../common/component/Voice'; import Signal from '../../common/component/Signal'; import Tooltip from '../../common/component/Tooltip'; import { useTranslation } from 'react-i18next'; type Props = { id: number, context?: "channel" | "dm" } const RTCWidget = ({ id, context = "channel" }: Props) => { const { t } = useTranslation("chat"); const { leave, voicingInfo, setMute, setDeafen, joining = true } = useVoice({ context, id }); const { loginUser, channelData, userData } = useAppSelector(store => { return { userData: store.users.byId, channelData: store.channels.byId, loginUser: store.authData.user, }; }); if (!loginUser || !voicingInfo || joining) return null; const name = voicingInfo.context == "channel" ? channelData[voicingInfo.id]?.name : userData[voicingInfo.id]?.name; if (!name) return null; return (
{/* {voicingInfo && */}
Voice Connected {voicingInfo.context == "channel" ? "Channel" : "DM"} / {voicingInfo.context == "channel" ? channelData[voicingInfo.id].name : userData[voicingInfo.id].name}
{/* } */}
{loginUser.name} #{loginUser.uid}
{/* {voicingInfo && */}
{voicingInfo.deafen ? : } {voicingInfo.muted ? : }
{/* } */}
); }; export default RTCWidget;