import { Button } from '@wordpress/components'; import clsx from 'clsx'; import { useTranslate } from 'i18n-calypso'; import { Metrics } from 'calypso/data/site-profiler/types'; import { recordTracksEvent } from 'calypso/lib/analytics/tracks'; import { Valuation } from 'calypso/performance-profiler/types/performance-metrics'; import { profilerVersion } from 'calypso/performance-profiler/utils/profiler-version'; import './style.scss'; type StatusSectionProps = { value: Valuation; activeTab: Metrics | null; recommendationsQuantity?: number; recommendationsRef?: React.RefObject< HTMLDivElement > | null; onRecommendationsFilterChange?: ( filter: string ) => void; }; export const StatusSection = ( props: StatusSectionProps ) => { const translate = useTranslate(); const { value, recommendationsQuantity, recommendationsRef, activeTab, onRecommendationsFilterChange, } = props; const getStatus = ( value: Valuation ) => { if ( value === 'bad' ) { return 'poor'; } else if ( value === 'needsImprovement' ) { return 'neutral'; } return 'good'; }; const status = getStatus( value ); const statusText = { poor: translate( 'Poor' ), neutral: translate( 'Needs improvement' ), good: translate( 'Excellent' ), }[ status ]; const recordRecommendationsClickEvent = ( filter: string ) => recordTracksEvent( 'calypso_performance_profiler_recommendations_link_click', { filter, version: profilerVersion(), } ); return (