@@ -9,45 +9,47 @@ const ordinalColorScale = scaleOrdinal<number, string>({
9
9
range : [ '#66d981' , '#71f5ef' , '#4899f1' , '#7d81f6' ] ,
10
10
} ) ;
11
11
12
- const displayArray = ( obj : {
13
- stateSnapshot : { children : any [ ] } ;
14
- name : number ;
15
- branch : number ;
16
- index : number ;
17
- children ?: [ ] ;
18
- } ) => {
19
- if (
20
- obj . stateSnapshot . children . length > 0 &&
21
- obj . stateSnapshot . children [ 0 ] &&
22
- obj . stateSnapshot . children [ 0 ] . state &&
23
- obj . stateSnapshot . children [ 0 ] . name
24
- ) {
25
- const newObj : Record < string , unknown > = {
26
- index : obj . index ,
27
- displayName : `${ obj . name } .${ obj . branch } ` ,
28
- state : obj . stateSnapshot . children [ 0 ] . state ,
29
- componentName : obj . stateSnapshot . children [ 0 ] . name ,
30
- componentData :
31
- JSON . stringify ( obj . stateSnapshot . children [ 0 ] . componentData ) === '{}'
32
- ? ''
33
- : obj . stateSnapshot . children [ 0 ] . componentData ,
34
- } ;
35
- hierarchyArr . push ( newObj ) ;
36
- }
37
- if ( obj . children ) {
38
- obj . children . forEach ( ( element ) => {
39
- displayArray ( element ) ;
40
- } ) ;
41
- }
42
- } ;
43
- // the hierarchy gets set on the first click in the page
44
- // when page in refreshed we may not have a hierarchy so we need to check if hierarchy was initialized
45
- // if true involk displayArray to display the hierarchy
46
- // if (hierarchy) displayArray(hierarchy);
47
-
48
12
const legendGlyphSize = 12 ;
49
13
50
- export default function Legendary ( { events = false } : { events ?: boolean } ) {
14
+ export default function Legendary ( props : any ) {
15
+ // { events = false }: { events?: boolean }) {
16
+ const displayArray = ( obj : {
17
+ stateSnapshot : { children : any [ ] } ;
18
+ name : number ;
19
+ branch : number ;
20
+ index : number ;
21
+ children ?: [ ] ;
22
+ } ) => {
23
+ if (
24
+ obj . stateSnapshot . children . length > 0 &&
25
+ obj . stateSnapshot . children [ 0 ] &&
26
+ obj . stateSnapshot . children [ 0 ] . state &&
27
+ obj . stateSnapshot . children [ 0 ] . name
28
+ ) {
29
+ const newObj : Record < string , unknown > = {
30
+ index : obj . index ,
31
+ displayName : `${ obj . name } .${ obj . branch } ` ,
32
+ state : obj . stateSnapshot . children [ 0 ] . state ,
33
+ componentName : obj . stateSnapshot . children [ 0 ] . name ,
34
+ componentData :
35
+ JSON . stringify ( obj . stateSnapshot . children [ 0 ] . componentData ) === '{}'
36
+ ? ''
37
+ : obj . stateSnapshot . children [ 0 ] . componentData ,
38
+ } ;
39
+ hierarchyArr . push ( newObj ) ;
40
+ }
41
+ if ( obj . children ) {
42
+ obj . children . forEach ( ( element ) => {
43
+ displayArray ( element ) ;
44
+ } ) ;
45
+ }
46
+ } ;
47
+ // the hierarchy gets set on the first click in the page
48
+ // when page in refreshed we may not have a hierarchy so we need to check if hierarchy was initialized
49
+ // if true involk displayArray to display the hierarchy
50
+ // if (hierarchy) displayArray(hierarchy);
51
+ console . log ( 'Inside Legendary, props is' , props ) ;
52
+
51
53
return (
52
54
< div className = "legends" >
53
55
< LegendVisual title = "State Snapshots" >
@@ -58,9 +60,9 @@ export default function Legendary({ events = false }: { events?: boolean }) {
58
60
< LegendItem
59
61
key = { `legend-quantile-${ i } ` }
60
62
margin = "0 5px"
61
- onClick = { ( ) => {
62
- if ( events ) alert ( `clicked: ${ JSON . stringify ( label ) } ` ) ;
63
- } }
63
+ // onClick={() => {
64
+ // if (events) alert(`clicked: ${JSON.stringify(label)}`);
65
+ // }}
64
66
>
65
67
< svg width = { 10 } height = { 10 } >
66
68
< rect
0 commit comments