@@ -7,6 +7,8 @@ import { Line, Bar } from "react-chartjs-2";
7
7
import dayjs from "dayjs" ;
8
8
import "./styles.scss" ;
9
9
10
+ const ucFirst = ( str : string ) => str . charAt ( 0 ) . toUpperCase ( ) + str . slice ( 1 ) ;
11
+
10
12
const subDirectories = [ "rescuetime-time-tracking" , "oura-activity" , "oura-sleep" ] ;
11
13
12
14
const categoryColors : { [ index : string ] : string } = {
@@ -21,6 +23,10 @@ const categoryColors: { [index: string]: string } = {
21
23
"Social Networking" : "#cc423a" ,
22
24
Entertainment : "#da422b" ,
23
25
Shopping : "#e84118" ,
26
+ rem : "#272740" ,
27
+ deep : "#514b83" ,
28
+ light : "#8d569f" ,
29
+ awake : "#f7e1ef" ,
24
30
} ;
25
31
26
32
const itemNames : { [ index : string ] : string } = {
@@ -83,7 +89,7 @@ const getDatasets = (
83
89
return Object . keys ( total )
84
90
. sort ( ( a , b ) => Object . keys ( categoryColors ) . indexOf ( a ) - Object . keys ( categoryColors ) . indexOf ( b ) )
85
91
. map ( ( key ) => ( {
86
- label : key ,
92
+ label : ucFirst ( key || "" ) ,
87
93
data : total [ key ] ,
88
94
borderWidth : 1 ,
89
95
borderColor : "#fff" ,
@@ -172,7 +178,15 @@ const App: FunctionComponent<{}> = () => {
172
178
} )
173
179
. catch ( ( ) => setError ( true ) ) ;
174
180
useMemoApiData ( repo , api , path )
175
- . then ( setGraphData )
181
+ . then ( ( data ) => {
182
+ Object . keys ( data ) . forEach ( ( key ) => {
183
+ if ( data [ key ] . rem ) {
184
+ delete data [ key ] . total ;
185
+ delete data [ key ] . duration ;
186
+ }
187
+ } ) ;
188
+ setGraphData ( data ) ;
189
+ } )
176
190
. catch ( ( ) => setError ( true ) ) ;
177
191
}
178
192
0 commit comments