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.9 KB
Raw Blame
import { useValues } from 'kea'

import { IconLogomark } from '@posthog/icons'
import { LemonButton, ProfilePicture } from '@posthog/lemon-ui'

import { AccountMenu } from 'lib/components/Account/AccountMenu'
import { ProjectMenu } from 'lib/components/Account/ProjectMenu'
import { organizationLogic } from 'scenes/organizationLogic'
import { teamLogic } from 'scenes/teamLogic'
import { urls } from 'scenes/urls'
import { userLogic } from 'scenes/userLogic'

export function MinimalNavigation(): JSX.Element {
    const { user } = useValues(userLogic)
    const { currentOrganization } = useValues(organizationLogic)
    const { hasOnboardedAnyProduct, currentTeam } = useValues(teamLogic)

    const shouldShowOnboarding = !hasOnboardedAnyProduct && !currentTeam?.ingested_event
    const logoUrl = shouldShowOnboarding ? urls.onboarding() : urls.projectRoot()

    return (
        <nav className="flex items-center gap-2 p-2 border-b min-h-[var(--minimal-navigation-height)]">
            <LemonButton noPadding icon={<IconLogomark className="text-3xl mx-2" />} to={logoUrl} />
            <div className="flex items-center justify-end gap-2 flex-1">
                {(currentOrganization?.teams?.length ?? 0) > 1 ? (
                    <ProjectMenu
                        buttonProps={{
                            size: 'lg',
                            className: 'h-[37px]', // Match the height of the `AccountPopoverOverlay`, remove when we redo the account
                        }}
                    />
                ) : null}
                <AccountMenu
                    align="end"
                    side="bottom"
                    alignOffset={10}
                    trigger={
                        <LemonButton type="tertiary" icon={<ProfilePicture user={user} size="md" />}>
                            {user?.first_name || user?.email}
                        </LemonButton>
                    }
                />
            </div>
        </nav>
    )
}