fix: remove toggle on note cell (#17914)

pull/17915/head
Alex Boatwright 2020-04-29 15:52:43 -07:00 committed by GitHub
parent 09f3ba5787
commit 446563cdfa
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 15 additions and 4 deletions

View File

@ -22,11 +22,12 @@ import {
} from 'src/dashboards/actions/notes'
// Types
import {AppState} from 'src/types'
import {AppState, NoteEditorMode} from 'src/types'
interface StateProps {
note: string
showNoteWhenEmpty: boolean
hasQuery: boolean
}
interface DispatchProps {
@ -79,7 +80,11 @@ class NoteEditor extends PureComponent<Props, State> {
}
private get visibilityToggle(): JSX.Element {
const {showNoteWhenEmpty, onToggleShowNoteWhenEmpty} = this.props
const {hasQuery, showNoteWhenEmpty, onToggleShowNoteWhenEmpty} = this.props
if (!hasQuery) {
return null
}
return (
<FlexBox
@ -109,9 +114,14 @@ class NoteEditor extends PureComponent<Props, State> {
}
const mstp = (state: AppState) => {
const {note, isPreviewing, showNoteWhenEmpty} = state.noteEditor
const {note, mode, viewID, isPreviewing, showNoteWhenEmpty} = state.noteEditor
const hasQuery =
mode === NoteEditorMode.Editing &&
viewID &&
state.resources.views.byID[viewID] &&
state.resources.views.byID[viewID].properties.type !== 'markdown'
return {note, isPreviewing, showNoteWhenEmpty}
return {note, hasQuery, isPreviewing, showNoteWhenEmpty}
}
const mdtp = {

View File

@ -6,6 +6,7 @@ export interface NoteEditorState {
note: string
showNoteWhenEmpty: boolean
isPreviewing: boolean
viewID?: string
}
const initialState = (): NoteEditorState => ({