Something went wrong. Try again.
Bluesky app fork with some witchin' additions 💫
Something went wrong. Try again.
1.0 kB · 41 lines
TSX
at main
123456789101112131415161718192021222324252627282930313233343536373839404142import {type ReactNode} from 'react'
import { type CountsMetricsDisplay, shouldShowCountsMetricLabelOnly, shouldShowCountsMetricNumber, shouldShowCountsMetricRow,} from '#/lib/metrics-display'import {PostControlButtonText} from '#/components/PostControls/PostControlButton'import {useFormatPostStatCount} from '#/components/PostControls/util'
export function MetricCountLabel({ display, count, testID, labelOnly,}: { display: CountsMetricsDisplay count: number testID?: string labelOnly: ReactNode}) { const formatPostStatCount = useFormatPostStatCount(display)
if (!shouldShowCountsMetricRow(display)) { return null } if (shouldShowCountsMetricLabelOnly(display, count)) { return ( <PostControlButtonText testID={testID}>{labelOnly}</PostControlButtonText> ) } if (shouldShowCountsMetricNumber(display, count) && count > 0) { return ( <PostControlButtonText testID={testID}> {formatPostStatCount(count)} </PostControlButtonText> ) } return null}