Skip to content

Commit 52902e6

Browse files
committed
added the expand color change
1 parent 2280efa commit 52902e6

File tree

1 file changed

+28
-24
lines changed

1 file changed

+28
-24
lines changed

src/app/components/ComponentMap.tsx

Lines changed: 28 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@ export default function ComponentMap({
6868
const [linkType, setLinkType] = useState('diagonal');
6969
const [stepPercent, setStepPercent] = useState(10);
7070
const [tooltip, setTooltip] = useState(false);
71+
const [expanded, setExpanded] = useState();
7172

7273
// Declared this variable and assigned it to the useForceUpdate function that forces a state to change causing that component to re-render and display on the map
7374
const forceUpdate = useForceUpdate();
@@ -194,16 +195,18 @@ export default function ComponentMap({
194195
// mousing controls & Tooltip display logic
195196
const handleMouseOver = event => {
196197
() => dispatch(onHover(node.data.rtid));
198+
console.log('line 197', event.target.ownerSVGElement);
197199
const coords = localPoint(
198200
event.target.ownerSVGElement,
199201
event,
200202
);
201203
const tooltipObj = { ...node.data };
204+
console.log('NODE DATAAAAAAAAAAAAA', node);
202205
if (typeof tooltipObj.state === 'object') tooltipObj.state = 'stateful';
203206
showTooltip({
204207
tooltipLeft: coords.x,
205208
tooltipTop: coords.y,
206-
tooltipData: tooltipObj,
209+
tooltipData: tooltipObj, // this is where the data for state and render time is displayed but does not show props functions and etc
207210
});
208211
};
209212

@@ -228,9 +231,9 @@ export default function ComponentMap({
228231
y={-height / 2}
229232
x={-width / 2}
230233
fill={node.children ? '#161521' : '#62d6fb'}
231-
stroke={node.children ? '#62d6fb' : '#161521'}
232-
strokeWidth={1}
233-
strokeDasharray={node.children ? '0' : '2,2'}
234+
stroke={node.data.isExpanded ? '#95fb62' : '#a69ff5'} // if already child in fill do not all stroke to change change color later but it works!!!!!!!!
235+
strokeWidth={3}
236+
strokeDasharray={node.children ? '0' : '1,2'}
234237
strokeOpacity="1"
235238
rx={node.children ? 4 : 10}
236239
onDoubleClick={() => {
@@ -239,19 +242,17 @@ export default function ComponentMap({
239242
}}
240243
// Tooltip event handlers
241244
// test feature
242-
//onClick = {handleMouseOver}
243-
onClick={ event => {
244-
if (tooltip) {
245-
console.log('hide hide hide');
245+
// onClick = {handleMouseOver}
246+
onClick={event => {
247+
if (tooltip) { // cohort 45
246248
hideTooltip();
247249
setTooltip(false);
248250
} else {
249-
console.log('show show show');
250251
handleMouseOver(event);
251252
setTooltip(true);
252253
}
253254
}}
254-
onMouseEnter={() => dispatch(onHover(node.data.rtid))}
255+
onMouseEnter={() => dispatch(onHover(node.data.rtid))} // fix this not working
255256
onMouseLeave={() => dispatch(onHoverExit(node.data.rtid))}
256257
/>
257258
)}
@@ -288,22 +289,25 @@ export default function ComponentMap({
288289
top={tooltipTop}
289290
left={tooltipLeft}
290291
style={tooltipStyles}
292+
onClick={hideTooltip}
291293
>
292-
<div style={{}}>
293-
{' '}
294-
<strong>{tooltipData.name}</strong>
295-
{' '}
296-
</div>
297-
<div>
298-
State:
299-
{tooltipData.state}
300-
</div>
301294
<div>
302-
{' '}
303-
Render time:
304-
{' '}
305-
{formatRenderTime(tooltipData.componentData.actualDuration)}
306-
{' '}
295+
<div style={{}}>
296+
{' '}
297+
<strong>{tooltipData.name}</strong>
298+
{' '}
299+
</div>
300+
<div>
301+
State:
302+
{tooltipData.state}
303+
</div>
304+
<div>
305+
{' '}
306+
Render time:
307+
{' '}
308+
{formatRenderTime(tooltipData.componentData.actualDuration)}
309+
{' '}
310+
</div>
307311
</div>
308312
</TooltipInPortal>
309313
)}

0 commit comments

Comments
 (0)