fix: voice entry visible logic
This commit is contained in:
@@ -89,7 +89,7 @@ function ChannelChat({ cid = 0, dropFiles = [] }: Props) {
|
||||
</Tippy>
|
||||
</Tooltip>
|
||||
{/* 音频 暂时只有admin有入口 */}
|
||||
{loginUser?.is_admin && <VoiceChat context={`channel`} id={cid} />}
|
||||
<VoiceChat context={`channel`} id={cid} />
|
||||
<Tooltip tip={t("fav")} placement="left">
|
||||
<Tippy
|
||||
placement="left-start"
|
||||
|
||||
@@ -8,6 +8,7 @@ import { useAppSelector } from '../../../app/store';
|
||||
import IconHeadphone from '../../../assets/icons/headphone.svg';
|
||||
import Tooltip from '../../../common/component/Tooltip';
|
||||
import { useVoice } from '../../../common/component/Voice';
|
||||
import { useGetAgoraConfigQuery } from '../../../app/services/server';
|
||||
|
||||
type Props = {
|
||||
context?: "channel" | "dm"
|
||||
@@ -24,6 +25,7 @@ const VoiceChat = ({ id, context = "channel" }: Props) => {
|
||||
voiceList: store.voice.list
|
||||
};
|
||||
});
|
||||
const { data: agoraConfig } = useGetAgoraConfigQuery(undefined, { skip: !loginUser?.is_admin });
|
||||
const { t } = useTranslation("chat");
|
||||
const toggleDashboard = () => {
|
||||
if (context == "channel") {
|
||||
@@ -47,7 +49,8 @@ const VoiceChat = ({ id, context = "channel" }: Props) => {
|
||||
}));
|
||||
}
|
||||
};
|
||||
if (!loginUser) return null;
|
||||
// 只有admin才能看到入口,后续会改
|
||||
if (!loginUser || !loginUser.is_admin || !agoraConfig?.enabled) return null;
|
||||
const visible = contextData.visibleAside == "voice";
|
||||
const memberCount = voiceList.find((v) => v.context == context && v.id == id)?.memberCount ?? 0;
|
||||
const badgeClass = `absolute -top-2 -right-2 w-4 h-4 rounded-full bg-primary-400 text-white `;
|
||||
|
||||
Reference in New Issue
Block a user