11'use client' ;
22
33import {
4- LineChart ,
5- Line ,
4+ BarChart ,
5+ Bar ,
66 XAxis ,
77 Tooltip ,
88 ResponsiveContainer ,
9- BarChart ,
10- Bar ,
119 RadialBarChart ,
1210 RadialBar ,
1311 PolarAngleAxis ,
@@ -16,7 +14,6 @@ import {
1614import { Card , CardContent , CardHeader , CardTitle } from '@/components/ui/card' ;
1715
1816interface SessionChartsProps {
19- loudnessTrend : { time : string ; value : number } [ ] ;
2017 tonalBalance : { band : string ; value : number } [ ] ;
2118 stereoWidth : number ;
2219}
@@ -31,104 +28,72 @@ const tooltipStyles = {
3128 labelStyle : { color : '#4b5563' , fontWeight : 600 } ,
3229} ;
3330
34- export function SessionCharts ( { loudnessTrend , tonalBalance, stereoWidth } : SessionChartsProps ) {
31+ export function SessionCharts ( { tonalBalance, stereoWidth } : SessionChartsProps ) {
3532 return (
36- < div className = "space-y-6 " >
37- < Card className = "border border-indigo-100 bg-white shadow-md " >
33+ < div className = "grid gap-6 md:grid-cols-2 " >
34+ < Card className = "border border-indigo-100 bg-white" >
3835 < CardHeader >
39- < CardTitle className = "text-lg font-bold text-gray-900" > Loudness over time </ CardTitle >
36+ < CardTitle className = "text-lg font-bold text-gray-900" > Tonal Balance </ CardTitle >
4037 </ CardHeader >
4138 < CardContent className = "h-64" >
4239 < ResponsiveContainer width = "100%" height = "100%" >
43- < LineChart data = { loudnessTrend } >
40+ < BarChart data = { tonalBalance } barSize = { 32 } >
4441 < XAxis
45- dataKey = "time "
42+ dataKey = "band "
4643 stroke = "#6b7280"
4744 tickLine = { false }
4845 axisLine = { false }
4946 style = { { fontSize : 12 } }
5047 />
51- < Tooltip
52- { ...tooltipStyles }
53- formatter = { ( value : number ) => `${ value . toFixed ( 1 ) } LUFS` }
54- />
55- < Line
56- type = "monotone"
57- dataKey = "value"
58- stroke = "#4f46e5"
59- strokeWidth = { 3 }
60- dot = { false }
61- activeDot = { { r : 6 , fill : '#6366f1' , strokeWidth : 0 } }
62- />
63- </ LineChart >
48+ < Tooltip { ...tooltipStyles } formatter = { ( value : number ) => `${ value } %` } />
49+ < Bar dataKey = "value" radius = { [ 8 , 8 , 0 , 0 ] } >
50+ { tonalBalance . map ( ( _ , index ) => (
51+ < Cell
52+ key = { `cell-${ index } ` }
53+ fill = { index === 0 ? '#4f46e5' : index === 1 ? '#6366f1' : '#8b5cf6' }
54+ />
55+ ) ) }
56+ </ Bar >
57+ </ BarChart >
6458 </ ResponsiveContainer >
6559 </ CardContent >
6660 </ Card >
67- < div className = "grid gap-6 md:grid-cols-2" >
68- < Card className = "border border-indigo-100 bg-white shadow-md" >
69- < CardHeader >
70- < CardTitle className = "text-lg font-bold text-gray-900" > Tonal Balance</ CardTitle >
71- </ CardHeader >
72- < CardContent className = "h-64" >
73- < ResponsiveContainer width = "100%" height = "100%" >
74- < BarChart data = { tonalBalance } barSize = { 32 } >
75- < XAxis
76- dataKey = "band"
77- stroke = "#6b7280"
78- tickLine = { false }
79- axisLine = { false }
80- style = { { fontSize : 12 } }
81- />
82- < Tooltip { ...tooltipStyles } formatter = { ( value : number ) => `${ value } %` } />
83- < Bar dataKey = "value" radius = { [ 8 , 8 , 0 , 0 ] } >
84- { tonalBalance . map ( ( _ , index ) => (
85- < Cell
86- key = { `cell-${ index } ` }
87- fill = { index === 0 ? '#4f46e5' : index === 1 ? '#6366f1' : '#8b5cf6' }
88- />
89- ) ) }
90- </ Bar >
91- </ BarChart >
92- </ ResponsiveContainer >
93- </ CardContent >
94- </ Card >
95- < Card className = "border border-indigo-100 bg-white shadow-md" >
96- < CardHeader >
97- < CardTitle className = "text-lg font-bold text-gray-900" > Stereo Image</ CardTitle >
98- </ CardHeader >
99- < CardContent className = "flex h-64 items-center justify-center" >
100- < ResponsiveContainer width = "100%" height = "100%" >
101- < RadialBarChart
102- data = { [ { name : 'Width' , value : stereoWidth * 100 } ] }
103- innerRadius = "75%"
104- outerRadius = "105%"
105- startAngle = { 90 }
106- endAngle = { - 270 }
61+ < Card className = "border border-indigo-100 bg-white" >
62+ < CardHeader >
63+ < CardTitle className = "text-lg font-bold text-gray-900" > Stereo Image</ CardTitle >
64+ </ CardHeader >
65+ < CardContent className = "flex h-64 items-center justify-center" >
66+ < ResponsiveContainer width = "100%" height = "100%" >
67+ < RadialBarChart
68+ data = { [ { name : 'Width' , value : stereoWidth * 100 } ] }
69+ innerRadius = "75%"
70+ outerRadius = "105%"
71+ startAngle = { 90 }
72+ endAngle = { - 270 }
73+ >
74+ < PolarAngleAxis type = "number" domain = { [ 0 , 100 ] } tick = { false } />
75+ < RadialBar cornerRadius = { 12 } dataKey = "value" fill = "url(#stereoGradient)" />
76+ < defs >
77+ < linearGradient id = "stereoGradient" x1 = "0%" y1 = "0%" x2 = "100%" y2 = "100%" >
78+ < stop offset = "0%" stopColor = "#4f46e5" />
79+ < stop offset = "100%" stopColor = "#8b5cf6" />
80+ </ linearGradient >
81+ </ defs >
82+ < text
83+ x = "50%"
84+ y = "50%"
85+ textAnchor = "middle"
86+ dominantBaseline = "middle"
87+ fill = "#1f2937"
88+ fontSize = { 24 }
89+ fontWeight = { 700 }
10790 >
108- < PolarAngleAxis type = "number" domain = { [ 0 , 100 ] } tick = { false } />
109- < RadialBar cornerRadius = { 12 } dataKey = "value" fill = "url(#stereoGradient)" />
110- < defs >
111- < linearGradient id = "stereoGradient" x1 = "0%" y1 = "0%" x2 = "100%" y2 = "100%" >
112- < stop offset = "0%" stopColor = "#4f46e5" />
113- < stop offset = "100%" stopColor = "#8b5cf6" />
114- </ linearGradient >
115- </ defs >
116- < text
117- x = "50%"
118- y = "50%"
119- textAnchor = "middle"
120- dominantBaseline = "middle"
121- fill = "#1f2937"
122- fontSize = { 24 }
123- fontWeight = { 700 }
124- >
125- { ( stereoWidth * 100 ) . toFixed ( 0 ) } %
126- </ text >
127- </ RadialBarChart >
128- </ ResponsiveContainer >
129- </ CardContent >
130- </ Card >
131- </ div >
91+ { ( stereoWidth * 100 ) . toFixed ( 0 ) } %
92+ </ text >
93+ </ RadialBarChart >
94+ </ ResponsiveContainer >
95+ </ CardContent >
96+ </ Card >
13297 </ div >
13398 ) ;
13499}
0 commit comments