diff --git a/src/common/component/CurrentUser.js b/src/common/component/CurrentUser.js
index 27840878..90d025de 100644
--- a/src/common/component/CurrentUser.js
+++ b/src/common/component/CurrentUser.js
@@ -4,6 +4,7 @@ import { useSelector } from "react-redux";
import soundIcon from "../../assets/icons/sound.on.svg?url";
import micIcon from "../../assets/icons/mic.on.svg?url";
import Avatar from "./Avatar";
+import useConfig from "../hook/useConfig";
// import UserGuide from "./UserGuide";
const StyledWrapper = styled.div`
background-color: #f4f4f5;
@@ -60,6 +61,7 @@ const StyledWrapper = styled.div`
}
`;
export default function CurrentUser() {
+ const { values: agoraConfig } = useConfig("agora");
const currUser = useSelector((store) => {
return store.contacts.byId[store.authData.uid];
});
@@ -76,10 +78,12 @@ export default function CurrentUser() {
#{uid}
-
-

-

-
+ {agoraConfig.enabled && (
+
+

+

+
+ )}
//
);
diff --git a/src/common/component/Profile/index.js b/src/common/component/Profile/index.js
index 65c53d05..126dc4d1 100644
--- a/src/common/component/Profile/index.js
+++ b/src/common/component/Profile/index.js
@@ -56,7 +56,7 @@ export default function Profile({ uid = null, type = "embed", cid = null }) {
{/* */}
- {type == "embed" && (
+ {enableCall && (
Call
diff --git a/src/routes/setting/config/useConfig.js b/src/common/hook/useConfig.js
similarity index 96%
rename from src/routes/setting/config/useConfig.js
rename to src/common/hook/useConfig.js
index 4cd468a4..88c22e71 100644
--- a/src/routes/setting/config/useConfig.js
+++ b/src/common/hook/useConfig.js
@@ -1,5 +1,5 @@
import { useEffect, useState } from "react";
-import { isObjectEqual } from "../../../common/utils";
+import { isObjectEqual } from "../utils";
import toast from "react-hot-toast";
import {
useGetAgoraConfigQuery,
@@ -10,7 +10,7 @@ import {
useUpdateSMTPConfigMutation,
useUpdateAgoraConfigMutation,
useUpdateFirebaseConfigMutation,
-} from "../../../app/services/server";
+} from "../../app/services/server";
export default function useConfig(config = "smtp") {
const [changed, setChanged] = useState(false);
const [values, setValues] = useState({});
diff --git a/src/common/hook/useContactOperation.js b/src/common/hook/useContactOperation.js
index f13ec7da..b3171282 100644
--- a/src/common/hook/useContactOperation.js
+++ b/src/common/hook/useContactOperation.js
@@ -6,10 +6,12 @@ import { useNavigate, useMatch } from "react-router-dom";
import { hideAll } from "tippy.js";
import { useRemoveMembersMutation } from "../../app/services/channel";
import { useLazyDeleteContactQuery } from "../../app/services/contact";
+import useConfig from "./useConfig";
import useCopy from "./useCopy";
export default function useContactOperation({ uid, cid }) {
const [passedUid, setPassedUid] = useState(undefined);
+ const { values: agoraConfig } = useConfig("agora");
const isUserDetailPath = useMatch(`/contacts/${uid}`);
const [
removeUser,
@@ -68,7 +70,7 @@ export default function useContactOperation({ uid, cid }) {
};
const canRemoveFromChannel =
cid && !channel?.is_public && (isAdmin || channel?.owner == loginUid);
- const canCall = loginUid != uid;
+ const canCall = agoraConfig.enabled && loginUid != uid;
const canRemove = isAdmin && loginUid != uid && !cid;
return {
canRemove,
diff --git a/src/routes/chat/ChannelChat/index.js b/src/routes/chat/ChannelChat/index.js
index 4a5d1070..94f97a69 100644
--- a/src/routes/chat/ChannelChat/index.js
+++ b/src/routes/chat/ChannelChat/index.js
@@ -8,6 +8,7 @@ import FavList from "../FavList";
import { useReadMessageMutation } from "../../../app/services/message";
import { updateRemeberedNavs } from "../../../app/slices/ui";
import useMessageFeed from "../../../common/hook/useMessageFeed";
+import useConfig from "../../../common/hook/useConfig";
import ChannelIcon from "../../../common/component/ChannelIcon";
import Tooltip from "../../../common/component/Tooltip";
import Contact from "../../../common/component/Contact";
@@ -34,6 +35,7 @@ import LoadMore from "../LoadMore";
// import useChatScroll from "../../../common/hook/useChatScroll";
export default function ChannelChat({ cid = "", dropFiles = [] }) {
+ const { values: agoraConfig } = useConfig("agora");
const { list: msgIds, appends, hasMore, pullUp } = useMessageFeed({
context: "channel",
id: cid,
@@ -107,11 +109,13 @@ export default function ChannelChat({ cid = "", dropFiles = [] }) {
aside={
<>
- -
-
-
-
-
+ {agoraConfig.enabled && (
+ -
+
+
+
+
+ )}