fix: remove toggle on note cell (#17914)
parent
09f3ba5787
commit
446563cdfa
|
@ -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 = {
|
||||
|
|
|
@ -6,6 +6,7 @@ export interface NoteEditorState {
|
|||
note: string
|
||||
showNoteWhenEmpty: boolean
|
||||
isPreviewing: boolean
|
||||
viewID?: string
|
||||
}
|
||||
|
||||
const initialState = (): NoteEditorState => ({
|
||||
|
|
Loading…
Reference in New Issue