Skip to content

Commit

Permalink
Fixed up when it gets shown
Browse files Browse the repository at this point in the history
  • Loading branch information
benjackwhite committed Nov 23, 2023
1 parent 2f91d4b commit 592fe45
Show file tree
Hide file tree
Showing 3 changed files with 46 additions and 3 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,15 @@
import { Meta, StoryFn } from '@storybook/react'
import { useActions } from 'kea'
import { router } from 'kea-router'
import { FEATURE_FLAGS } from 'lib/constants'
import { useEffect } from 'react'
import { App } from 'scenes/App'
import { urls } from 'scenes/urls'

import { setFeatureFlags } from '~/mocks/browser'
import { SidePanelTab } from '~/types'

import { sidePanelStateLogic } from './sidePanelStateLogic'

const meta: Meta = {
title: 'Scenes-App/SidePanels',
Expand All @@ -10,6 +20,34 @@ const meta: Meta = {
},
}
export default meta
export const SidePanelDocs: StoryFn = () => {

const BaseTemplate = (props: { panel: SidePanelTab }): JSX.Element => {
const { openSidePanel } = useActions(sidePanelStateLogic)
setFeatureFlags([FEATURE_FLAGS.POSTHOG_3000])
useEffect(() => {
router.actions.push(urls.dashboards())
openSidePanel(props.panel)
}, [])

return <App />
}

export const SidePanelDocs: StoryFn = () => {
return <BaseTemplate panel={SidePanelTab.Docs} />
}

export const SidePanelWelcome: StoryFn = () => {
return <BaseTemplate panel={SidePanelTab.Welcome} />
}

export const SidePanelSettings: StoryFn = () => {
return <BaseTemplate panel={SidePanelTab.Settings} />
}

export const SidePanelActivation: StoryFn = () => {
return <BaseTemplate panel={SidePanelTab.Activation} />
}

export const SidePanelNotebooks: StoryFn = () => {
return <BaseTemplate panel={SidePanelTab.Notebooks} />
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { actions, afterMount, connect, kea, path, reducers, selectors } from 'kea'
import { afterMount, connect, kea, path, reducers, selectors } from 'kea'
import { activationLogic } from 'lib/components/ActivationSidebar/activationLogic'
import { FEATURE_FLAGS } from 'lib/constants'
import { featureFlagLogic } from 'lib/logic/featureFlagLogic'
Expand Down Expand Up @@ -37,7 +37,11 @@ export const sidePanelLogic = kea<sidePanelLogicType>([
shouldShowWelcomeAnnouncement: [
(s) => [s.welcomeAnnouncementAcknowledged, s.featureFlags],
(welcomeAnnouncementAcknowledged, featureFlags) => {
if (featureFlags[FEATURE_FLAGS.POSTHOG_3000] && !welcomeAnnouncementAcknowledged) {
if (
featureFlags[FEATURE_FLAGS.POSTHOG_3000] &&
featureFlags[FEATURE_FLAGS.POSTHOG_3000_WELCOME_ANNOUNCEMENT] &&
!welcomeAnnouncementAcknowledged
) {
return true
}

Expand Down
1 change: 1 addition & 0 deletions frontend/src/lib/constants.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,7 @@ export const FEATURE_FLAGS = {
QUERY_ASYNC: 'query-async', // owner: @webjunkie
POSTHOG_3000: 'posthog-3000', // owner: @Twixes
POSTHOG_3000_NAV: 'posthog-3000-nav', // owner: @Twixes
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-monitoring
Expand Down

0 comments on commit 592fe45

Please sign in to comment.