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

import { LemonBanner } from '@posthog/lemon-ui'

import { pluralize } from 'lib/utils/strings'
import { urls } from 'scenes/urls'

import { pendingApprovalsLogic } from './pendingApprovalsLogic'

export function PendingApprovalsBanner(): JSX.Element | null {
    const { actionableCount, unresolvedCount, unresolvedChangeRequestsLoading } = useValues(pendingApprovalsLogic)

    if (unresolvedChangeRequestsLoading || unresolvedCount === 0) {
        return null
    }

    const message =
        actionableCount > 0
            ? `${actionableCount} ${pluralize(actionableCount, 'change request', 'change requests', false)} ${actionableCount === 1 ? 'is' : 'are'} awaiting your decision`
            : `${unresolvedCount} ${pluralize(unresolvedCount, 'change request', 'change requests', false)} ${unresolvedCount === 1 ? 'is' : 'are'} awaiting action`

    return (
        <LemonBanner
            type="info"
            className="mb-4"
            action={{
                children: 'Go to change requests',
                to: urls.approvals(),
            }}
        >
            {message}
        </LemonBanner>
    )
}