import { __, sprintf } from '@wordpress/i18n'; import { formatPercentage } from '@/utils/formatting'; import type { ForecastMetadata, ForecastMode, ForecastSource } from '@/types/api-endpoints'; interface ForecastAnnotationProps { source: ForecastSource; mode: ForecastMode; metadata: ForecastMetadata; } /** * Shared forecast growth, churn and limited-history context. */ // fallow-ignore-next-line complexity export function ForecastAnnotation({ source, mode, metadata }: ForecastAnnotationProps ): JSX.Element { const growthRate = metadata.growth_rate; const growthLabel = `${ 0 <= growthRate ? '+' : '' }${ formatPercentage( growthRate ) }`; const churnRate = metadata.churn_rate ?? 0; return (