mirror of
https://github.com/hedgedoc/hedgedoc.git
synced 2024-11-28 12:21:00 -05:00
enhancement(sidebar): hide note deletion button when not being owner
Signed-off-by: Erik Michelson <github@erik.michelson.eu>
This commit is contained in:
parent
4b8f6da78a
commit
4755af4ac5
1 changed files with 3 additions and 2 deletions
|
@ -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<HTMLDivElement>(null)
|
||||
const [selectedMenu, setSelectedMenu] = useState<DocumentSidebarMenuSelection>(DocumentSidebarMenuSelection.NONE)
|
||||
const isOwner = useIsOwner()
|
||||
|
||||
useClickAway(sideBarRef, () => {
|
||||
setSelectedMenu(DocumentSidebarMenuSelection.NONE)
|
||||
|
@ -66,8 +68,7 @@ export const Sidebar: React.FC = () => {
|
|||
onClick={toggleValue}
|
||||
/>
|
||||
<ShareNoteSidebarEntry hide={selectionIsNotNone} />
|
||||
{/* TODO only show if user has permissions (Owner) (https://github.com/hedgedoc/hedgedoc/issues/5036) */}
|
||||
<DeleteNoteSidebarEntry hide={selectionIsNotNone} />
|
||||
{isOwner && <DeleteNoteSidebarEntry hide={selectionIsNotNone} />}
|
||||
<PinNoteSidebarEntry hide={selectionIsNotNone} />
|
||||
</div>
|
||||
</div>
|
||||
|
|
Loading…
Reference in a new issue