diff --git a/frontend/__snapshots__/lemon-ui-icons--shelf-s--dark.png b/frontend/__snapshots__/lemon-ui-icons--shelf-s--dark.png index ee492a5f8b73f..b9ee609363c1c 100644 Binary files a/frontend/__snapshots__/lemon-ui-icons--shelf-s--dark.png and b/frontend/__snapshots__/lemon-ui-icons--shelf-s--dark.png differ diff --git a/frontend/__snapshots__/lemon-ui-icons--shelf-s--light.png b/frontend/__snapshots__/lemon-ui-icons--shelf-s--light.png index d32382360be81..ea4c969acd228 100644 Binary files a/frontend/__snapshots__/lemon-ui-icons--shelf-s--light.png and b/frontend/__snapshots__/lemon-ui-icons--shelf-s--light.png differ diff --git a/frontend/__snapshots__/scenes-app-saved-insights--card-view--dark.png b/frontend/__snapshots__/scenes-app-saved-insights--card-view--dark.png index ae53ed381d52e..64713d6edc184 100644 Binary files a/frontend/__snapshots__/scenes-app-saved-insights--card-view--dark.png and b/frontend/__snapshots__/scenes-app-saved-insights--card-view--dark.png differ diff --git a/frontend/__snapshots__/scenes-app-saved-insights--card-view--light.png b/frontend/__snapshots__/scenes-app-saved-insights--card-view--light.png index bc635c186f081..5a615a4ede0fb 100644 Binary files a/frontend/__snapshots__/scenes-app-saved-insights--card-view--light.png and b/frontend/__snapshots__/scenes-app-saved-insights--card-view--light.png differ diff --git a/frontend/__snapshots__/scenes-app-saved-insights--empty-state--dark.png b/frontend/__snapshots__/scenes-app-saved-insights--empty-state--dark.png index d8501f9f024ce..f48a4db9810da 100644 Binary files a/frontend/__snapshots__/scenes-app-saved-insights--empty-state--dark.png and b/frontend/__snapshots__/scenes-app-saved-insights--empty-state--dark.png differ diff --git a/frontend/__snapshots__/scenes-app-saved-insights--empty-state--light.png b/frontend/__snapshots__/scenes-app-saved-insights--empty-state--light.png index b8c09f4a9c806..52ee33bc4e57d 100644 Binary files a/frontend/__snapshots__/scenes-app-saved-insights--empty-state--light.png and b/frontend/__snapshots__/scenes-app-saved-insights--empty-state--light.png differ diff --git a/frontend/__snapshots__/scenes-app-saved-insights--list-view--dark.png b/frontend/__snapshots__/scenes-app-saved-insights--list-view--dark.png index 3b6b4c722a4f2..8cb857bd8cd19 100644 Binary files a/frontend/__snapshots__/scenes-app-saved-insights--list-view--dark.png and b/frontend/__snapshots__/scenes-app-saved-insights--list-view--dark.png differ diff --git a/frontend/__snapshots__/scenes-app-saved-insights--list-view--light.png b/frontend/__snapshots__/scenes-app-saved-insights--list-view--light.png index 41e3786b1eec3..c9afcddbf64da 100644 Binary files a/frontend/__snapshots__/scenes-app-saved-insights--list-view--light.png and b/frontend/__snapshots__/scenes-app-saved-insights--list-view--light.png differ diff --git a/frontend/src/layout/navigation/SideBar/SideBar.tsx b/frontend/src/layout/navigation/SideBar/SideBar.tsx index 416905002515c..4b4b5832f129c 100644 --- a/frontend/src/layout/navigation/SideBar/SideBar.tsx +++ b/frontend/src/layout/navigation/SideBar/SideBar.tsx @@ -1,10 +1,10 @@ import { ActivationSidebar } from 'lib/components/ActivationSidebar/ActivationSidebar' -import { NotebookPopover } from 'scenes/notebooks/NotebookPanel/NotebookPopover' +import { DebugNotice } from 'lib/components/DebugNotice' export function SideBar(): JSX.Element { return (
- +
) diff --git a/frontend/src/lib/lemon-ui/icons/icons.tsx b/frontend/src/lib/lemon-ui/icons/icons.tsx index 875af5c55b2b0..149afd3bceedc 100644 --- a/frontend/src/lib/lemon-ui/icons/icons.tsx +++ b/frontend/src/lib/lemon-ui/icons/icons.tsx @@ -1451,18 +1451,6 @@ export function IconLockOpen(props: LemonIconProps): JSX.Element { ) } -/** Material Design Share icon. */ -export function IconShare(props: LemonIconProps): JSX.Element { - return ( - - - - ) -} - /** Material Design Delete Forever icon. */ export function IconDeleteForever(props: LemonIconProps): JSX.Element { return ( diff --git a/frontend/src/scenes/notebooks/Notebook/Notebook.scss b/frontend/src/scenes/notebooks/Notebook/Notebook.scss index 6e8449bf0ef88..3b918abb8461a 100644 --- a/frontend/src/scenes/notebooks/Notebook/Notebook.scss +++ b/frontend/src/scenes/notebooks/Notebook/Notebook.scss @@ -183,17 +183,14 @@ transform: translateX(-100%); } - .NotebookScene &, - .NotebookPopover & { + .NotebookScene & { --notebook-sidebar-height: calc(100vh - 11rem); .NotebookColumn__padding { // Account for fixed title height: 4rem; } - } - .NotebookScene & { .NotebookColumn__content { // Account for static header top: 4rem; diff --git a/frontend/src/scenes/notebooks/NotebookPanel/NotebookPopover.scss b/frontend/src/scenes/notebooks/NotebookPanel/NotebookPopover.scss deleted file mode 100644 index 938be24fbd6c8..0000000000000 --- a/frontend/src/scenes/notebooks/NotebookPanel/NotebookPopover.scss +++ /dev/null @@ -1,141 +0,0 @@ -@import '../../../styles/mixins'; - -.NotebookPopover { - position: fixed; - inset: 0; - z-index: var(--z-modal); - pointer-events: none; - - .NotebookPopover__backdrop { - position: absolute; - inset: 0; - z-index: 1; - pointer-events: none; - background-color: rgb(0 0 0 / 10%); - opacity: 0; - transition: opacity 200ms ease-out; - } - - .NotebookPopover__content { - position: absolute; - top: 1rem; - right: 1rem; - bottom: 1rem; - z-index: 2; - display: flex; - flex-direction: column; - width: 50rem; // This will be controlable - min-width: 30rem; - max-width: calc(100vw - 2rem); - pointer-events: all; - transition: transform var(--notebook-popover-transition-properties), - width var(--notebook-popover-transition-properties); - - // Transition properties that are overwritten - transform: translateX(calc(100% + 1rem)); - - .NotebookPopover__content__card { - display: flex; - flex: 1; - flex-direction: column; - overflow: hidden; - background-color: var(--bg-3000); - border: 1px solid var(--border-3000); - border-radius: var(--radius); - box-shadow: 0 16px 16px rgb(0 0 0 / 0%); - transition: box-shadow 150ms linear; - } - } - - &--visible { - .NotebookPopover__backdrop { - pointer-events: all; - opacity: 1; - } - - .NotebookPopover__content { - transform: translateX(0); - - .NotebookPopover__content__card { - box-shadow: 0 16px 16px rgb(0 0 0 / 15%); - } - } - } - - &--peek { - .NotebookPopover__content { - transition: none; // NOTE: This shouldn't be none as it affects other transitions - transform: translateX(calc(100% - 5rem)); - - .NotebookPopover__content__card { - box-shadow: 0 16px 16px rgb(0 0 0 / 15%); - } - } - } - - &--with-sidebar { - // TODO: Sync this with the sidebar width itself - .NotebookPopover__content { - width: calc(50rem + var(--notebook-column-left-width)); - } - } - - &--full-screen { - .NotebookPopover__content { - width: calc(100vw - 2rem); - } - } - - .NotebookPanelDropzone { - display: flex; - height: 4rem; - margin-bottom: 1rem; - backdrop-filter: blur(5px); - border: 2px dashed var(--border-3000); - border-radius: var(--radius); - box-shadow: 0 16px 16px rgb(0 0 0 / 15%); - transition: all 150ms; - - .NotebookPanelDropzone__message { - display: flex; - flex: 1; - flex-direction: column; - align-items: center; - justify-content: center; - padding: 1rem; - font-size: 1rem; - font-weight: 700; - color: var(--muted-alt); - text-align: center; - pointer-events: none; - background-color: var(--bg-light); - opacity: 0.75; - transition: all 150ms; - } - - .NotebookPanelDropzone__dropped { - display: flex; - flex: 1; - flex-direction: column; - overflow: hidden; - } - - &--active { - height: 8rem; - border-color: var(--primary-3000); - - .NotebookPanelDropzone__message { - opacity: 1; - } - } - - &--dropped { - align-items: initial; - justify-content: flex-start; - height: 100%; - padding: 1rem; - background-color: var(--bg-light); - border-color: var(--primary-3000); - } - } -} diff --git a/frontend/src/scenes/notebooks/NotebookPanel/NotebookPopover.tsx b/frontend/src/scenes/notebooks/NotebookPanel/NotebookPopover.tsx deleted file mode 100644 index 19e2c33fea9b7..0000000000000 --- a/frontend/src/scenes/notebooks/NotebookPanel/NotebookPopover.tsx +++ /dev/null @@ -1,160 +0,0 @@ -import './NotebookPopover.scss' - -import { LemonButton } from '@posthog/lemon-ui' -import clsx from 'clsx' -import { useActions, useValues } from 'kea' -import { useKeyboardHotkeys } from 'lib/hooks/useKeyboardHotkeys' -import { useResizeBreakpoints } from 'lib/hooks/useResizeObserver' -import { IconChevronRight, IconFullScreen, IconOpenInNew, IconShare } from 'lib/lemon-ui/icons' -import { useEffect, useMemo, useRef } from 'react' -import { notebookPopoverLogic } from 'scenes/notebooks/NotebookPanel/notebookPopoverLogic' -import { sceneLogic } from 'scenes/sceneLogic' -import { Scene } from 'scenes/sceneTypes' -import { urls } from 'scenes/urls' - -import { Notebook } from '../Notebook/Notebook' -import { NotebookListMini } from '../Notebook/NotebookListMini' -import { notebookLogic } from '../Notebook/notebookLogic' -import { NotebookExpandButton, NotebookSyncInfo } from '../Notebook/NotebookMeta' -import { openNotebookShareDialog } from '../Notebook/NotebookShare' -import { NotebookPanelDropzone } from './NotebookPanelDropzone' - -export function NotebookPopoverCard(): JSX.Element | null { - const { popoverVisibility, shownAtLeastOnce, fullScreen, selectedNotebook, initialAutofocus, droppedResource } = - useValues(notebookPopoverLogic) - const { setPopoverVisibility, setFullScreen, selectNotebook } = useActions(notebookPopoverLogic) - const { notebook } = useValues(notebookLogic({ shortId: selectedNotebook })) - const { activeScene } = useValues(sceneLogic) - - const showEditor = activeScene === Scene.Notebook ? popoverVisibility !== 'hidden' : shownAtLeastOnce - const editable = popoverVisibility !== 'hidden' && !notebook?.is_template - - const { ref, size } = useResizeBreakpoints({ - 0: 'small', - 832: 'medium', - }) - - const contentWidthHasEffect = useMemo(() => fullScreen && size === 'medium', [fullScreen, size]) - - if (droppedResource) { - return null - } - - return ( -
-
- - selectNotebook(notebook.short_id)} - /> - - - {selectedNotebook && } - - setPopoverVisibility('hidden')} - icon={} - tooltip="View notebook outside of popover" - tooltipPlacement="left" - /> - openNotebookShareDialog({ shortId: selectedNotebook })} - icon={} - tooltip="Share notebook" - tooltipPlacement="left" - /> - - {contentWidthHasEffect && } - - setFullScreen(!fullScreen)} - active={fullScreen} - icon={} - tooltip="Toggle full screen" - tooltipPlacement="left" - /> - - setPopoverVisibility('hidden')} - icon={} - tooltip="Hide Notebook Sidebar" - tooltipPlacement="left" - /> - -
- -
- {showEditor && ( - - )} -
-
- ) -} - -export function NotebookPopover(): JSX.Element { - const { popoverVisibility, fullScreen, selectedNotebook, dropProperties } = useValues(notebookPopoverLogic) - const { setPopoverVisibility, setFullScreen, setElementRef } = useActions(notebookPopoverLogic) - const { isShowingLeftColumn } = useValues(notebookLogic({ shortId: selectedNotebook })) - - const ref = useRef(null) - - useKeyboardHotkeys( - popoverVisibility === 'visible' - ? { - escape: { - action: () => { - if (fullScreen) { - setFullScreen(false) - } else { - setPopoverVisibility('hidden') - } - }, - }, - } - : {}, - [popoverVisibility] - ) - - useEffect(() => { - if (ref.current) { - setElementRef(ref) - } - }, [ref.current]) - - return ( -
-
setPopoverVisibility('hidden') : undefined} - /> -
setPopoverVisibility('visible') : undefined} - {...dropProperties} - > - - -
-
- ) -} diff --git a/frontend/src/scenes/notebooks/NotebookPanel/notebookPanelLogic.ts b/frontend/src/scenes/notebooks/NotebookPanel/notebookPanelLogic.ts index 23a14ba8d4d9b..45026a1b90121 100644 --- a/frontend/src/scenes/notebooks/NotebookPanel/notebookPanelLogic.ts +++ b/frontend/src/scenes/notebooks/NotebookPanel/notebookPanelLogic.ts @@ -7,25 +7,12 @@ import { NotebookNodeResource, SidePanelTab } from '~/types' import { EditorFocusPosition } from '../Notebook/utils' import type { notebookPanelLogicType } from './notebookPanelLogicType' -import { notebookPopoverLogic } from './notebookPopoverLogic' export const notebookPanelLogic = kea([ path(['scenes', 'notebooks', 'Notebook', 'notebookPanelLogic']), connect({ - values: [ - sidePanelStateLogic, - ['sidePanelOpen', 'selectedTab'], - featureFlagLogic, - ['featureFlags'], - notebookPopoverLogic, - ['popoverVisibility'], - ], - actions: [ - sidePanelStateLogic, - ['openSidePanel', 'closeSidePanel'], - notebookPopoverLogic, - ['setPopoverVisibility'], - ], + values: [sidePanelStateLogic, ['sidePanelOpen', 'selectedTab'], featureFlagLogic, ['featureFlags']], + actions: [sidePanelStateLogic, ['openSidePanel', 'closeSidePanel']], }), actions({ selectNotebook: (id: string, options: { autofocus?: EditorFocusPosition; silent?: boolean } = {}) => ({ @@ -70,8 +57,8 @@ export const notebookPanelLogic = kea([ selectors(({ cache, actions }) => ({ visibility: [ - (s) => [s.selectedTab, s.sidePanelOpen, s.popoverVisibility], - (selectedTab, sidePanelOpen): 'hidden' | 'peek' | 'visible' => { + (s) => [s.selectedTab, s.sidePanelOpen], + (selectedTab, sidePanelOpen): 'hidden' | 'visible' => { return selectedTab === SidePanelTab.Notebooks && sidePanelOpen ? 'visible' : 'hidden' }, ], diff --git a/frontend/src/scenes/notebooks/NotebookPanel/notebookPopoverLogic.ts b/frontend/src/scenes/notebooks/NotebookPanel/notebookPopoverLogic.ts deleted file mode 100644 index d1a0997d2179e..0000000000000 --- a/frontend/src/scenes/notebooks/NotebookPanel/notebookPopoverLogic.ts +++ /dev/null @@ -1,162 +0,0 @@ -import { actions, kea, listeners, path, reducers, selectors } from 'kea' -import { urlToAction } from 'kea-router' -import { subscriptions } from 'kea-subscriptions' -import posthog from 'posthog-js' -import { HTMLProps, RefObject } from 'react' - -import { NotebookNodeResource, NotebookPopoverVisibility } from '~/types' - -import { EditorFocusPosition } from '../Notebook/utils' -import type { notebookPopoverLogicType } from './notebookPopoverLogicType' - -export const notebookPopoverLogic = kea([ - path(['scenes', 'notebooks', 'Notebook', 'notebookPopoverLogic']), - actions({ - setFullScreen: (full: boolean) => ({ full }), - selectNotebook: (id: string, autofocus: EditorFocusPosition | undefined = undefined) => ({ id, autofocus }), - setElementRef: (element: RefObject) => ({ element }), - setPopoverVisibility: (visibility: NotebookPopoverVisibility) => ({ visibility }), - startDropMode: true, - endDropMode: true, - setDropDistance: (distance: number) => ({ distance }), - setDroppedResource: (resource: NotebookNodeResource | string | null) => ({ resource }), - }), - - reducers(() => ({ - selectedNotebook: [ - 'scratchpad', - { persist: true }, - { - selectNotebook: (_, { id }) => id, - }, - ], - popoverVisibility: [ - 'hidden' as NotebookPopoverVisibility, - { - setPopoverVisibility: (_, { visibility }) => visibility, - }, - ], - fullScreen: [ - false, - { - setFullScreen: (_, { full }) => full, - setPopoverVisibility: (state, { visibility }) => (visibility === 'hidden' ? false : state), - }, - ], - initialAutofocus: [ - 'start' as EditorFocusPosition, - { - selectNotebook: (_, { autofocus }) => autofocus ?? 'start', - }, - ], - elementRef: [ - null as RefObject | null, - { - setElementRef: (_, { element }) => element, - }, - ], - shownAtLeastOnce: [ - false, - { - setPopoverVisibility: (state, { visibility }) => visibility !== 'hidden' || state, - }, - ], - dropMode: [ - false, - { - startDropMode: () => true, - endDropMode: () => false, - }, - ], - dropDistance: [ - 0, - { - startDropMode: () => -1, - endDropMode: () => -1, - setDropDistance: (_, { distance }) => distance, - }, - ], - droppedResource: [ - null as NotebookNodeResource | string | null, - { - setPopoverVisibility: (state, { visibility }) => (visibility === 'hidden' ? null : state), - setDroppedResource: (_, { resource }) => resource, - }, - ], - })), - - selectors(({ cache, actions }) => ({ - dropProperties: [ - (s) => [s.dropMode, s.popoverVisibility, s.dropDistance], - ( - dropMode, - visibility, - dropDistance - ): Pick, 'onDragEnter' | 'onDragLeave' | 'style'> => { - return dropMode - ? { - onDragEnter: () => { - cache.dragEntercount = (cache.dragEntercount || 0) + 1 - if (cache.dragEntercount === 1) { - actions.setPopoverVisibility('visible') - } - }, - - onDragLeave: () => { - cache.dragEntercount = (cache.dragEntercount || 0) - 1 - - if (cache.dragEntercount <= 0) { - cache.dragEntercount = 0 - actions.setPopoverVisibility('peek') - } - }, - style: { - transform: visibility === 'peek' ? `translateX(${(1 - dropDistance) * 100}%)` : undefined, - }, - } - : {} - }, - ], - })), - - subscriptions({ - popoverVisibility: (value, oldvalue) => { - if (oldvalue !== undefined && value !== oldvalue) { - posthog.capture(`notebook sidebar ${value}`) - } - }, - }), - - listeners(({ cache, actions, values }) => ({ - startDropMode: () => { - cache.dragEntercount = 0 - cache.dragStart = null - actions.setPopoverVisibility('peek') - - cache.dragListener = (event: MouseEvent) => { - if (!cache.dragStart) { - cache.dragStart = event.pageX - } - - // The drop distance is the percentage between where the drag started and where it now is - const dropDistance = (event.pageX - cache.dragStart) / window.innerWidth - actions.setDropDistance(dropDistance) - } - window.addEventListener('drag', cache.dragListener) - }, - endDropMode: () => { - if (values.popoverVisibility === 'peek') { - actions.setPopoverVisibility('hidden') - } - window.removeEventListener('drag', cache.dragListener) - }, - })), - - urlToAction(({ actions, values }) => ({ - '/*': (_, __, ___, { pathname }, { pathname: previousPathname }) => { - if (values.popoverVisibility === 'visible' && pathname != previousPathname) { - actions.setPopoverVisibility('hidden') - } - }, - })), -])