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

import { ScopePanel } from '../components/ScopePanel'
import { DeliveryScope } from '../lib/deliveryScope'
import { DeliverySections } from './DeliverySections'
import { deliverySummaryLogic } from './deliverySummaryLogic'

/** The team page's window panel with the team's delivery figures on top, so a delivery reload spins the rim too. */
export function TeamDeliveryPanel({
    scope,
    sourceId,
    repo,
    busy,
    controls,
    children,
}: {
    scope: DeliveryScope
    sourceId: string | null
    repo: string | null
    busy: boolean
    controls: ReactNode
    children: ReactNode
}): JSX.Element {
    const { summary, summaryFailed, summaryLoading } = useValues(deliverySummaryLogic({ scope, sourceId, repo }))

    return (
        <ScopePanel busy={busy || summaryLoading} controls={controls}>
            {summary && !summaryFailed && !summary.has_membership_data ? (
                // Without the members table a team matches no author, so every figure would be a false zero.
                <div className="py-8 text-center text-sm text-secondary">
                    No team membership data. Sync the team members table on this GitHub source to see this team's
                    delivery figures.
                </div>
            ) : (
                <DeliverySections scope={scope} scopeLabel="This team" sourceId={sourceId} repo={repo} />
            )}
            {children}
        </ScopePanel>
    )
}