:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.
Python ab-testingai-analyticsanalyticscdpdata-warehouseexperimentsfeature-flagsjavascriptproduct-analyticspythonreactsession-replaysurveystypescriptweb-analytics
feat(notebooks): stop offering new canvases (#94990)
Sinan Kucukkoseler7e187a1221c7
diff --git a/frontend/src/scenes/hog-functions/metrics/HogFunctionEventEstimates.tsx b/frontend/src/scenes/hog-functions/metrics/HogFunctionEventEstimates.tsxindex 44edfb956e5e..b4ded3d3a066 100644--- a/frontend/src/scenes/hog-functions/metrics/HogFunctionEventEstimates.tsx+++ b/frontend/src/scenes/hog-functions/metrics/HogFunctionEventEstimates.tsx@@ -1,11 +1,10 @@import { useActions, useValues } from 'kea'-import { LemonLabel, LemonSelect, SpinnerOverlay } from '@posthog/lemon-ui'+import { LemonLabel, SpinnerOverlay } from '@posthog/lemon-ui'import { Sparkline } from 'lib/components/Sparkline'import { LemonBanner } from 'lib/lemon-ui/LemonBanner'import { LemonButton } from 'lib/lemon-ui/LemonButton'-import { base64Encode } from 'lib/utils/base64'import { urls } from 'scenes/urls'import { Query } from '~/queries/Query/Query'@@ -35,20 +34,6 @@ export function HogFunctionEventEstimates(): JSX.Element | null {const insightUrl = urls.insightNew({ type: InsightType.SQL, query: dataTableNode })- const canvasContent = {- type: 'doc',- content: [- {- type: 'ph-query',- attrs: {- query: dataTableNode,- },- },- ],- }-- const canvasUrl = urls.canvas() + '#🦔=' + base64Encode(JSON.stringify(canvasContent))-return (<div className="relative p-3 rounded border deprecated-space-y-2 bg-surface-primary"><LemonLabel>Matching events</LemonLabel>@@ -95,22 +80,9 @@ export function HogFunctionEventEstimates(): JSX.Element | null {{showEventsList ? (<><div className="flex justify-end items-start">- <LemonSelect- placeholder="Open in..."- onChange={(target) => {- if (target === 'insight') {- // Open a new tab- window.open(insightUrl, '_blank')- } else if (target === 'canvas') {- // Open a new tab- window.open(canvasUrl, '_blank')- }- }}- options={[- { label: 'New insight', value: 'insight' },- { label: 'New canvas', value: 'canvas' },- ]}- />+ <LemonButton type="secondary" size="small" to={insightUrl} targetBlank>+ New insight+ </LemonButton></div><div className="flex overflow-y-auto flex-col flex-1 rounded border max-h-200">{eventsDataTableNode && (diff --git a/frontend/src/scenes/notebooks/Notebook/NotebookShareModal.tsx b/frontend/src/scenes/notebooks/Notebook/NotebookShareModal.tsxindex 297a9032e998..2c64a478d212 100644--- a/frontend/src/scenes/notebooks/Notebook/NotebookShareModal.tsx+++ b/frontend/src/scenes/notebooks/Notebook/NotebookShareModal.tsx@@ -7,7 +7,6 @@ import { LemonBanner, LemonButton, LemonDivider, LemonModal } from '@posthog/lemimport { SHARING_MODAL_WIDTH, SharingModalContent } from 'lib/components/Sharing/SharingModal'import { useFeatureFlag } from 'lib/hooks/useFeatureFlag'-import { base64Encode } from 'lib/utils/base64'import { copyToClipboard } from 'lib/utils/copyToClipboard'import { urls } from 'scenes/urls'@@ -31,13 +30,12 @@ export function NotebookShareModal({ shortId }: NotebookShareModalProps): JSX.El}function OpenNotebookShareModal({ shortId }: NotebookShareModalProps): JSX.Element {- const { content, isLocalOnly, isShareModalOpen } = useValues(notebookLogic({ shortId }))+ const { isLocalOnly, isShareModalOpen } = useValues(notebookLogic({ shortId }))const { closeShareModal } = useActions(notebookLogic({ shortId }))const externalSharingEnabled = useFeatureFlag('NOTEBOOK_SHARING')const [interestTracked, setInterestTracked] = useState(false)const notebookUrl = urls.absolute(urls.currentProject(urls.notebook(shortId)))- const canvasUrl = urls.absolute(urls.canvas()) + `#🦔=${base64Encode(JSON.stringify(content))}`const trackInterest = (): void => {posthog.capture('pressed interested in notebook sharing', { url: notebookUrl })@@ -81,8 +79,6 @@ function OpenNotebookShareModal({ shortId }: NotebookShareModalProps): JSX.Eleme>{notebookUrl}</LemonButton>-- <LemonDivider className="my-4" /></>) : (<LemonBanner type="info">@@ -90,23 +86,6 @@ function OpenNotebookShareModal({ shortId }: NotebookShareModalProps): JSX.Eleme</LemonBanner>)}- <h3>Template link</h3>- <p>- The link below will open a Canvas with the contents of this notebook, allowing the receiver to view- it, edit it or create their own notebook without affecting this one.- </p>- <LemonButton- type="secondary"- fullWidth- center- truncate- sideIcon={<IconCopy />}- onClick={() => void copyToClipboard(canvasUrl, 'canvas link')}- title={canvasUrl}- >- {canvasUrl}- </LemonButton>-{!isLocalOnly &&(externalSharingEnabled ? (<>diff --git a/frontend/src/scenes/notebooks/NotebooksScene.tsx b/frontend/src/scenes/notebooks/NotebooksScene.tsxindex 586c6bf32c0f..0b0bf91a8eba 100644--- a/frontend/src/scenes/notebooks/NotebooksScene.tsx+++ b/frontend/src/scenes/notebooks/NotebooksScene.tsx@@ -1,13 +1,8 @@-import { router } from 'kea-router'--import { IconEllipsis } from '@posthog/icons'-import { LemonButton, LemonMenu, Tooltip, lemonToast } from '@posthog/lemon-ui'+import { LemonButton } from '@posthog/lemon-ui'import { AccessControlAction } from 'lib/components/AccessControlAction'import { Shortcut } from 'lib/components/Shortcuts/Shortcut'import { keyBinds } from 'lib/components/Shortcuts/shortcuts'-import { base64Encode } from 'lib/utils/base64'-import { getTextFromFile, selectFiles } from 'lib/utils/file-utils'import { notebooksTableLogic } from 'scenes/notebooks/NotebooksTable/notebooksTableLogic'import { Scene, SceneExport } from 'scenes/sceneTypes'import { urls } from 'scenes/urls'@@ -37,72 +32,28 @@ export function NotebooksScene(): JSX.Element {type: 'notebook',}}actions={- <>- <LemonMenu- items={[- {- label: 'Load from JSON',- onClick: () => {- void selectFiles({- contentType: 'application/json',- multiple: false,- })- .then(async (files) => {- if (!files.length) {- return- }- const text = await getTextFromFile(files[0])- const data = JSON.parse(text)- if (data.type !== 'doc') {- throw new Error('Not a notebook')- }-- // Looks like a notebook- router.actions.push(- urls.canvas(),- {},- {- '🦔': base64Encode(text),- }- )- })- .catch((e) => {- lemonToast.error(e.message)- })- },- },- ]}+ <AccessControlAction+ resourceType={AccessControlResourceType.Notebook}+ minAccessLevel={AccessControlLevel.Editor}+ >+ <Shortcut+ name="NewNotebook"+ keybind={[keyBinds.new]}+ intent="New notebook"+ interaction="click"+ scope={Scene.Notebooks}>- <LemonButton icon={<IconEllipsis />} size="small" />- </LemonMenu>- <Tooltip title="Like a Notebook but all your exploration is persisted to the URL for easy sharing.">- <LemonButton size="small" data-attr="new-canvas" to={urls.canvas()} type="secondary">- New canvas- </LemonButton>- </Tooltip>- <AccessControlAction- resourceType={AccessControlResourceType.Notebook}- minAccessLevel={AccessControlLevel.Editor}- >- <Shortcut- name="NewNotebook"- keybind={[keyBinds.new]}- intent="New notebook"- interaction="click"- scope={Scene.Notebooks}+ <LemonButton+ size="small"+ data-attr="new-notebook"+ to={urls.notebook('new')}+ type="primary"+ tooltip="New notebook">- <LemonButton- size="small"- data-attr="new-notebook"- to={urls.notebook('new')}- type="primary"- tooltip="New notebook"- >- New notebook- </LemonButton>- </Shortcut>- </AccessControlAction>- </>+ New notebook+ </LemonButton>+ </Shortcut>+ </AccessControlAction>}/>