Skip to content

Commit f60da99

Browse files
Merge branch 'master' of https://github.com/guizzettic/reactime into newComponentMap
2 parents 2513f5d + 59c5b23 commit f60da99

File tree

10 files changed

+15514
-63
lines changed

10 files changed

+15514
-63
lines changed

package-lock.json

Lines changed: 14852 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,10 +106,16 @@
106106
"webpack-cli": "^3.3.12"
107107
},
108108
"dependencies": {
109+
"@visx/axis": "^1.0.0",
110+
"@visx/grid": "^1.0.0",
111+
"@visx/legend": "^1.0.0",
112+
"@visx/responsive": "^1.0.0",
113+
"@visx/scale": "^1.0.0",
114+
"@visx/tooltip": "^1.0.0",
109115
"@visx/gradient": "^1.0.0",
110116
"@visx/group": "^1.0.0",
111117
"@visx/hierarchy": "^1.0.0",
112-
"@visx/responsive": "^1.0.0",
118+
"@visx/glyph": "^1.0.0",
113119
"@visx/shape": "^1.0.0",
114120
"acorn": "^7.3.1",
115121
"acorn-jsx": "^5.2.0",

src/app/components/AtomsRelationship.jsx

Lines changed: 21 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,15 @@ import { Cluster, hierarchy } from '@visx/hierarchy';
55
import { LinkVertical } from '@visx/shape';
66
import { LinearGradient } from '@visx/gradient';
77

8-
const citrus = '#ddf163';
9-
const white = '#ffffff';
10-
export const green = '#79d259';
11-
const aqua = '#37ac8c';
8+
const blue = '#acdbdf';
9+
const white = '#f0ece2';
10+
11+
export const lightorange = '#F9D976';
12+
const orange = '#F39F86';
13+
1214
const merlinsbeard = '#f7f7f3';
1315
export const background = '#242529';
16+
const root = '#d2f5e3';
1417

1518
// interface NodeShape {
1619
// name: string;
@@ -39,7 +42,7 @@ function clusterDataPopulate(props) {
3942
if (!memoizeObj[key].includes(atomCompObj[key][i])) {
4043
if (!clusterData.children[counter].children)
4144
clusterData.children[counter].children = [];
42-
clusterData.children[counter].children.push({
45+
clusterData.children[counter].children.push({
4346
name: atomCompObj[key][i],
4447
});
4548
}
@@ -77,8 +80,8 @@ function Node({ node }) {
7780
{node.depth !== 0 && (
7881
<circle
7982
r={12}
80-
fill={background}
81-
stroke={isParent ? white : citrus}
83+
fill={isParent ? white : blue}
84+
stroke={isParent ? white : blue}
8285
// onClick={() => {
8386
// alert(`clicked: ${JSON.stringify(node.data.name)}`);
8487
// }}
@@ -89,8 +92,9 @@ function Node({ node }) {
8992
fontSize={9}
9093
fontFamily="Arial"
9194
textAnchor="middle"
95+
y = "-20"
9296
style={{ pointerEvents: 'none' }}
93-
fill={isParent ? white : citrus}
97+
fill={isParent ? white : blue}
9498
>
9599
{node.data.name}
96100
</text>
@@ -105,18 +109,21 @@ function RootNode({ node }) {
105109
const centerY = -height / 2;
106110

107111
return (
108-
<Group top = {node.y} left = {node.x}>
112+
<Group top={node.y} left={node.x}>
109113
<rect
110114
width={width}
111115
height={height}
116+
fill={root}
112117
y={centerY}
113118
x={centerX}
119+
rx="10"
120+
ry="10"
114121
fill="url('#top')"
115122
/>
116123
<text
117124
dy=".33em"
118-
top= {node.y}
119-
left = {node.x}
125+
top={node.y}
126+
left={node.x}
120127
fontSize={9}
121128
fontFamily="Arial"
122129
textAnchor="middle"
@@ -129,7 +136,7 @@ function RootNode({ node }) {
129136
);
130137
}
131138

132-
const defaultMargin = { top: 40, left: 0, right: 0, bottom: 40};
139+
const defaultMargin = { top: 40, left: 0, right: 0, bottom: 40 };
133140

134141
// export type DendrogramProps = {
135142
// width: number;
@@ -143,7 +150,6 @@ export default function Example({
143150
margin = defaultMargin,
144151
snapshots,
145152
}) {
146-
147153
clusterDataPopulate(snapshots);
148154

149155
const data = useMemo(() => hierarchy(clusterData), []);
@@ -152,7 +158,8 @@ export default function Example({
152158

153159
return width < 10 ? null : (
154160
<svg width={width} height={height}>
155-
<LinearGradient id="top" from={green} to={aqua} />
161+
<LinearGradient id="top" from={lightorange} to={orange} />
162+
156163
<rect width={width} height={height} rx={14} fill={background} />
157164

158165
<Cluster root={data} size={[xMax, yMax]}>

src/app/components/History.tsx

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@ const filterHooks = (data: any[]) => {
3030
return JSON.stringify(data[0].state);
3131
};
3232

33-
3433
/**
3534
* @method maked3Tree :Creates a new D3 Tree
3635
*/
@@ -68,7 +67,7 @@ function History(props) {
6867
const g = svgContainer
6968
.append('g')
7069
// this is changing where the graph is located physically
71-
.attr('transform', `translate(${width / 2 + 4}, ${height / 2 + 2})`)
70+
.attr('transform', `translate(${width / 2 + 4}, ${height / 2 + 2})`);
7271

7372
// d3.hierarchy constructs a root node from the specified hierarchical data
7473
// (our object titled dataset), which must be an object representing the root node
@@ -83,7 +82,6 @@ function History(props) {
8382

8483
const d3root = tree(hierarchy);
8584

86-
8785
g.selectAll('.link')
8886
// root.links() gets an array of all the links,
8987
// where each element is an object containing a
@@ -109,12 +107,12 @@ function History(props) {
109107
.append('g')
110108
.style('fill', function (d) {
111109
let loadTime;
112-
if (d.data.stateSnapshot.children[0].componentData.actualDuration){
113-
loadTime = d.data.stateSnapshot.children[0].componentData.actualDuration;
114-
} else{
110+
if (d.data.stateSnapshot.children[0].componentData.actualDuration) {
111+
loadTime =
112+
d.data.stateSnapshot.children[0].componentData.actualDuration;
113+
} else {
115114
loadTime = 1;
116115
}
117-
118116

119117
if (loadTime !== undefined) {
120118
if (loadTime > 16) {
@@ -255,7 +253,7 @@ function History(props) {
255253

256254
return (
257255
<>
258-
<div ref={HistoryRef} className="history-d3-div" id="historyContainer"/>
256+
<div ref={HistoryRef} className="history-d3-div" id="historyContainer" />
259257
</>
260258
);
261259
}

src/app/components/PerfView.tsx

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,30 @@ interface PerfViewProps {
3131
}
3232

3333
const PerfView = (props: PerfViewProps) => {
34+
35+
// ------------- CIRCLES ----------------------
3436
const { viewIndex, width, height, setNoRenderData } = props;
3537
let { snapshots } = props;
3638
const adjustedSize = Math.min(width, height);
3739
const svgRef = useRef(null);
40+
41+
console.log(snapshots)
42+
43+
// const performances = []
44+
// snapshot = {
45+
// component1: 10,
46+
// component2: 24,
47+
// component3: 35,
48+
// others: 32
49+
// }
50+
51+
const performances = snapshots.reduce((acc,cur)=>{
52+
const snapshot = {};
53+
while (snapshot.keys.lenght
54+
}, []
55+
// iterate snapshots array
56+
// if i.children exists
57+
//
3858

3959
let indexToDisplay: number | null = null;
4060
if (viewIndex < 0) indexToDisplay = snapshots.length - 1;
@@ -85,7 +105,7 @@ const PerfView = (props: PerfViewProps) => {
85105
}, [indexToDisplay, svgRef]);
86106

87107
useEffect(() => {
88-
// Error, no App-level component present
108+
// Error, no App-level component presentnpm r
89109
if (snapshots[indexToDisplay].children.length < 1) return;
90110

91111
// Generate tree with our data
@@ -228,6 +248,9 @@ const PerfView = (props: PerfViewProps) => {
228248
handleNoRenderData,
229249
]);
230250

251+
// ------------- CIRCLES ----------------------
252+
253+
231254
return (
232255
<div className="perf-d3-container">
233256
<svg className="perf-d3-svg" ref={svgRef} />

0 commit comments

Comments
 (0)