Skip to content

Commit

Permalink
feat: warn when heatmaps disabled (#22860)
Browse files Browse the repository at this point in the history
Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com>
  • Loading branch information
pauldambra and github-actions[bot] authored Jun 11, 2024
1 parent 2b651fb commit 2d34372
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 3 deletions.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
30 changes: 28 additions & 2 deletions frontend/src/scenes/heatmaps/HeatmapsBrowser.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { IconCollapse } from '@posthog/icons'
import { IconCollapse, IconGear } from '@posthog/icons'
import { LemonBanner, LemonButton, LemonInputSelect, LemonSkeleton, Spinner, Tooltip } from '@posthog/lemon-ui'
import { BindLogic, useActions, useValues } from 'kea'
import { AuthorizedUrlList } from 'lib/components/AuthorizedUrlList/AuthorizedUrlList'
Expand All @@ -10,6 +10,9 @@ import { DetectiveHog } from 'lib/components/hedgehogs'
import { useResizeObserver } from 'lib/hooks/useResizeObserver'
import { IconChevronRight, IconOpenInNew } from 'lib/lemon-ui/icons'
import React, { useEffect, useRef } from 'react'
import { teamLogic } from 'scenes/teamLogic'

import { sidePanelSettingsLogic } from '~/layout/navigation-3000/sidepanel/panels/sidePanelSettingsLogic'

import { heatmapsBrowserLogic } from './heatmapsBrowserLogic'

Expand Down Expand Up @@ -260,6 +263,28 @@ function EmbeddedHeatmapBrowser({
) : null
}

function Warnings(): JSX.Element | null {
const { currentTeam } = useValues(teamLogic)
const heatmapsEnabled = currentTeam?.heatmaps_opt_in

const { openSettingsPanel } = useActions(sidePanelSettingsLogic)

return !heatmapsEnabled ? (
<LemonBanner
type="warning"
action={{
type: 'secondary',
icon: <IconGear />,
onClick: () => openSettingsPanel({ settingId: 'heatmaps' }),
children: 'Configure',
}}
dismissKey="heatmaps-might-be-disabled-warning"
>
You aren't collecting heatmaps data. Enable heatmaps in your project.
</LemonBanner>
) : null
}

export function HeatmapsBrowser(): JSX.Element {
const iframeRef = useRef<HTMLIFrameElement | null>(null)

Expand All @@ -271,7 +296,8 @@ export function HeatmapsBrowser(): JSX.Element {

return (
<BindLogic logic={heatmapsBrowserLogic} props={logicProps}>
<div className="flex flex-wrap gap-2">
<div className="flex flex-col gap-2">
<Warnings />
<div className="flex flex-col overflow-hidden w-full h-[90vh] rounded border">
<UrlSearchHeader />

Expand Down
1 change: 0 additions & 1 deletion frontend/src/scenes/scenes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -408,7 +408,6 @@ export const sceneConfigurations: Record<Scene, SceneConfig> = {
[Scene.Heatmaps]: {
projectBased: true,
name: 'Heatmaps',
hideProjectNotice: true,
},
}

Expand Down

0 comments on commit 2d34372

Please sign in to comment.