import { CommunicationStats } from './types'
import {
calculateEstimatedTraffic,
calculateHourlyEstimate,
calculateMonthlyEstimate,
getResourceRecommendation,
} from './helpers'
export function TrafficSection({ stats }: { stats: CommunicationStats | null }) {
return (
Traffic & Bandbreite
SysEleven Ressourcenplanung
Live
Eingehend (heute)
{stats?.traffic?.total?.bandwidth_in_mb?.toFixed(1) || calculateEstimatedTraffic(stats, 'in').toFixed(1)} MB
Ausgehend (heute)
{stats?.traffic?.total?.bandwidth_out_mb?.toFixed(1) || calculateEstimatedTraffic(stats, 'out').toFixed(1)} MB
Geschätzt/Stunde
{stats?.traffic?.jitsi?.estimated_hourly_gb?.toFixed(2) || calculateHourlyEstimate(stats).toFixed(2)} GB
Geschätzt/Monat
{stats?.traffic?.total?.estimated_monthly_gb?.toFixed(1) || calculateMonthlyEstimate(stats).toFixed(1)} GB
{/* Matrix Traffic */}
Nachrichten/Min
{stats?.traffic?.matrix?.messages_per_minute || Math.round((stats?.matrix?.messages_today || 0) / (new Date().getHours() || 1) / 60)}
Media Uploads heute
{stats?.traffic?.matrix?.media_uploads_today || 0}
Media Größe
{stats?.traffic?.matrix?.media_size_mb?.toFixed(1) || '0.0'} MB
{/* Jitsi Traffic */}
Video Streams aktiv
{stats?.traffic?.jitsi?.video_streams_active || (stats?.jitsi?.total_participants || 0)}
Audio Streams aktiv
{stats?.traffic?.jitsi?.audio_streams_active || (stats?.jitsi?.total_participants || 0)}
Bitrate geschätzt
{((stats?.jitsi?.total_participants || 0) * 1.5).toFixed(1)} Mbps
{/* SysEleven Resource Recommendations */}
SysEleven Empfehlung
Basierend auf aktuellem Traffic: {getResourceRecommendation(stats)}
Peak Teilnehmer: {stats?.jitsi?.peak_concurrent_users || 0} |
Ø Call-Dauer: {stats?.jitsi?.average_duration_minutes?.toFixed(0) || 0} Min. |
Calls heute: {stats?.jitsi?.meetings_today || 0}
)
}