import React from "react"; import "../../../css/globalstats.css"; function WatchTimeStats(props) { function formatTime(totalSeconds, numberClassName, labelClassName) { const units = [ { label: 'Day', seconds: 86400 }, { label: 'Hour', seconds: 3600 }, { label: 'Minute', seconds: 60 }, ]; const parts = units.reduce((result, { label, seconds }) => { const value = Math.floor(totalSeconds / seconds); if (value) { const formattedValue =
{value}
; const formattedLabel = ( {label} {value === 1 ? '' : 's'} ); result.push( {formattedValue} {formattedLabel} ); totalSeconds -= value * seconds; } return result; }, []); if (parts.length === 0) { return ( <>0
{' '}Minutes
> ); } return parts; } return ({props.data.Plays || 0}
Plays /
<>{formatTime(props.data.total_playback_duration || 0,'stat-value','stat-unit')}>