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.

1.3 KB
Raw Blame
import { useActions } from 'kea'

import { IconPlusSmall } from '@posthog/icons'

import { LemonButton } from 'lib/lemon-ui/LemonButton'
import { LemonMenu } from 'lib/lemon-ui/LemonMenu'
import { dashboardLogic } from 'scenes/dashboard/dashboardLogic'

import { getAddTileMenuItems } from './DashboardHeaderActions'

export function DashboardEmptyGroupAddButton({ groupKey }: { groupKey: string }): JSX.Element {
    const {
        setAddWidgetModalOpen,
        openAddInsightModal,
        openTextTileModal,
        openImageTileModal,
        openButtonTileModal,
        setAddTargetTileGroupKey,
    } = useActions(dashboardLogic)

    return (
        <LemonMenu
            items={getAddTileMenuItems({
                onBeforeSelect: () => setAddTargetTileGroupKey(groupKey),
                onAddInsight: openAddInsightModal,
                onAddText: openTextTileModal,
                onAddImage: openImageTileModal,
                onAddButton: openButtonTileModal,
                setAddWidgetModalOpen,
            })}
        >
            <LemonButton
                type="primary"
                size="small"
                icon={<IconPlusSmall />}
                data-attr="dashboard-tile-group-empty-tab-add"
            >
                Add
            </LemonButton>
        </LemonMenu>
    )
}