Skip to content

:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.

980 B
Raw Blame
import { useActions } from 'kea'

import { IconBookmark } from '@posthog/icons'
import { LemonButton } from '@posthog/lemon-ui'

import { useFeatureFlag } from 'lib/hooks/useFeatureFlag'

import { SavedViewsModal } from './SavedViewsModal'
import { tracingViewsListLogic } from './tracingViewsListLogic'

function SavedViewsButtonInner(): JSX.Element {
    const { openModal } = useActions(tracingViewsListLogic)

    return (
        <>
            <LemonButton
                size="small"
                type="secondary"
                icon={<IconBookmark />}
                onClick={openModal}
                data-attr="tracing-saved-views-button"
            >
                Saved views
            </LemonButton>
            <SavedViewsModal />
        </>
    )
}

export function SavedViewsButton(): JSX.Element | null {
    const enabled = useFeatureFlag('TRACING_SAVED_VIEWS')

    if (!enabled) {
        return null
    }

    return <SavedViewsButtonInner />
}