Skip to content

Commit 171af92

Browse files
committed
conflicts resolved
2 parents 5785561 + 5aa7bd5 commit 171af92

File tree

3 files changed

+105
-25
lines changed

3 files changed

+105
-25
lines changed

public/app.css

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,69 @@ h2{
1616
text-transform: uppercase;
1717
}
1818

19+
@media screen and (max-width: 600px) {
20+
.reactTab {
21+
display: grid;
22+
grid-template-rows: 1fr 1fr 1fr;
23+
grid-template-columns: 1fr;
24+
grid-template-areas:
25+
'sp-box'
26+
'diff'
27+
'tree';
28+
}
29+
.state-prop-display {
30+
grid-area: sp-box;
31+
background-color: #333;
32+
color: white;
33+
overflow-y: scroll;
34+
border: 1px solid black;
35+
border-radius: 5px;
36+
padding: 5px 5px;
37+
margin-right: 10px;
38+
}
39+
40+
#treeWrapper{
41+
grid-area: tree;
42+
background-color: rgba(214, 214, 214, 0.4);
43+
border: 1px solid rgba(0, 0, 0, 0.3);
44+
border-radius: 5px;
45+
padding: 10px;
46+
margin-left: 10px;
47+
}
48+
49+
#stateDiff-container {
50+
grid-area: diff;
51+
overflow-y: scroll;
52+
background-color: rgba(214, 214, 214, 0.4);
53+
border: 1px solid rgba(0, 0, 0, 0.3);
54+
border-radius: 5px;
55+
padding: 10px;
56+
margin-top: 10px;
57+
margin-right: 10px;
58+
}
59+
60+
#state-header{
61+
display: flex;
62+
/* justify-content: space-between; */
63+
margin-bottom: 5px;
64+
}
65+
66+
.stateDiff-div {
67+
overflow-x: scroll;
68+
padding: 15px;
69+
background:rgba(255,255,255,0.5);
70+
margin: 8px 0px;
71+
}
72+
73+
.state-span{
74+
margin: 6px;
75+
font-size: 1.2em;
76+
font-weight: 500;
77+
letter-spacing: 0.8px;
78+
line-height: 15px;
79+
}
80+
}
81+
1982
#app-container{
2083
display: flex;
2184
padding: 10px 25px;
@@ -48,6 +111,7 @@ h2{
48111
margin-right: 10px;
49112
}
50113

114+
51115
#treeWrapper{
52116
text-align: center;
53117
grid-area: tree;
@@ -88,6 +152,11 @@ button{
88152
margin: 5px;
89153
}
90154

155+
.toggleOn {
156+
background-color: rgba(214, 214, 214, 0.8);
157+
color: white;
158+
}
159+
91160
/* For window */
92161
#window{
93162
display: flex;

src/components/TreeDiagram.jsx

Lines changed: 21 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@ class TreeDiagram extends React.Component {
99
this.state = {
1010
transition: null,
1111
orientation: 'vertical',
12-
foreignObjectWrapper: {y: -5, x: 10},
13-
nodeSize: {x: 75, y: 75},
12+
foreignObjectWrapper: {x: 8, y: 4},
13+
nodeSize: {x: 95, y: 85},
1414
};
1515
this.handleFlip = this.handleFlip.bind(this);
1616
}
@@ -29,17 +29,27 @@ class TreeDiagram extends React.Component {
2929
}
3030

3131
handleFlip() {
32+
const dimensions = this.treeContainer.getBoundingClientRect();
3233
if(this.state.orientation === 'vertical') {
3334
this.setState({
3435
orientation: 'horizontal',
35-
foreignObjectWrapper: {y: 10, x: 10},
36-
nodeSize:{y:85, x:90}
36+
foreignObjectWrapper: {x: 5, y: 8},
37+
nodeSize: {x: 110, y:110},
38+
translate: {
39+
x: dimensions.width / 8,
40+
y: dimensions.height / 2
41+
}
3742
})
3843
} else {
3944
this.setState({
4045
orientation: 'vertical',
41-
foreignObjectWrapper: {y: -5, x: 10}
42-
})
46+
foreignObjectWrapper: {x: 8, y: 4},
47+
nodeSize: {x: 85, y: 85},
48+
translate: {
49+
x: dimensions.width / 2,
50+
y: dimensions.height / 8
51+
}
52+
});
4353
}
4454
}
4555

@@ -73,18 +83,18 @@ class TreeDiagram extends React.Component {
7383
}
7484
};
7585

