You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: src/app/components/Chart.jsx
+6-6Lines changed: 6 additions & 6 deletions
Original file line number
Diff line number
Diff line change
@@ -10,19 +10,21 @@ let root = {};
10
10
letduration=750;
11
11
12
12
classChartextendsComponent{
13
-
constructor(){
14
-
super();
13
+
constructor(props){
14
+
super(props);
15
15
this.chartRef=React.createRef();
16
16
this.maked3Tree=this.maked3Tree.bind(this);
17
17
}
18
18
componentDidMount(){
19
-
const{ snapshot }=this.props;
19
+
const{ snapshot, hierarchy }=this.props;
20
+
console.log('initial props',this.props)
20
21
root=JSON.parse(JSON.stringify(snapshot));
21
22
this.maked3Tree();
22
23
}
23
24
24
25
componentDidUpdate(){
25
-
const{ snapshot }=this.props;
26
+
const{ snapshot, hierarchy }=this.props;
27
+
console.log('updated props',this.props)
26
28
root=JSON.parse(JSON.stringify(snapshot));
27
29
this.maked3Tree();
28
30
}
@@ -140,8 +142,6 @@ class Chart extends Component {
140
142
141
143
letroot=tree(hierarchy);
142
144
143
-
console.log('children',root.descendants());
144
-
145
145
g.selectAll('.link')
146
146
// root.links() gets an array of all the links, where each element is an object containing a source property, which represents the link's source node, and a target property, which represents the link's target node.
Copy file name to clipboardExpand all lines: src/extension/background.js
+42-46Lines changed: 42 additions & 46 deletions
Original file line number
Diff line number
Diff line change
@@ -12,7 +12,7 @@ function createTabObj(title) {
12
12
// snapshots is an array of ALL state snapshots for the reactime tab working on a specific user application
13
13
snapshots: [],
14
14
//* this is our pointer so we know what the current state the user is checking (this accounts for time travel aka when user clicks jump on the UI)
15
-
currentStatePointer: null,
15
+
currLocation: null,
16
16
//* inserting a new property to build out our hierarchy dataset for d3
17
17
hierarchy: null,
18
18
mode: {
@@ -22,48 +22,46 @@ function createTabObj(title) {
22
22
},
23
23
};
24
24
}
25
-
// once state is modified (when user does something with app), a step appears in actionContainer.jsx column. That current state snapshot is added to our hierarchy object. That is what the buildHierarchy function is for. It takes in the entire tabObj, which has a hierarcy object as a property within it. Then we build this hierarchy object so that d3 can render graphs in our extension
26
-
functionbuildHierarchy(obj,newNode){
27
-
// whenever we receive a snapshot from contentScript.js via message, we execute this function
28
-
//* if empty on extension UI is clicked hierarchy needs to be reset to an object
29
-
letnum=1;
30
-
classd3Node{
31
-
constructor(num,obj){
32
-
this.name=num++;
25
+
26
+
constmakeNewNode=()=>{
27
+
letnum=0;
28
+
29
+
returnclassNode{
30
+
constructor(obj){
31
+
this.index=num+=1;
33
32
this.stateSnapshot=obj;
34
33
this.children=[];
35
34
}
36
-
}
37
-
38
-
obj.hierarchy
39
-
/* properties inside this object absolutely requires:
40
-
name: string (the first state snapshot has to be a root)
41
-
stateSnapshot: object
42
-
currentStateSnapshot: boolean
43
-
*/
44
-
45
-
// each time a statesnapshot is added, this gets incremented otherwise it will be decremented
46
-
// we need to find a way to traverse through the object to know which node the user is on so we can add a new state snapshot in the right location
47
-
// could we potentially have a variable in timejump function (timeJump.js in the package) that our function can work with --> contentScript.js has access to it --> we can access that variable message;
48
-
stateCount=1;
49
-
50
-
classstateNode{
51
-
52
-
constructor(){
53
-
this.name=`state${stateCount}`;
54
-
this.stateSnapshot={};
55
-
this.children=[];
56
-
}
57
-
}
35
+
};
36
+
};
58
37
38
+
constNode=makeNewNode();
59
39
60
-
// create a helper function that groups all the snapshots underneath each other
61
-
// current state snapshot
62
-
// needs to be supplied by the UI
63
-
// also need to figure out how we would traverse through the big ass object to find the current state
0 commit comments