11import { useEffect , useState } from 'react' ;
22import { PieChart , Pie , Cell , Tooltip , Legend } from 'recharts' ;
33import axios from 'axios' ;
4- import './ExpenditureChart.css' ;
4+ import styles from './ExpenditureChart.module .css' ;
55
66const COLORS = [ '#6777EF' , '#A0CD61' , '#F5CD4B' ] ;
77const CATEGORIES = [ 'Labor' , 'Equipment' , 'Materials' ] ;
@@ -61,8 +61,8 @@ function ExpenditureChart({ projectId }) {
6161 } , [ projectId ] ) ;
6262
6363 const renderChart = ( data , title ) => (
64- < div className = " expenditure- chart- card" >
65- < h4 className = " expenditure- chart- title" > { title } </ h4 >
64+ < div className = { styles . expenditure - chart - card } >
65+ < h4 className = { styles . expenditure - chart - title } > { title } </ h4 >
6666 < PieChart width = { 280 } height = { 280 } >
6767 < Pie
6868 data = { data }
@@ -85,11 +85,12 @@ function ExpenditureChart({ projectId }) {
8585 </ div >
8686 ) ;
8787
88- if ( loading ) return < div className = "expenditure-chart-loading" > Loading expenditure data...</ div > ;
89- if ( error ) return < div className = "expenditure-chart-error" > { error } </ div > ;
88+ if ( loading )
89+ return < div className = { styles . expenditure - chart - loading } > Loading expenditure data...</ div > ;
90+ if ( error ) return < div className = { styles . expenditure - chart - error } > { error } </ div > ;
9091
9192 return (
92- < div className = " expenditure- chart- wrapper" >
93+ < div className = { styles . expenditure - chart - wrapper } >
9394 { renderChart ( normalizeData ( actual ) , 'Actual Expenditure' ) }
9495 { renderChart ( normalizeData ( planned ) , 'Planned Expenditure' ) }
9596 </ div >
0 commit comments