From 4755af4ac5f0526c0a15ac6732982f0d11a0dbd7 Mon Sep 17 00:00:00 2001 From: Erik Michelson Date: Thu, 11 Jan 2024 21:56:25 +0100 Subject: [PATCH] enhancement(sidebar): hide note deletion button when not being owner Signed-off-by: Erik Michelson --- frontend/src/components/editor-page/sidebar/sidebar.tsx | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/frontend/src/components/editor-page/sidebar/sidebar.tsx b/frontend/src/components/editor-page/sidebar/sidebar.tsx index 4b5043585..c050d61b3 100644 --- a/frontend/src/components/editor-page/sidebar/sidebar.tsx +++ b/frontend/src/components/editor-page/sidebar/sidebar.tsx @@ -17,6 +17,7 @@ import styles from './style/sidebar.module.scss' import { DocumentSidebarMenuSelection } from './types' import React, { useCallback, useRef, useState } from 'react' import { useClickAway } from 'react-use' +import { useIsOwner } from '../../../hooks/common/use-is-owner' /** * Renders the sidebar for the editor. @@ -24,6 +25,7 @@ import { useClickAway } from 'react-use' export const Sidebar: React.FC = () => { const sideBarRef = useRef(null) const [selectedMenu, setSelectedMenu] = useState(DocumentSidebarMenuSelection.NONE) + const isOwner = useIsOwner() useClickAway(sideBarRef, () => { setSelectedMenu(DocumentSidebarMenuSelection.NONE) @@ -66,8 +68,7 @@ export const Sidebar: React.FC = () => { onClick={toggleValue} /> - {/* TODO only show if user has permissions (Owner) (https://github.com/hedgedoc/hedgedoc/issues/5036) */} - + {isOwner && }