Skip to content

Commit 61e6783

Browse files
committed
Implemented tooltip render times and statefulness and component name;
> > Co-authored-by: kev-ngo <[email protected]> Co-authored-by: CourageWolf <[email protected]> Co-authored-by: DennisLpz <[email protected]> Co-authored-by: demircaner <[email protected]>
1 parent 9b40265 commit 61e6783

File tree

1 file changed

+18
-3
lines changed

1 file changed

+18
-3
lines changed

src/app/components/ComponentMap.tsx

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,11 @@ export default function ComponentMap({
119119
fontFamily: 'Roboto',
120120
};
121121

122+
const formatRenderTime = (time) => {
123+
time = time.toFixed(3);
124+
return `${time} ms `;
125+
}
126+
122127

123128
// controls for the map
124129
const LinkComponent = getLinkComponent({ layout, linkType, orientation });
@@ -167,6 +172,8 @@ export default function ComponentMap({
167172
const width = widthFunc(node.data.name);
168173
const height = 25;
169174

175+
176+
170177
let top: number;
171178
let left: number;
172179
if (layout === 'polar') {
@@ -185,11 +192,13 @@ export default function ComponentMap({
185192
const handleMouseOver = (event) => {
186193
() => dispatch(onHover(node.data.rtid));
187194
const coords = localPoint(event.target.ownerSVGElement, event);
188-
console.log("I'm node.data.rtid", node.data.rtid);
195+
const tooltipObj = Object.assign({}, node.data);
196+
if (typeof tooltipObj.state === 'object') tooltipObj.state = 'stateful';
197+
console.log("tooltipObj", tooltipObj)
189198
showTooltip({
190199
tooltipLeft: coords.x,
191200
tooltipTop: coords.y,
192-
tooltipData: "test"
201+
tooltipData: tooltipObj
193202
});
194203
}
195204

@@ -263,7 +272,13 @@ export default function ComponentMap({
263272
left={tooltipLeft}
264273
style={tooltipStyles}
265274
>
266-
Tooltip Data: <strong>{tooltipData}</strong>
275+
<div style={{ }}>
276+
{' '}
277+
<strong>{tooltipData.name}</strong>{' '}
278+
</div>
279+
<div>State: {tooltipData.state}</div>
280+
<div> Render time: {formatRenderTime(tooltipData.componentData.actualDuration)} </div>
281+
267282
</TooltipInPortal>
268283
)}
269284
</div>

0 commit comments

Comments
 (0)