From 0907045534facc0389246b5bd301dd0cae3ffe28 Mon Sep 17 00:00:00 2001 From: Ben White Date: Wed, 27 Sep 2023 18:17:31 +0200 Subject: [PATCH] Added notice --- .../scenes/notebooks/Notebook/Notebook.tsx | 15 ++------- .../notebooks/Notebook/NotebookHistory.tsx | 33 +++++++++++++++++-- 2 files changed, 33 insertions(+), 15 deletions(-) diff --git a/frontend/src/scenes/notebooks/Notebook/Notebook.tsx b/frontend/src/scenes/notebooks/Notebook/Notebook.tsx index 7d3fde0c8ea1b..924bd487a07ea 100644 --- a/frontend/src/scenes/notebooks/Notebook/Notebook.tsx +++ b/frontend/src/scenes/notebooks/Notebook/Notebook.tsx @@ -16,6 +16,7 @@ import { EditorFocusPosition } from './utils' import { NotebookSidebar } from './NotebookSidebar' import { ErrorBoundary } from '~/layout/ErrorBoundary' import { LemonButton } from '@posthog/lemon-ui' +import { NotebookHistoryWarning } from './NotebookHistory' export type NotebookProps = { shortId: string @@ -88,19 +89,7 @@ export function Notebook({ shortId, editable = false, initialAutofocus = null }: )} - {editable && showHistory ? ( - - - - Hello time traveller! You are viewing an older revision of this Notebook. You can - - - Discard - - Revert to this version - - - ) : null} + {notebook.short_id === SCRATCHPAD_NOTEBOOK.short_id ? ( ) } + +export function NotebookHistoryWarning(): JSX.Element | null { + const { previewContent } = useValues(notebookLogic) + const { clearPreviewContent } = useActions(notebookLogic) + + if (!previewContent) { + return null + } + return ( + + + + Hello time traveller! +
You are viewing an older revision of this Notebook. You can choose to revert to this version, + or create a copy of it. +
+ + + clearPreviewContent()}> + Cancel + + + Revert to this version + Create a copy + +
+
+ ) +}