86+
7687
return (
7788
<div id="treeWrapper" ref={tc => (this.treeContainer = tc)}>
7889
<button onClick={() => {this.handleFlip()}}> {this.state.orientation[0].toUpperCase() + this.state.orientation.slice(1)} </button>
79-
<button onClick={() => { this.props.handleFilter(filterComponents.reduxComponents) }}>Filter Redux</button>
80-
<button onClick={() => { this.props.handleFilter(filterComponents.reactRouterComponents) }}>Filter React-Router</button>
81-
<button onClick={() => { this.props.handleFilter(filterComponents.apolloComponents) }}>Filter Apollo-GraphQL</button>
90+
<button onClick={(e) => { this.props.handleFilter(e, filterComponents.reduxComponents) }}>Filter Redux</button>
91+
<button onClick={(e) => { this.props.handleFilter(e, filterComponents.reactRouterComponents) }}>Filter React-Router</button>
92+
<button onClick={(e) => { this.props.handleFilter(e, filterComponents.apolloComponents) }}>Filter Apollo-GraphQL</button>
8293

83-
{/* when appState has a length we populate tree */}
8494
{this.props.appState.length !== 0 ? (
8595
<Tree
8696
data={this.props.appState}
87-
nodeSize={{ x: 75, y: 75 }}
97+
nodeSize={this.state.nodeSize}
8898
orientation={this.state.orientation}
8999
styles={styles}
90100
translate={this.state.translate}

src/devtools.js

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,7 @@ class App extends Component {
2626
componentsToFilter: [],
2727
};
2828

29-
this.handleMouseOver = this.handleMouseOver.bind(this);
30-
31-
chrome.devtools.panels.create('Lucid', null, 'devtools.html');
29+
chrome.devtools.panels.create("Lucid", null, "devtools.html");
3230
}
3331

3432
componentDidMount() {
@@ -55,10 +53,9 @@ class App extends Component {
5553
let diff = recurseDiff(oldstate, this.state.appReactDOM);
5654
appState.setState({ stateDiff: diff });
5755
}
58-
56+
5957
//if there is an active setTimeout, clear it
6058
clearTimeout(timeout);
61-
6259
timeout = setTimeout(() => {
6360
appState.setState({ appState: req.msg });
6461
}, 1000);
@@ -100,14 +97,14 @@ class App extends Component {
10097
headers: { 'Content-Type': 'application/json' },
10198
body: JSON.stringify({ query: introspectionQuery })
10299
})
103-
.then(res => res.json())
104-
.then(json =>
105-
this.setState({
106-
schema: JSON.stringify(json.data)
107-
})
100+
.then(res => res.json())
101+
.then(json =>
102+
this.setState({
103+
schema: JSON.stringify(json.data)
104+
})
108105
);
106+
}
109107
}
110-
}
111108

112109
//* invoke schema fetch only after a log object from a previous response is available
113110
componentDidUpdate(prevProps, prevState) {
@@ -124,7 +121,6 @@ class App extends Component {
124121
}
125122
}
126123

127-
128124
// * Handles the tab click for tree and req/res window
129125
handleWindowChange(target) {
130126
console.log(target);
@@ -140,7 +136,12 @@ class App extends Component {
140136
}
141137

142138
// * Handles the filter for the component tree
143-
handleFilter(arr) {
139+
handleFilter(e, arr) {
140+
if(e.target.classList.contains('toggleOn')) {
141+
e.target.classList.remove('toggleOn')
142+
} else {
143+
e.target.classList.add('toggleOn');
144+
}
144145
let result = [];
145146
if (!this.state.componentsToFilter.includes(arr[0])) {
146147
let componentsArr = this.state.componentsToFilter.concat(arr);
@@ -222,7 +223,7 @@ class App extends Component {
222223
) : (
223224
<div class='reactTab'>
224225
<StateContainer clearLog={this.handleClearLog.bind(this)} stateDiffs={this.state.stateDiff} />
225-
<TreeDiagram appState={this.state.appFilteredDOM.length === 0 ? this.state.appState : this.state.appFilteredDOM} handleMouseOver={this.handleMouseOver} handleFilter={this.handleFilter.bind(this)} />
226+
<TreeDiagram appState={this.state.appFilteredDOM.length === 0 ? this.state.appState : this.state.appFilteredDOM} handleMouseOver={this.handleMouseOver.bind(this)} handleFilter={this.handleFilter.bind(this)} />
226227
<StatePropsBox nodeData={this.state.nodeData} />
227228
</div>
228229
)}

0 commit comments

Comments
 (0)