From 78b0a9107307bbe9510859a5d75bf499e9ae61bc Mon Sep 17 00:00:00 2001 From: timothycarambat Date: Tue, 2 Apr 2024 15:24:59 -0700 Subject: [PATCH] Hide member tab on workspace settings when not in multi-user mode --- frontend/src/pages/WorkspaceSettings/index.jsx | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/frontend/src/pages/WorkspaceSettings/index.jsx b/frontend/src/pages/WorkspaceSettings/index.jsx index 1ee44f7db..d43530018 100644 --- a/frontend/src/pages/WorkspaceSettings/index.jsx +++ b/frontend/src/pages/WorkspaceSettings/index.jsx @@ -19,6 +19,7 @@ import GeneralAppearance from "./GeneralAppearance"; import ChatSettings from "./ChatSettings"; import VectorDatabase from "./VectorDatabase"; import Members from "./Members"; +import useUser from "@/hooks/useUser"; const TABS = { "general-appearance": GeneralAppearance, @@ -40,6 +41,7 @@ export default function WorkspaceSettings() { function ShowWorkspaceChat() { const { slug, tab } = useParams(); + const { user } = useUser(); const [workspace, setWorkspace] = useState(null); const [loading, setLoading] = useState(true); @@ -98,6 +100,7 @@ function ShowWorkspaceChat() { title="Members" icon={} to={paths.workspace.settings.members(slug)} + visible={["admin", "manager"].includes(user?.role)} />
@@ -108,7 +111,8 @@ function ShowWorkspaceChat() { ); } -function TabItem({ title, icon, to }) { +function TabItem({ title, icon, to, visible = true }) { + if (!visible) return null; return (