import React, { useEffect } from 'react'
function AnalysisDisplay({ detection, loading, onReady }) {
useEffect(() => {
if (detection && onReady) {
console.log('=== AnalysisDisplay: detection ready, calling onReady ===')
console.log('Detection data:', detection)
onReady()
}
}, [detection, onReady])
if (loading) {
return (
)
}
if (!detection) {
return null
}
const getConfidenceColor = (confidence) => {
if (confidence >= 0.8) return 'bg-green-500'
if (confidence >= 0.6) return 'bg-yellow-500'
return 'bg-red-500'
}
const getConfidenceLabel = (confidence) => {
if (confidence >= 0.8) return 'High'
if (confidence >= 0.6) return 'Medium'
return 'Low'
}
return (
Analysis Results
{/* BPM Display */}
BPM
{detection.bpm.toFixed(1)}
{/* Key Display */}
Key
{detection.key}
{detection.mode}
)
}
export default AnalysisDisplay