Skip to content

Commit

Permalink
remove unneeded styles and kea things
Browse files Browse the repository at this point in the history
  • Loading branch information
thmsobrmlr committed Dec 28, 2023
1 parent 9088ffa commit d4d3941
Show file tree
Hide file tree
Showing 5 changed files with 2 additions and 171 deletions.
39 changes: 1 addition & 38 deletions frontend/src/layout/navigation/navigationLogic.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,6 @@ export const navigationLogic = kea<navigationLogicType>([
actions: [eventUsageLogic, ['reportProjectNoticeDismissed']],
})),
actions({
toggleActivationSideBar: true,
showActivationSideBar: true,
hideActivationSideBar: true,
hideSideBarMobile: true,
openSitePopover: true,
closeSitePopover: true,
Expand All @@ -55,22 +52,6 @@ export const navigationLogic = kea<navigationLogicType>([
mobileLayout: (window: Window) => window.innerWidth < 992, // Sync width threshold with Sass variable $lg!
})),
reducers({
// Non-mobile base
isSideBarShownBase: [true, { persist: true }, {}],
// Mobile, applied on top of base, so that the sidebar does not show up annoyingly when shrinking the window
isSideBarShownMobile: [
false,
{
hideSideBarMobile: () => false,
},
],
isActivationSideBarShownBase: [
false,
{
showActivationSideBar: () => true,
hideActivationSideBar: () => false,
},
],
isSitePopoverOpen: [
false,
{
Expand All @@ -95,17 +76,6 @@ export const navigationLogic = kea<navigationLogicType>([
],
}),
selectors({
/** `noSidebar` whether the current scene should display a sidebar at all */
noSidebar: [
(s) => [s.fullscreen, s.sceneConfig],
(fullscreen, sceneConfig) => fullscreen || sceneConfig?.layout === 'plain',
],
isActivationSideBarShown: [
(s) => [s.mobileLayout, s.isActivationSideBarShownBase, s.isSideBarShownMobile, s.noSidebar],
(mobileLayout, isActivationSideBarShownBase, isSideBarShownMobile, noSidebar) =>
!noSidebar &&
(mobileLayout ? isActivationSideBarShownBase && !isSideBarShownMobile : isActivationSideBarShownBase),
],
systemStatusHealthy: [
(s) => [s.navigationStatus, preflightLogic.selectors.siteUrlMisconfigured],
(status, siteUrlMisconfigured) => {
Expand Down Expand Up @@ -167,16 +137,9 @@ export const navigationLogic = kea<navigationLogicType>([
},
],
}),
listeners(({ actions, values }) => ({
listeners(({ actions }) => ({
closeProjectNotice: ({ projectNoticeVariant }) => {
actions.reportProjectNoticeDismissed(projectNoticeVariant)
},
toggleActivationSideBar: () => {
if (values.isActivationSideBarShown) {
actions.hideActivationSideBar()
} else {
actions.showActivationSideBar()
}
},
})),
])

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,15 +1,8 @@
import './ActivationSidebar.scss'

import { LemonButton, LemonButtonWithSideActionProps } from '@posthog/lemon-ui'
import { Progress } from 'antd'
import clsx from 'clsx'
import { useActions, useValues } from 'kea'
import { useActions } from 'kea'
import { IconCheckmark, IconClose } from 'lib/lemon-ui/icons'
import { eventUsageLogic } from 'lib/utils/eventUsageLogic'

import { navigationLogic } from '~/layout/navigation/navigationLogic'

import { ProfessorHog } from '../hedgehogs'
import { activationLogic, ActivationTaskType } from './activationLogic'

export const ActivationTask = ({
Expand Down Expand Up @@ -69,58 +62,3 @@ export const ActivationTask = ({
</li>
)
}

export const ActivationSidebar = (): JSX.Element => {
const { isActivationSideBarShown } = useValues(navigationLogic)
const { hideActivationSideBar } = useActions(navigationLogic)
const { activeTasks, completedTasks, completionPercent } = useValues(activationLogic)

return (
<div className={clsx('ActivationSideBar', !isActivationSideBarShown && 'ActivationSideBar--hidden')}>
<div className="ActivationSideBar__content pt-2 px-4 pb-16">
<div className="ActivationSideBar__close_button">
<LemonButton icon={<IconClose />} onClick={() => hideActivationSideBar()} />
</div>
<>
<h2 className="subtitle">Quick Start</h2>
<p>Use our Quick Start guide to learn about everything PostHog can do for you and your product.</p>
<div className="my-4 flex items-center justify-center">
<div className="flex flex-col items-center">
<Progress
type="circle"
strokeWidth={10}
percent={completionPercent}
format={() => activeTasks.length}
strokeColor="#345cff" // primary-light
/>
<p className="text-muted mt-2">still to go</p>
</div>
<div className="ActivationSideBar__hog">
<ProfessorHog className="max-h-full w-auto object-contain" />
</div>
</div>
{activeTasks.length > 0 && (
<div className="mt-4">
<div className="text-muted uppercase text-xs">What's next?</div>
<ul>
{activeTasks.map((task: ActivationTaskType) => (
<ActivationTask key={task.id} {...task} />
))}
</ul>
</div>
)}
{completedTasks.length > 0 && (
<div className="mt-4">
<div className="text-muted uppercase text-xs">Completed</div>
<ul>
{completedTasks.map((task: ActivationTaskType) => (
<ActivationTask key={task.id} {...task} />
))}
</ul>
</div>
)}
</>
</div>
</div>
)
}
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,4 @@ describe('activationLogic', () => {
it('should load custom events on mount', async () => {
expectLogic(logic).toDispatchActions(['loadCustomEvents', 'loadInsights'])
})

it('should report activation sidebar shown', async () => {
navigationLogic.actions.showActivationSideBar()
expectLogic(logic).toDispatchActions(['reportActivationSidebarShown'])
})
})
13 changes: 0 additions & 13 deletions frontend/src/lib/components/ActivationSidebar/activationLogic.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ import { inviteLogic } from 'scenes/settings/organization/inviteLogic'
import { teamLogic } from 'scenes/teamLogic'
import { urls } from 'scenes/urls'

import { navigationLogic } from '~/layout/navigation/navigationLogic'
import { sidePanelStateLogic } from '~/layout/navigation-3000/sidepanel/sidePanelStateLogic'
import { dashboardsModel } from '~/models/dashboardsModel'
import { EventDefinitionType, ProductKey, SidePanelTab, TeamBasicType } from '~/types'
Expand Down Expand Up @@ -66,8 +65,6 @@ export const activationLogic = kea<activationLogicType>([
['showInviteModal', 'loadInvitesSuccess', 'loadInvitesFailure'],
pluginsLogic,
['loadPluginsSuccess', 'loadPluginsFailure'],
navigationLogic,
['toggleActivationSideBar', 'showActivationSideBar', 'hideActivationSideBar'],
sidePanelStateLogic,
['openSidePanel'],
eventUsageLogic,
Expand Down Expand Up @@ -358,13 +355,6 @@ export const activationLogic = kea<activationLogicType>([
actions.addSkippedTask(values.currentTeam.id, id)
}
},
showActivationSideBar: async () => {
actions.reportActivationSideBarShown(
values.activeTasks.length,
values.completedTasks.length,
values.completionPercent
)
},
})),
events(({ actions }) => ({
afterMount: () => {
Expand All @@ -375,10 +365,7 @@ export const activationLogic = kea<activationLogicType>([
urlToAction(({ actions, values }) => ({
'*': (_, params) => {
if (params?.onboarding_completed && !values.hasCompletedAllTasks) {
actions.toggleActivationSideBar()
actions.openSidePanel(SidePanelTab.Activation)
} else {
actions.hideActivationSideBar()
}
},
})),
Expand Down

0 comments on commit d4d3941

Please sign in to comment.