@@ -19,21 +19,17 @@ export const BORDER_RADIUS = {
1919} ;
2020
2121interface MetricToggleProps {
22- id : string ;
2322 label : string ;
2423 checked : boolean ;
2524 onChange : ( ) => void ;
2625 color : string ;
27- description ?: string ;
2826}
2927
3028export const MetricToggle : React . FC < MetricToggleProps > = ( {
31- id,
3229 label,
3330 checked,
3431 onChange,
3532 color,
36- description,
3733} ) => {
3834 // Get proper hex values for the colors
3935 const getColorMap = ( colorName : string ) => {
@@ -105,40 +101,22 @@ interface MetricTogglesProps {
105101 onToggle : ( metric : string ) => void ;
106102 colors : Record < string , string > ;
107103 labels ?: Record < string , string > ;
108- descriptions ?: Record < string , string > ;
109104}
110105
111106export const MetricToggles : React . FC < MetricTogglesProps > = ( {
112107 metrics,
113108 onToggle,
114109 colors,
115110 labels = { } ,
116- descriptions = { } ,
117111} ) => {
118- const metricDescriptions = {
119- pageviews : 'Total number of pages viewed by visitors' ,
120- visitors : 'Number of unique users visiting your website' ,
121- sessions : 'A group of interactions within a time frame' ,
122- bounce_rate : 'Percentage of single-page sessions' ,
123- avg_session_duration : 'Average time spent during a session' ,
124- ...descriptions ,
125- } ;
126-
127112 return (
128113 < div className = "flex flex-wrap items-center gap-2" >
129114 { Object . keys ( metrics ) . map ( ( metric ) => (
130115 < MetricToggle
131116 checked = { metrics [ metric ] }
132117 color = { colors [ metric ] || 'blue-500' }
133- description = {
134- metricDescriptions [ metric as keyof typeof metricDescriptions ]
135- }
136- id = { `metric-${ metric } ` }
137118 key = { metric }
138- label = {
139- labels [ metric ] ||
140- metric . charAt ( 0 ) . toUpperCase ( ) + metric . slice ( 1 ) . replace ( / _ / g, ' ' )
141- }
119+ label = { labels [ metric ] || metric }
142120 onChange = { ( ) => onToggle ( metric ) }
143121 />
144122 ) ) }
0 commit comments