diff --git a/frontend/__snapshots__/scenes-app-notebooks--headings.png b/frontend/__snapshots__/scenes-app-notebooks--headings.png index 4ddf6731b71b5..8df9288063084 100644 Binary files a/frontend/__snapshots__/scenes-app-notebooks--headings.png and b/frontend/__snapshots__/scenes-app-notebooks--headings.png differ diff --git a/frontend/__snapshots__/scenes-app-notebooks--numbered-list.png b/frontend/__snapshots__/scenes-app-notebooks--numbered-list.png index 31e099837847c..76256d08a1d61 100644 Binary files a/frontend/__snapshots__/scenes-app-notebooks--numbered-list.png and b/frontend/__snapshots__/scenes-app-notebooks--numbered-list.png differ diff --git a/frontend/__snapshots__/scenes-app-notebooks--recordings-playlist.png b/frontend/__snapshots__/scenes-app-notebooks--recordings-playlist.png index 50e0e859358e0..768016f6149e4 100644 Binary files a/frontend/__snapshots__/scenes-app-notebooks--recordings-playlist.png and b/frontend/__snapshots__/scenes-app-notebooks--recordings-playlist.png differ diff --git a/frontend/__snapshots__/scenes-app-notebooks--text-formats.png b/frontend/__snapshots__/scenes-app-notebooks--text-formats.png index f1fea5b24cf66..ecf666a2c4f96 100644 Binary files a/frontend/__snapshots__/scenes-app-notebooks--text-formats.png and b/frontend/__snapshots__/scenes-app-notebooks--text-formats.png differ diff --git a/frontend/__snapshots__/scenes-app-notebooks--text-only-notebook.png b/frontend/__snapshots__/scenes-app-notebooks--text-only-notebook.png index 7452eabf77180..bc2f358a8286c 100644 Binary files a/frontend/__snapshots__/scenes-app-notebooks--text-only-notebook.png and b/frontend/__snapshots__/scenes-app-notebooks--text-only-notebook.png differ diff --git a/frontend/__snapshots__/scenes-app-recordings--recordings-play-list-no-pinned-recordings.png b/frontend/__snapshots__/scenes-app-recordings--recordings-play-list-no-pinned-recordings.png index 55b81bc98fcce..f6899d7e36d1d 100644 Binary files a/frontend/__snapshots__/scenes-app-recordings--recordings-play-list-no-pinned-recordings.png and b/frontend/__snapshots__/scenes-app-recordings--recordings-play-list-no-pinned-recordings.png differ diff --git a/frontend/src/lib/constants.tsx b/frontend/src/lib/constants.tsx index 03047c582f7b6..5c19ccd64c558 100644 --- a/frontend/src/lib/constants.tsx +++ b/frontend/src/lib/constants.tsx @@ -158,7 +158,6 @@ export const FEATURE_FLAGS = { REFERRAL_SOURCE_SELECT: 'referral-source-select', // owner: @raquelmsmith SURVEYS_MULTIPLE_CHOICE: 'surveys-multiple-choice', // owner: @liyiy CS_DASHBOARDS: 'cs-dashboards', // owner: @pauldambra - NOTEBOOK_SETTINGS_WIDGETS: 'notebook-settings-widgets', // owner: #team-monitoring PRODUCT_SPECIFIC_ONBOARDING: 'product-specific-onboarding', // owner: @raquelmsmith REDIRECT_SIGNUPS_TO_INSTANCE: 'redirect-signups-to-instance', // owner: @raquelmsmith APPS_AND_EXPORTS_UI: 'apps-and-exports-ui', // owner: @benjackwhite diff --git a/frontend/src/lib/lemon-ui/LemonWidget/LemonWidget.tsx b/frontend/src/lib/lemon-ui/LemonWidget/LemonWidget.tsx index ca3f49fbfce30..36ef211c3109a 100644 --- a/frontend/src/lib/lemon-ui/LemonWidget/LemonWidget.tsx +++ b/frontend/src/lib/lemon-ui/LemonWidget/LemonWidget.tsx @@ -34,7 +34,7 @@ export function LemonWidget({ title, collapsible = true, onClose, children }: Le /> ) : ( - {title} + {title} )} {onClose && } />} diff --git a/frontend/src/scenes/notebooks/Nodes/NodeWrapper.tsx b/frontend/src/scenes/notebooks/Nodes/NodeWrapper.tsx index 4a7d18ea42cce..12b5bc243f948 100644 --- a/frontend/src/scenes/notebooks/Nodes/NodeWrapper.tsx +++ b/frontend/src/scenes/notebooks/Nodes/NodeWrapper.tsx @@ -67,7 +67,8 @@ export function NodeWrapper({ widgets = [], }: NodeWrapperProps & NotebookNodeViewProps): JSX.Element { const mountedNotebookLogic = useMountedLogic(notebookLogic) - const { isEditable } = useValues(mountedNotebookLogic) + const { isEditable, isShowingSidebar } = useValues(mountedNotebookLogic) + const { setIsShowingSidebar } = useActions(mountedNotebookLogic) // nodeId can start null, but should then immediately be generated const nodeId = attributes.nodeId @@ -86,7 +87,7 @@ export function NodeWrapper({ } const nodeLogic = useMountedLogic(notebookNodeLogic(nodeLogicProps)) const { title, resizeable, expanded } = useValues(nodeLogic) - const { setExpanded, deleteNode, setWidgetsVisible } = useActions(nodeLogic) + const { setExpanded, deleteNode } = useActions(nodeLogic) const [ref, inView] = useInView({ triggerOnce: true }) const contentRef = useRef(null) @@ -165,11 +166,12 @@ export function NodeWrapper({ /> )} - {!!widgets.length && isEditable ? ( + {widgets.length > 0 ? ( setWidgetsVisible(true)} + onClick={() => setIsShowingSidebar(!isShowingSidebar)} size="small" icon={} + active={isShowingSidebar && selected} /> ) : null} diff --git a/frontend/src/scenes/notebooks/Nodes/NotebookNodePlaylist.tsx b/frontend/src/scenes/notebooks/Nodes/NotebookNodePlaylist.tsx index 0b801328e378e..0b0e3b7ca4ee8 100644 --- a/frontend/src/scenes/notebooks/Nodes/NotebookNodePlaylist.tsx +++ b/frontend/src/scenes/notebooks/Nodes/NotebookNodePlaylist.tsx @@ -14,7 +14,7 @@ import { SessionRecordingPlayer } from 'scenes/session-recordings/player/Session import { useMemo, useState } from 'react' import { fromParamsGivenUrl } from 'lib/utils' import { LemonButton } from '@posthog/lemon-ui' -import { IconChevronLeft, IconSettings } from 'lib/lemon-ui/icons' +import { IconChevronLeft } from 'lib/lemon-ui/icons' import { urls } from 'scenes/urls' import { notebookNodeLogic } from './notebookNodeLogic' import { JSONContent, NotebookNodeViewProps, NotebookNodeAttributeProperties } from '../Notebook/utils' @@ -130,7 +130,6 @@ export const NotebookNodePlaylist = createPostHogWidgetNode, Component: Settings, }, ], diff --git a/frontend/src/scenes/notebooks/Nodes/NotebookNodeQuery.tsx b/frontend/src/scenes/notebooks/Nodes/NotebookNodeQuery.tsx index 1e83703fb4299..0181bcc0eca9f 100644 --- a/frontend/src/scenes/notebooks/Nodes/NotebookNodeQuery.tsx +++ b/frontend/src/scenes/notebooks/Nodes/NotebookNodeQuery.tsx @@ -7,7 +7,6 @@ import { useMemo } from 'react' import { notebookNodeLogic } from './notebookNodeLogic' import { NotebookNodeViewProps, NotebookNodeAttributeProperties } from '../Notebook/utils' import clsx from 'clsx' -import { IconSettings } from 'lib/lemon-ui/icons' import { urls } from 'scenes/urls' import api from 'lib/api' import { containsHogQLQuery, isHogQLQuery, isNodeWithSource } from '~/queries/utils' @@ -154,7 +153,6 @@ export const NotebookNodeQuery = createPostHogWidgetNode, Component: Settings, }, ], diff --git a/frontend/src/scenes/notebooks/Nodes/NotebookNodeRecording.tsx b/frontend/src/scenes/notebooks/Nodes/NotebookNodeRecording.tsx index 766fd500a2f5b..5004ba492124a 100644 --- a/frontend/src/scenes/notebooks/Nodes/NotebookNodeRecording.tsx +++ b/frontend/src/scenes/notebooks/Nodes/NotebookNodeRecording.tsx @@ -15,7 +15,6 @@ import { } from 'scenes/session-recordings/playlist/SessionRecordingPreview' import { notebookNodeLogic } from './notebookNodeLogic' import { LemonSwitch } from '@posthog/lemon-ui' -import { IconSettings } from 'lib/lemon-ui/icons' import { JSONContent, NotebookNodeViewProps, NotebookNodeAttributeProperties } from '../Notebook/utils' const HEIGHT = 500 @@ -102,7 +101,6 @@ export const NotebookNodeRecording = createPostHogWidgetNode, Component: Settings, }, ], diff --git a/frontend/src/scenes/notebooks/Nodes/notebookNodeLogic.ts b/frontend/src/scenes/notebooks/Nodes/notebookNodeLogic.ts index ce281db18dc3e..4d5adb4470745 100644 --- a/frontend/src/scenes/notebooks/Nodes/notebookNodeLogic.ts +++ b/frontend/src/scenes/notebooks/Nodes/notebookNodeLogic.ts @@ -70,7 +70,6 @@ export const notebookNodeLogic = kea([ timestamp, sessionRecordingId, }), - setWidgetsVisible: (visible: boolean) => ({ visible }), setPreviousNode: (node: Node | null) => ({ node }), setNextNode: (node: Node | null) => ({ node }), deleteNode: true, @@ -112,22 +111,12 @@ export const notebookNodeLogic = kea([ setNextNode: (_, { node }) => node, }, ], - widgetsVisible: [ - false, - { - setWidgetsVisible: (_, { visible }) => visible, - }, - ], })), selectors({ notebookLogic: [(_, p) => [p.notebookLogic], (notebookLogic) => notebookLogic], nodeAttributes: [(_, p) => [p.attributes], (nodeAttributes) => nodeAttributes], widgets: [(_, p) => [p.widgets], (widgets) => widgets], - isShowingWidgets: [ - (s, p) => [s.widgetsVisible, p.widgets], - (widgetsVisible, widgets) => !!widgets.length && widgetsVisible, - ], }), listeners(({ actions, values, props }) => ({ diff --git a/frontend/src/scenes/notebooks/Notebook/Notebook.tsx b/frontend/src/scenes/notebooks/Notebook/Notebook.tsx index 296301a7d8f7c..6e9adb4825f7b 100644 --- a/frontend/src/scenes/notebooks/Notebook/Notebook.tsx +++ b/frontend/src/scenes/notebooks/Notebook/Notebook.tsx @@ -13,8 +13,6 @@ import { NotebookConflictWarning } from './NotebookConflictWarning' import { NotebookLoadingState } from './NotebookLoadingState' import { Editor } from './Editor' import { EditorFocusPosition } from './utils' -import { FlaggedFeature } from 'lib/components/FlaggedFeature' -import { FEATURE_FLAGS } from 'lib/constants' import { NotebookSidebar } from './NotebookSidebar' import { ErrorBoundary } from '~/layout/ErrorBoundary' @@ -99,9 +97,7 @@ export function Notebook({ shortId, editable = false, initialAutofocus = null }: ) : null}
- - - + { const { selectedNodeLogic, isShowingSidebar, isEditable } = useValues(notebookLogic) + const { setIsShowingSidebar } = useActions(notebookLogic) if (!isEditable) { return null @@ -17,23 +18,29 @@ export const NotebookSidebar = (): JSX.Element | null => { 'NotebookSidebar--showing': isShowingSidebar, })} > -
{selectedNodeLogic && }
+
+ {selectedNodeLogic && isShowingSidebar && ( + setIsShowingSidebar(false)} /> + )} +
) } -export const Widgets = ({ logic }: { logic: BuiltLogic }): JSX.Element | null => { - const { widgets, nodeAttributes, isShowingWidgets } = useValues(logic) - const { updateAttributes, setWidgetsVisible } = useActions(logic) - - if (!isShowingWidgets) { - return null - } +export const Widgets = ({ + logic, + onClose, +}: { + logic: BuiltLogic + onClose: () => void +}): JSX.Element | null => { + const { widgets, nodeAttributes } = useValues(logic) + const { updateAttributes } = useActions(logic) return (
{widgets.map(({ key, label, Component }) => ( - setWidgetsVisible(false)}> +
diff --git a/frontend/src/scenes/notebooks/Notebook/notebookLogic.ts b/frontend/src/scenes/notebooks/Notebook/notebookLogic.ts index a19b5f09dd1c5..68cb94dbc3265 100644 --- a/frontend/src/scenes/notebooks/Notebook/notebookLogic.ts +++ b/frontend/src/scenes/notebooks/Notebook/notebookLogic.ts @@ -77,6 +77,7 @@ export const notebookLogic = kea([ exportJSON: true, showConflictWarning: true, onUpdateEditor: true, + setIsShowingSidebar: (showing: boolean) => ({ showing }), registerNodeLogic: (nodeLogic: BuiltLogic) => ({ nodeLogic }), unregisterNodeLogic: (nodeLogic: BuiltLogic) => ({ nodeLogic }), setEditable: (editable: boolean) => ({ editable }), @@ -166,6 +167,13 @@ export const notebookLogic = kea([ setEditable: (_, { editable }) => editable, }, ], + isShowingSidebar: [ + false, + { + setSelectedNodeId: (showing, { selectedNodeId }) => (selectedNodeId ? showing : false), + setIsShowingSidebar: (_, { showing }) => showing, + }, + ], }), loaders(({ values, props, actions }) => ({ notebook: [ @@ -334,10 +342,6 @@ export const notebookLogic = kea([ } }, ], - isShowingSidebar: [ - (s) => [s.selectedNodeLogic], - (selectedNodeLogic) => selectedNodeLogic?.values.isShowingWidgets, - ], }), sharedListeners(({ values, actions }) => ({ onNotebookChange: () => { diff --git a/frontend/src/scenes/notebooks/Notebook/utils.ts b/frontend/src/scenes/notebooks/Notebook/utils.ts index 44feef88726e0..ed78f61d20f89 100644 --- a/frontend/src/scenes/notebooks/Notebook/utils.ts +++ b/frontend/src/scenes/notebooks/Notebook/utils.ts @@ -48,7 +48,6 @@ export type NotebookNodeViewProps = Omit export type NotebookNodeWidget = { key: string label: string - icon: JSX.Element // using 'any' here shouldn't be necessary but, I couldn't figure out how to set a generic on the notebookNodeLogic props Component: ({ attributes, updateAttributes }: NotebookNodeAttributeProperties) => JSX.Element } diff --git a/playwright/e2e-vrt/layout/Navigation.spec.ts-snapshots/Navigation-App-Page-With-Side-Bar-Hidden-Mobile-1-chromium-linux.png b/playwright/e2e-vrt/layout/Navigation.spec.ts-snapshots/Navigation-App-Page-With-Side-Bar-Hidden-Mobile-1-chromium-linux.png index 24af8b2279910..8b8203a70dcf5 100644 Binary files a/playwright/e2e-vrt/layout/Navigation.spec.ts-snapshots/Navigation-App-Page-With-Side-Bar-Hidden-Mobile-1-chromium-linux.png and b/playwright/e2e-vrt/layout/Navigation.spec.ts-snapshots/Navigation-App-Page-With-Side-Bar-Hidden-Mobile-1-chromium-linux.png differ diff --git a/playwright/e2e-vrt/layout/Navigation.spec.ts-snapshots/Navigation-App-Page-With-Side-Bar-Shown-Mobile-1-chromium-linux.png b/playwright/e2e-vrt/layout/Navigation.spec.ts-snapshots/Navigation-App-Page-With-Side-Bar-Shown-Mobile-1-chromium-linux.png index 24af8b2279910..8b8203a70dcf5 100644 Binary files a/playwright/e2e-vrt/layout/Navigation.spec.ts-snapshots/Navigation-App-Page-With-Side-Bar-Shown-Mobile-1-chromium-linux.png and b/playwright/e2e-vrt/layout/Navigation.spec.ts-snapshots/Navigation-App-Page-With-Side-Bar-Shown-Mobile-1-chromium-linux.png differ