Skip to content

Commit

Permalink
touchup: hide add node buttons if readonly mode
Browse files Browse the repository at this point in the history
reduces clutter in details pane
  • Loading branch information
keyserj committed Jul 15, 2024
1 parent 368a14d commit c76a336
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/web/topic/components/Node/AddNodeButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import { useUserCanEditTopicData } from "@/web/topic/store/userHooks";
import { Relation } from "@/web/topic/utils/edge";
import { type RelationDirection } from "@/web/topic/utils/graph";
import { nodeDecorations } from "@/web/topic/utils/node";
import { useReadonlyMode } from "@/web/view/actionConfigStore";

interface Props {
fromPartId: string;
Expand All @@ -33,8 +34,9 @@ export const AddNodeButton = ({
}: Props) => {
const { sessionUser } = useSessionUser();
const userCanEditTopicData = useUserCanEditTopicData(sessionUser?.username);
const readonlyMode = useReadonlyMode();

if (!userCanEditTopicData) return <></>;
if (!userCanEditTopicData || readonlyMode) return <></>;

const decoration = nodeDecorations[toNodeType];

Expand Down

0 comments on commit c76a336

Please sign in to comment.