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 { useValues } from 'kea'

import { LemonButton, LemonTag } from '@posthog/lemon-ui'

import { productSetupStatusLogic } from 'lib/components/ProductEmptyState/productSetupStatusLogic'

import { ProductKey } from '~/queries/schema/schema-general'
import type { OnboardingProduct } from '~/types'

import { getProductIcon, toSentenceCase } from '../shared/utils'

export function WelcomeProductNavItem({
    productKey,
    product,
    active,
    onSelect,
}: {
    productKey: ProductKey
    product: OnboardingProduct
    active: boolean
    onSelect: () => void
}): JSX.Element {
    const { status } = useValues(productSetupStatusLogic({ productKey }))

    return (
        <LemonButton
            className="@min-[56rem]/main-content:w-full"
            active={active}
            icon={getProductIcon(product.icon, { iconColor: product.iconColor })}
            sideIcon={
                status === 'has-data' ? (
                    <LemonTag type="success" size="small">
                        Installed
                    </LemonTag>
                ) : undefined
            }
            tooltip={product.description}
            tooltipPlacement="right"
            onClick={onSelect}
            data-attr={`onboarding-welcome-product-${productKey}`}
        >
            {toSentenceCase(product.name)}
        </LemonButton>
    )
}