Skip to content

Commit

Permalink
chore(notebooks): remove feature flag (#19506)
Browse files Browse the repository at this point in the history
  • Loading branch information
thmsobrmlr authored and fuziontech committed Jan 4, 2024
1 parent 44f18ae commit 42ac158
Show file tree
Hide file tree
Showing 10 changed files with 32 additions and 65 deletions.
3 changes: 0 additions & 3 deletions frontend/src/layout/navigation-3000/Navigation.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import { BillingAlertsV2 } from 'lib/components/BillingAlertsV2'
import { CommandPalette } from 'lib/components/CommandPalette/CommandPalette'
import { FlaggedFeature } from 'lib/components/FlaggedFeature'
import { FEATURE_FLAGS } from 'lib/constants'
import posthog from 'posthog-js'
import { ReactNode, useEffect } from 'react'
import { SceneConfig } from 'scenes/sceneTypes'

Expand Down Expand Up @@ -34,8 +33,6 @@ export function Navigation({
useEffect(() => {
// FIXME: Include debug notice in a non-obstructing way
document.getElementById('bottom-notice')?.remove()
// TODO: Unflag Notebooks once the 3000 experiment is over
posthog.updateEarlyAccessFeatureEnrollment(FEATURE_FLAGS.NOTEBOOKS, true)
}, [])

if (mode !== 'full') {
Expand Down
1 change: 0 additions & 1 deletion frontend/src/layout/navigation-3000/navigationLogic.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -335,7 +335,6 @@ export const navigation3000Logic = kea<navigation3000LogicType>([
label: 'Notebooks',
icon: <IconNotebook />,
to: urls.notebooks(),
featureFlag: FEATURE_FLAGS.NOTEBOOKS,
tag: 'new' as const,
},
{
Expand Down
26 changes: 12 additions & 14 deletions frontend/src/layout/navigation/SideBar/SideBar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -150,20 +150,18 @@ function Pages(): JSX.Element {
},
}}
/>
<FlaggedFeature flag="notebooks">
<PageButton
icon={<IconNotebook />}
identifier={Scene.Notebooks}
to={urls.notebooks()}
sideAction={{
icon: <IconPlus />,
to: urls.notebook('new'),
tooltip: 'New notebook',
identifier: Scene.Notebook,
onClick: hideSideBarMobile,
}}
/>
</FlaggedFeature>
<PageButton
icon={<IconNotebook />}
identifier={Scene.Notebooks}
to={urls.notebooks()}
sideAction={{
icon: <IconPlus />,
to: urls.notebook('new'),
tooltip: 'New notebook',
identifier: Scene.Notebook,
onClick: hideSideBarMobile,
}}
/>
<PageButton
icon={<IconBarChart />}
identifier={Scene.SavedInsights}
Expand Down
9 changes: 2 additions & 7 deletions frontend/src/layout/navigation/TopBar/TopBar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,6 @@ export function TopBar(): JSX.Element {
const { isProjectSwitcherShown } = useValues(topBarLogic)
const { toggleProjectSwitcher, hideProjectSwitcher } = useActions(topBarLogic)

const hasNotebooks = !!featureFlags[FEATURE_FLAGS.NOTEBOOKS]

const groupTypes = [
TaxonomicFilterGroupType.Events,
TaxonomicFilterGroupType.Persons,
Expand All @@ -46,13 +44,10 @@ export function TopBar(): JSX.Element {
TaxonomicFilterGroupType.Plugins,
TaxonomicFilterGroupType.Experiments,
TaxonomicFilterGroupType.Dashboards,
TaxonomicFilterGroupType.Notebooks,
...groupNamesTaxonomicTypes,
]

if (hasNotebooks) {
groupTypes.push(TaxonomicFilterGroupType.Notebooks)
}

return (
<>
<Announcement />
Expand Down Expand Up @@ -90,7 +85,7 @@ export function TopBar(): JSX.Element {
url={`${window.location.origin}${window.POSTHOG_APP_CONTEXT.year_in_hog_url}`}
/>
)}
{hasNotebooks && <NotebookButton />}
<NotebookButton />
<NotificationBell />
</>
) : (
Expand Down
1 change: 0 additions & 1 deletion frontend/src/lib/constants.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,6 @@ export const FEATURE_FLAGS = {
POSTHOG_3000_WELCOME_ANNOUNCEMENT: 'posthog-3000-welcome-announcement', // owner: #posthog-3000
ENABLE_PROMPTS: 'enable-prompts', // owner: @lharries
FEEDBACK_SCENE: 'feedback-scene', // owner: @lharries
NOTEBOOKS: 'notebooks', // owner: #team-replay
HEDGEHOG_MODE: 'hedgehog-mode', // owner: @benjackwhite
HEDGEHOG_MODE_DEBUG: 'hedgehog-mode-debug', // owner: @benjackwhite
GENERIC_SIGNUP_BENEFITS: 'generic-signup-benefits', // experiment, owner: @raquelmsmith
Expand Down
3 changes: 0 additions & 3 deletions frontend/src/lib/logic/featureFlagLogic.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { actions, afterMount, kea, path, reducers } from 'kea'
import { FEATURE_FLAGS } from 'lib/constants'
import { getAppContext } from 'lib/utils/getAppContext'
import posthog from 'posthog-js'

Expand Down Expand Up @@ -40,8 +39,6 @@ function spyOnFeatureFlags(featureFlags: FeatureFlagsSet): FeatureFlagsSet {
? { ...persistedFlags, ...featureFlags }
: persistedFlags

availableFlags[FEATURE_FLAGS.NOTEBOOKS] = true

if (typeof window.Proxy !== 'undefined') {
return new Proxy(
{},
Expand Down
17 changes: 7 additions & 10 deletions frontend/src/scenes/dashboard/DashboardHeader.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import { router } from 'kea-router'
import { TextCardModal } from 'lib/components/Cards/TextCard/TextCardModal'
import { EditableField } from 'lib/components/EditableField/EditableField'
import { ExportButton, ExportButtonItem } from 'lib/components/ExportButton/ExportButton'
import { FlaggedFeature } from 'lib/components/FlaggedFeature'
import { FullScreen } from 'lib/components/FullScreen'
import { ObjectTags } from 'lib/components/ObjectTags/ObjectTags'
import { PageHeader } from 'lib/components/PageHeader'
Expand Down Expand Up @@ -266,15 +265,13 @@ export function DashboardHeader(): JSX.Element | null {
>
Duplicate dashboard
</LemonButton>
<FlaggedFeature flag={'notebooks'}>
<LemonButton
onClick={() => createNotebookFromDashboard(dashboard)}
status="stealth"
fullWidth
>
Create notebook from dashboard
</LemonButton>
</FlaggedFeature>
<LemonButton
onClick={() => createNotebookFromDashboard(dashboard)}
status="stealth"
fullWidth
>
Create notebook from dashboard
</LemonButton>
{canEditDashboard && (
<LemonButton
onClick={() => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,8 @@
import './DraggableToNotebook.scss'

import clsx from 'clsx'
import { useActions, useValues } from 'kea'
import { FlaggedFeature } from 'lib/components/FlaggedFeature'
import { FEATURE_FLAGS } from 'lib/constants'
import { useActions } from 'kea'
import { useKeyHeld } from 'lib/hooks/useKeyHeld'
import { featureFlagLogic } from 'lib/logic/featureFlagLogic'
import React, { useState } from 'react'

import { NotebookNodeType } from '~/types'
Expand Down Expand Up @@ -33,16 +30,14 @@ export function useNotebookDrag({ href, node, properties, onlyWithModifierKey }:
const { startDropMode, endDropMode } = useActions(notebookPanelLogic)

const [isDragging, setIsDragging] = useState(false)
const { featureFlags } = useValues(featureFlagLogic)

const notebooksEnabled = featureFlags[FEATURE_FLAGS.NOTEBOOKS]
const isInNotebook = useNotebookNode()
const hasDragOptions = !!(href || node)

const altKeyHeld = useKeyHeld('Alt')
const dragModeActive = onlyWithModifierKey ? altKeyHeld : true

if (!hasDragOptions || isInNotebook || !notebooksEnabled || !dragModeActive) {
if (!hasDragOptions || isInNotebook || !dragModeActive) {
return {
isDragging: false,
draggable: false,
Expand Down Expand Up @@ -89,15 +84,13 @@ export function DraggableToNotebook({

return (
<>
<FlaggedFeature flag={FEATURE_FLAGS.NOTEBOOKS} fallback={children}>
<span
className={clsx('DraggableToNotebook', className, isDragging && 'DraggableToNotebook--dragging')}
draggable={draggable}
{...elementProps}
>
{children}
</span>
</FlaggedFeature>
<span
className={clsx('DraggableToNotebook', className, isDragging && 'DraggableToNotebook--dragging')}
draggable={draggable}
{...elementProps}
>
{children}
</span>
</>
)
}
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
import { Meta, StoryFn } from '@storybook/react'
import { FEATURE_FLAGS } from 'lib/constants'
import { NotebookSelectButton } from 'scenes/notebooks/NotebookSelectButton/NotebookSelectButton'

import { setFeatureFlags, useStorybookMocks } from '~/mocks/browser'
import { useStorybookMocks } from '~/mocks/browser'
import { NotebookNodeType } from '~/types'

export default {
Expand Down Expand Up @@ -38,7 +37,6 @@ const allNotebooks = [
]

const Template: StoryFn<typeof NotebookSelectButton> = (props) => {
setFeatureFlags([FEATURE_FLAGS.NOTEBOOKS])
useStorybookMocks({
get: {
'/api/projects/:team_id/notebooks/': (req, res, ctx) => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
import { LemonDivider, LemonDropdown, ProfilePicture } from '@posthog/lemon-ui'
import { BuiltLogic, useActions, useValues } from 'kea'
import { FlaggedFeature } from 'lib/components/FlaggedFeature'
import { FEATURE_FLAGS } from 'lib/constants'
import { dayjs } from 'lib/dayjs'
import { IconPlus, IconWithCount } from 'lib/lemon-ui/icons'
import { LemonButton, LemonButtonProps } from 'lib/lemon-ui/LemonButton'
Expand Down Expand Up @@ -261,9 +259,5 @@ export function NotebookSelectButton({ children, onNotebookOpened, ...props }: N
</LemonButton>
)

return (
<FlaggedFeature flag={FEATURE_FLAGS.NOTEBOOKS} match>
{nodeLogic ? button : <NotebookSelectPopover {...props}>{button}</NotebookSelectPopover>}
</FlaggedFeature>
)
return nodeLogic ? button : <NotebookSelectPopover {...props}>{button}</NotebookSelectPopover>
}

0 comments on commit 42ac158

Please sign in to comment.