Make pencil menu into getter to remove ternary
parent
7b32e68c14
commit
21fdf585c5
|
@ -69,13 +69,7 @@ class LayoutCellMenu extends Component<Props, State> {
|
||||||
}
|
}
|
||||||
|
|
||||||
private get renderMenu(): JSX.Element {
|
private get renderMenu(): JSX.Element {
|
||||||
const {
|
const {isEditable, mode, cell, onDismissEditingAnnotation} = this.props
|
||||||
isEditable,
|
|
||||||
mode,
|
|
||||||
cell,
|
|
||||||
onDismissEditingAnnotation,
|
|
||||||
queries,
|
|
||||||
} = this.props
|
|
||||||
|
|
||||||
if (mode === EDITING && cellSupportsAnnotations(cell.type)) {
|
if (mode === EDITING && cellSupportsAnnotations(cell.type)) {
|
||||||
return (
|
return (
|
||||||
|
@ -93,13 +87,7 @@ class LayoutCellMenu extends Component<Props, State> {
|
||||||
if (isEditable && mode !== EDITING) {
|
if (isEditable && mode !== EDITING) {
|
||||||
return (
|
return (
|
||||||
<div className="dash-graph-context--buttons">
|
<div className="dash-graph-context--buttons">
|
||||||
{queries.length ? (
|
{this.pencilMenu}
|
||||||
<MenuTooltipButton
|
|
||||||
icon="pencil"
|
|
||||||
menuItems={this.editMenuItems}
|
|
||||||
informParent={this.handleToggleSubMenu}
|
|
||||||
/>
|
|
||||||
) : null}
|
|
||||||
<Authorized requiredRole={EDITOR_ROLE}>
|
<Authorized requiredRole={EDITOR_ROLE}>
|
||||||
<MenuTooltipButton
|
<MenuTooltipButton
|
||||||
icon="duplicate"
|
icon="duplicate"
|
||||||
|
@ -118,6 +106,22 @@ class LayoutCellMenu extends Component<Props, State> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private get pencilMenu(): JSX.Element {
|
||||||
|
const {queries} = this.props
|
||||||
|
|
||||||
|
if (!queries.length) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
return (
|
||||||
|
<MenuTooltipButton
|
||||||
|
icon="pencil"
|
||||||
|
menuItems={this.editMenuItems}
|
||||||
|
informParent={this.handleToggleSubMenu}
|
||||||
|
/>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
private get contextMenuClassname(): string {
|
private get contextMenuClassname(): string {
|
||||||
const {subMenuIsOpen} = this.state
|
const {subMenuIsOpen} = this.state
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue