Skip to content

Commit

Permalink
chore: remove unused empty state (#17529)
Browse files Browse the repository at this point in the history
  • Loading branch information
daibhin authored Sep 19, 2023
1 parent bb61ee1 commit 8ff764b
Show file tree
Hide file tree
Showing 4 changed files with 1 addition and 17 deletions.
1 change: 0 additions & 1 deletion frontend/src/scenes/notebooks/Notebook/Editor.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,6 @@ export function Editor({
setSelection: (position: number) => editor.commands.setNodeSelection(position),
focus: (position: EditorFocusPosition) => queueMicrotask(() => editor.commands.focus(position)),
destroy: () => editor.destroy(),
isEmpty: () => editor.isEmpty,
deleteRange: (range: EditorRange) => editor.chain().focus().deleteRange(range),
insertContent: (content: JSONContent) => editor.chain().insertContent(content).focus().run(),
insertContentAfterNode: (position: number, content: JSONContent) => {
Expand Down
10 changes: 1 addition & 9 deletions frontend/src/scenes/notebooks/Notebook/Notebook.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ const PLACEHOLDER_TITLES = ['Release notes', 'Product roadmap', 'Meeting notes',

export function Notebook({ shortId, editable = false, initialAutofocus = null }: NotebookProps): JSX.Element {
const logic = notebookLogic({ shortId })
const { notebook, content, notebookLoading, isEmpty, editor, conflictWarningVisible } = useValues(logic)
const { notebook, content, notebookLoading, editor, conflictWarningVisible } = useValues(logic)
const { setEditor, onEditorUpdate, duplicateNotebook, loadNotebook, setEditable, onEditorSelectionUpdate } =
useActions(logic)
const { isExpanded } = useValues(notebookSettingsLogic)
Expand Down Expand Up @@ -57,14 +57,6 @@ export function Notebook({ shortId, editable = false, initialAutofocus = null }:
return <NotebookLoadingState />
} else if (!notebook) {
return <NotFound object="notebook" />
} else if (isEmpty && !editable) {
return (
<div className="NotebookEditor">
<h1>
<i>Untitled</i>
</h1>
</div>
)
}

return (
Expand Down
6 changes: 0 additions & 6 deletions frontend/src/scenes/notebooks/Notebook/notebookLogic.ts
Original file line number Diff line number Diff line change
Expand Up @@ -292,12 +292,6 @@ export const notebookLogic = kea<notebookLogicType>([
return contentTitle || notebook?.title || 'Untitled'
},
],
isEmpty: [
(s) => [s.editor, s.content],
(editor: NotebookEditor): boolean => {
return editor?.isEmpty() || false
},
],
syncStatus: [
(s) => [s.notebook, s.notebookLoading, s.localContent, s.isLocalOnly],
(notebook, notebookLoading, localContent, isLocalOnly): NotebookSyncStatus => {
Expand Down
1 change: 0 additions & 1 deletion frontend/src/scenes/notebooks/Notebook/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,6 @@ export interface NotebookEditor {
setSelection: (position: number) => void
focus: (position: EditorFocusPosition) => void
destroy: () => void
isEmpty: () => boolean
deleteRange: (range: EditorRange) => EditorCommands
insertContent: (content: JSONContent) => void
insertContentAfterNode: (position: number, content: JSONContent) => void
Expand Down

0 comments on commit 8ff764b

Please sign in to comment.