@@ -45,10 +45,18 @@ interface HistoryData {
4545 generated_at : string ;
4646}
4747
48+ interface GroqData {
49+ todayTotal : number ;
50+ thisMonthTotal : number ;
51+ lastMonthTotal : number ;
52+ generated_at ?: string ;
53+ }
54+
4855function App ( ) {
4956 const [ currentData , setCurrentData ] = useState < TrackerData | null > ( null ) ;
5057 const [ sixData , setSixData ] = useState < TrackerData | null > ( null ) ;
5158 const [ historyData , setHistoryData ] = useState < HistoryData | null > ( null ) ;
59+ const [ groqData , setGroqData ] = useState < GroqData | null > ( null ) ;
5260 const [ loading , setLoading ] = useState ( true ) ;
5361 const [ error , setError ] = useState < string | null > ( null ) ;
5462 const [ activeModal , setActiveModal ] = useState < { type : 'pacing' | 'bank' | 'energy' | 'history' , data ?: any } | null > ( null ) ;
@@ -86,12 +94,14 @@ function App() {
8694 Promise . all ( [
8795 fetchData ( '/api/data' , '/data.json' ) ,
8896 fetchData ( '/api/six' , '/six.json' ) ,
89- fetchData ( '/api/history' , '/history_summary.json' )
97+ fetchData ( '/api/history' , '/history_summary.json' ) ,
98+ fetchData ( '/api/groq' , '/groq_summary.json' )
9099 ] )
91- . then ( ( [ current , six , history ] ) => {
100+ . then ( ( [ current , six , history , groq ] ) => {
92101 setCurrentData ( current ) ;
93102 setSixData ( six ) ;
94103 setHistoryData ( history ) ;
104+ setGroqData ( groq ) ;
95105 } )
96106 . catch ( err => setError ( err . message ) )
97107 . finally ( ( ) => setLoading ( false ) ) ;
@@ -136,6 +146,14 @@ function App() {
136146 < div className = "header-main" >
137147 < h1 > Time Carburetor</ h1 >
138148 < div className = "header-stats" >
149+ { groqData && (
150+ < span
151+ className = { `balance-badge groq-badge ${ groqData . todayTotal >= 0.03 ? 'pos' : 'neg' } ` }
152+ title = { `Groq Spend:\nToday: $${ groqData . todayTotal . toFixed ( 2 ) } \nThis Month: $${ groqData . thisMonthTotal . toFixed ( 2 ) } \nLast Month: $${ groqData . lastMonthTotal . toFixed ( 2 ) } ` }
153+ >
154+ Groq: < strong > ${ groqData . todayTotal . toFixed ( 2 ) } </ strong >
155+ </ span >
156+ ) }
139157 < span className = "balance-badge" >
140158 Monthly: < strong > { currentBillableDiff >= 0 ? '+' : '' } { currentBillableDiff . toFixed ( 1 ) } h</ strong >
141159 </ span >
0 commit comments