Skip to content

Commit 940e950

Browse files
committed
save
2 parents e977e32 + 3a065ed commit 940e950

File tree

3 files changed

+41
-16
lines changed

3 files changed

+41
-16
lines changed

src/app/components/ComponentMap.tsx

Lines changed: 36 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -121,11 +121,21 @@ export default function ComponentMap({
121121
const tooltipStyles = {
122122
...defaultStyles,
123123
minWidth: 60,
124+
maxWidth: 300,
124125
backgroundColor: 'rgba(0,0,0,0.9)',
125126
color: 'white',
126127
fontSize: '14px',
127128
lineHeight: '18px',
128129
fontFamily: 'Roboto',
130+
zIndex: 100,
131+
};
132+
133+
const scrollStyle = {
134+
minWidth: '60',
135+
maxWidth: '300',
136+
maxHeight: '100px',
137+
overflowY: 'scroll',
138+
overflowWrap: 'break-word',
129139
};
130140

131141
const formatRenderTime = time => {
@@ -136,6 +146,21 @@ export default function ComponentMap({
136146
//places all nodes into a flat array
137147
const nodeList = [];
138148

149+
const makePropsPretty = data => {
150+
const propsFormat = [];
151+
for (const key in data) {
152+
console.log('this is the key', key);
153+
if (typeof data[key] === 'object') {
154+
const nestedObj = makePropsPretty(data[key]);
155+
}
156+
propsFormat.push(<p>
157+
{`${JSON.stringify(key)}: ${JSON.stringify(nestedObj || data[key])}`}
158+
</p>);
159+
}
160+
console.log('this is propsFormat', propsFormat);
161+
return propsFormat;
162+
};
163+
139164
const collectNodes = (node) => {
140165
nodeList.splice(0, nodeList.length);
141166
console.log("Root node:", node);
@@ -342,23 +367,26 @@ export default function ComponentMap({
342367
<strong>{tooltipData.name}</strong>
343368
{' '}
344369
</div>
345-
<div>
346-
State:
347-
{tooltipData.state}
348-
</div>
349-
<div>
350-
Props:
351-
{JSON.stringify(tooltipData.componentData.props)}
352-
</div>
353370
<div>
354371
{' '}
355372
Render time:
356373
{' '}
357374
{formatRenderTime(tooltipData.componentData.actualDuration)}
358375
{' '}
359376
</div>
377+
<div>
378+
State:
379+
{tooltipData.state}
380+
</div>
381+
<div style={scrollStyle}>
382+
Props:
383+
{makePropsPretty(tooltipData.componentData.props)}
384+
{/* {JSON.stringify(tooltipData.componentData.props)} */}
385+
</div>
360386
</div>
361387
</TooltipInPortal>
388+
389+
362390
)}
363391
</div>
364392
);

src/backend/linkFiber.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -471,8 +471,7 @@ function createTree(
471471
const lastClass = currentFiber.child.stateNode.classList[
472472
currentFiber.child.stateNode.classList.length - 1
473473
];
474-
// console.log('show me the last class', currentFiber.child.stateNode.classList);
475-
if (lastClass.includes('fromLinkFiber')) {
474+
if (typeof lastClass[lastClass.length - 1] === 'string') {
476475
currentFiber.child.stateNode.classList.remove(lastClass);
477476
}
478477
}

src/backend/tree.ts

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -103,9 +103,8 @@ class Tree {
103103

104104
addChild(state: string | {}, name: string, componentData: {}, rtid: any, recoilDomNode: any): Tree {
105105
const uniqueName = this.checkForDuplicates(name);
106-
// console.log('ChildName:', uniqueName);
107-
this.name = uniqueName;
108-
const newChild: Tree = new Tree(state, uniqueName, componentData, rtid, recoilDomNode, 'child');
106+
console.log('ChildName:', uniqueName);
107+
const newChild: Tree = new Tree(state, uniqueName, componentData, rtid, recoilDomNode);
109108
newChild.parent = this;
110109
this.children.push(newChild);
111110
// console.log('this is the name and rtid', uniqueName, rtid);
@@ -114,9 +113,8 @@ class Tree {
114113

115114
addSibling(state: string | {}, name: string, componentData: {}, rtid: any, recoilDomNode: any): Tree {
116115
const uniqueName = this.checkForDuplicates(name);
117-
// console.log('SiblingName:', uniqueName);
118-
this.name = uniqueName;
119-
const newSibling: Tree = new Tree(state, uniqueName, componentData, rtid, recoilDomNode, 'sibiling');
116+
console.log('SiblingName:', uniqueName);
117+
const newSibling: Tree = new Tree(state, uniqueName, componentData, rtid, recoilDomNode);
120118
newSibling.parent = this.parent;
121119
this.parent.children.push(newSibling);
122120
// console.log('this is the name and rtid', uniqueName, rtid);

0 commit comments

Comments
 (0)