: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.
Python ab-testingai-analyticsanalyticscdpdata-warehouseexperimentsfeature-flagsjavascriptproduct-analyticspythonreactsession-replaysurveystypescriptweb-analytics
import { useValues } from 'kea'
import * as drivingHogzillaPng from '@posthog/brand/hoggies/png/driving-hogzilla'
import * as errorPng from '@posthog/brand/hoggies/png/error'
import * as heartPng from '@posthog/brand/hoggies/png/heart'
import { LemonBanner } from '@posthog/lemon-ui'
import type { LemonBannerProps } from '@posthog/lemon-ui'
import { pngHoggie } from 'lib/brand/hoggies'
import { posthogStatusLogic } from 'lib/components/HelpMenu/posthogStatusLogic'
import type { PostHogStatusBadgeStatus, PostHogStatusType } from 'lib/components/HelpMenu/posthogStatusLogic'
const HedgehogDrivingHogzilla = pngHoggie(drivingHogzillaPng)
const HedgehogError = pngHoggie(errorPng)
const HedgehogHeart = pngHoggie(heartPng)
const STATUS_CONFIG: Record<
PostHogStatusBadgeStatus,
{
bannerType: LemonBannerProps['type']
Hog: React.ComponentType<{ className?: string }>
}
> = {
success: { bannerType: 'success', Hog: HedgehogHeart },
warning: { bannerType: 'warning', Hog: HedgehogError },
danger: { bannerType: 'error', Hog: HedgehogDrivingHogzilla },
}
const STATUS_LABELS: Record<PostHogStatusType, string> = {
operational: 'Operational',
degraded_performance: 'Degraded performance',
partial_outage: 'Partial outage',
major_outage: 'Major outage',
}
export const PlatformStatusBanner = (): JSX.Element => {
const { postHogStatusTooltip, postHogStatusBadgeStatus, postHogStatus, statusPageUrl } =
useValues(posthogStatusLogic)
const { bannerType, Hog } = STATUS_CONFIG[postHogStatusBadgeStatus]
const statusLabel = STATUS_LABELS[postHogStatus]
const statusMessage = postHogStatusTooltip ?? 'Checking for active incidents...'
return (
<LemonBanner
type={bannerType}
icon={<Hog className="size-10 shrink-0" />}
hideIcon={false}
action={{
children: 'View status page',
to: statusPageUrl,
targetBlank: true,
}}
>
<div>
<div className="font-semibold">Platform status: {statusLabel}</div>
<div className="text-sm mt-0.5">{statusMessage}</div>
</div>
</LemonBanner>
)
}