Skip to content

Commit

Permalink
Hide member tab on workspace settings when not in multi-user mode
Browse files Browse the repository at this point in the history
  • Loading branch information
timothycarambat committed Apr 2, 2024
1 parent 41fe20f commit 78b0a91
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion frontend/src/pages/WorkspaceSettings/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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);

Expand Down Expand Up @@ -98,6 +100,7 @@ function ShowWorkspaceChat() {
title="Members"
icon={<User className="h-6 w-6" />}
to={paths.workspace.settings.members(slug)}
visible={["admin", "manager"].includes(user?.role)}
/>
</div>
<div className="px-16 py-6">
Expand All @@ -108,7 +111,8 @@ function ShowWorkspaceChat() {
);
}

function TabItem({ title, icon, to }) {
function TabItem({ title, icon, to, visible = true }) {
if (!visible) return null;
return (
<NavLink
to={to}
Expand Down

0 comments on commit 78b0a91

Please sign in to comment.