Skip to content

Commit 0fcdfb6

Browse files
committed
finished styling provider consumer panel and added hover tool tip display for root node
1 parent 0019d3f commit 0fcdfb6

File tree

8 files changed

+246
-186
lines changed

8 files changed

+246
-186
lines changed

demo-app-next/next-env.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@
22
/// <reference types="next/image-types/global" />
33

44
// NOTE: This file should not be edited
5-
// see https://nextjs.org/docs/basic-features/typescript for more information.
5+
// see https://nextjs.org/docs/pages/building-your-application/configuring/typescript for more information.

demo-app-next/tsconfig.json

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
{
22
"compilerOptions": {
3-
"lib": ["dom", "dom.iterable", "esnext"],
3+
"lib": [
4+
"dom",
5+
"dom.iterable",
6+
"esnext"
7+
],
48
"allowJs": true,
59
"skipLibCheck": true,
610
"strict": false,
@@ -12,8 +16,15 @@
1216
"moduleResolution": "node",
1317
"resolveJsonModule": true,
1418
"isolatedModules": true,
15-
"jsx": "preserve"
19+
"jsx": "preserve",
20+
"target": "ES2017"
1621
},
17-
"include": ["next-env.d.ts", "**/*.ts", "**/*.tsx"],
18-
"exclude": ["node_modules"]
22+
"include": [
23+
"next-env.d.ts",
24+
"**/*.ts",
25+
"**/*.tsx"
26+
],
27+
"exclude": [
28+
"node_modules"
29+
]
1930
}

src/app/FrontendTypes.ts

Lines changed: 22 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -108,12 +108,12 @@ export interface ActionContainerProps {
108108
actionView: boolean;
109109
setActionView: React.Dispatch<React.SetStateAction<boolean>>;
110110
toggleActionContainer: () => void;
111-
snapshots: any
112-
currLocation: any
111+
snapshots: any;
112+
currLocation: any;
113113
}
114114

115115
export interface ProvConContainerProps {
116-
currentSnapshot: any;
116+
currentSnapshot: any;
117117
}
118118

119119
export interface StateContainerProps {
@@ -399,4 +399,22 @@ export interface AxContainer {
399399
};
400400
snapshots: [];
401401
currLocation: object;
402-
}
402+
}
403+
404+
export interface FilteredNode {
405+
name?: string;
406+
state?: any;
407+
hooksState?: any;
408+
props?: any;
409+
componentData?: {
410+
context?: any;
411+
hooksState?: any;
412+
props?: any;
413+
};
414+
children?: FilteredNode[];
415+
context?: any;
416+
}
417+
418+
export interface FilteredNodeChildren {
419+
[key: string]: FilteredNode;
420+
}

src/app/components/Actions/DropDown.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@ const DropDown = ({
1313
};
1414

1515
const options = [
16-
{ value: 'TimeJump', label: 'TimeJump' },
17-
{ value: 'Provider/Consumer', label: 'Provider/Consumer' },
16+
{ value: 'Time Jump', label: 'Time Jump' },
17+
{ value: 'Providers / Consumers', label: 'Providers / Consumers' },
1818
];
1919

2020
return (

src/app/components/StateRoute/ComponentMap/ComponentMap.tsx

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -477,6 +477,7 @@ export default function ComponentMap({
477477

478478
return (
479479
<Group top={top} left={left} key={key} className='rect'>
480+
// Replace the root node rect rendering block with this:
480481
{node.depth === 0 && (
481482
<rect
482483
className='compMapRoot'
@@ -489,9 +490,26 @@ export default function ComponentMap({
489490
dispatch(toggleExpanded(node.data));
490491
hideTooltip();
491492
}}
493+
onMouseEnter={(event) => {
494+
if (hasDisplayableData(node.data)) {
495+
if (toolTipTimeoutID.current !== null) {
496+
clearTimeout(toolTipTimeoutID.current);
497+
hideTooltip();
498+
}
499+
toolTipTimeoutID.current = null;
500+
handleMouseAndClickOver(event, node.data);
501+
}
502+
}}
503+
onMouseLeave={() => {
504+
if (hasDisplayableData(node.data)) {
505+
toolTipTimeoutID.current = setTimeout(() => {
506+
hideTooltip();
507+
toolTipTimeoutID.current = null;
508+
}, 300);
509+
}
510+
}}
492511
/>
493512
)}
494-
495513
{/* This creates the rectangle boxes for each component
496514
and sets it relative position to other parent nodes of the same level. */}
497515
{node.depth !== 0 && (
@@ -526,7 +544,6 @@ export default function ComponentMap({
526544
}}
527545
/>
528546
)}
529-
530547
{/* Display text inside of each component node */}
531548
<text
532549
className={

src/app/components/StateRoute/ComponentMap/ToolTipDataDisplay.tsx

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,11 +70,9 @@ const ToolTipDataDisplay = ({ data }) => {
7070
if (isReducer && parsedContent) {
7171
// Only try to format if we have valid content
7272
const formattedData = formatReducerData(parsedContent);
73-
console.log('formatted data', formattedData);
7473

7574
// Check if we have any formatted data to display
7675
if (Object.keys(formattedData).length === 0) {
77-
console.log('formatted data length', Object.keys(formattedData).length);
7876
return null;
7977
}
8078

src/app/containers/ActionContainer.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ import RecordButton from '../components/Actions/RecordButton';
1717
// resetSlider locates the rc-slider elements on the document and resets it's style attributes
1818

1919
function ActionContainer(props: ActionContainerProps): JSX.Element {
20-
const [dropdownSelection, setDropdownSelection] = useState('TimeJump');
20+
const [dropdownSelection, setDropdownSelection] = useState('Time Jump');
2121
const actionsEndRef = useRef(null as unknown as HTMLDivElement);
2222

2323
const dispatch = useDispatch();
@@ -210,10 +210,10 @@ function ActionContainer(props: ActionContainerProps): JSX.Element {
210210
</Button>
211211
</div>
212212
<div className='snapshots'>
213-
{dropdownSelection === 'Provider/Consumer' && (
213+
{dropdownSelection === 'Providers / Consumers' && (
214214
<ProvConContainer currentSnapshot={currLocation.stateSnapshot} />
215215
)}
216-
{dropdownSelection === 'TimeJump' &&
216+
{dropdownSelection === 'Time Jump' &&
217217
Object.keys(routes).map((route, i) => (
218218
<RouteDescription key={`route${i}`} actions={routes[route]} />
219219
))}

0 commit comments

Comments
 (0)