Skip to content

Commit 0348cca

Browse files
neyser zananeyser zana
authored andcommitted
adding final styling to graphql panel
1 parent c72b9d6 commit 0348cca

File tree

8 files changed

+27
-35
lines changed

8 files changed

+27
-35
lines changed

build/webpack-bundle.js

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

build/webpack-bundle.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

public/graphql.css

Lines changed: 7 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,5 @@
11
#graphql-container {
22
width: 75%;
3-
background-color: rgba(214, 214, 214, 0.4);
4-
border: 1px solid rgba(0, 0, 0, 0.3);
5-
border-radius: 5px;
63
margin-left: 20px;
74
min-height: 600px;
85
}
@@ -13,29 +10,25 @@
1310
margin: 0px;
1411
}
1512

16-
#req-res{
17-
display: flex;
18-
}
19-
2013
#graphql-hr {
2114
margin: 10px 0px;
2215
}
2316

24-
#graphql {
25-
border-right: 1px solid black;
26-
width: 50%;
27-
padding: 10px;
28-
}
29-
3017
#graphql-res {
31-
width: 50%;
18+
background-color: rgba(214, 214, 214, 0.4);
19+
border: 1px solid rgba(0, 0, 0, 0.3);
20+
border-radius: 5px;
3221
padding: 10px;
22+
margin-bottom: 10px;
3323
}
3424

3525
#graphql-schema {
3626
overflow-y: scroll;
3727
max-height: 90%;
3828
padding: 10px;
29+
background-color: rgba(214, 214, 214, 0.4);
30+
border: 1px solid rgba(0, 0, 0, 0.3);
31+
border-radius: 5px;
3932
}
4033

4134
.graphql {

public/log-container.css

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
border: 1px solid rgba(0, 0, 0, 0.3);
66
border-radius: 5px;
77
max-height: 600px;
8-
height: 600px;
8+
height: 650px;
99
}
1010

1111
#log-header{
@@ -23,6 +23,7 @@
2323
padding: 15px;
2424
background:rgba(255,255,255,0.5);
2525
margin: 8px 0px;
26+
cursor: pointer;
2627
}
2728

2829
.log-p{

src/components/GraphQLRequest.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ import ReactJson from 'react-json-view';
44

55
const GraphQLRequest = ({ logs, log } ) => {
66
let req = log === null ? JSON.parse(logs[logs.length - 1].req.postData.text) : JSON.parse(log.req.postData.text);
7+
let id = log === null ? logs.length - 1 : log.id;
8+
console.log('GRAPHQL: ', req)
79
let query = req.query;
810
let variables = req.variables;
911
let operation = req.operationName;
@@ -15,7 +17,7 @@ const GraphQLRequest = ({ logs, log } ) => {
1517
{logs.length !== 0 ? (
1618
<div className='graphql'>
1719
<p className='graphql-p'>
18-
<b>Request:</b>
20+
<b>Request: {id} </b>
1921
</p>
2022
<p className='graphql-p'>
2123
<b>URL:</b> {url}

src/components/Log/Log.jsx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,7 @@ import { GraphqlCodeBlock } from 'graphql-syntax-highlighter-react';
44

55
const Log = props => {
66
return (
7-
<div className='log'>
8-
<button onClick={() => {props.logChange(props.logId)}}>view</button>
7+
<div className='log' onClick={() => { props.logChange(props.logId) }}>
98
<p className='log-p'>
109
<b>Request:</b> {props.logId}
1110
</p>

src/containers/GraphQLContainer.js

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,16 +9,12 @@ const GraphQLContainer = ({ logs, schema, log }) => {
99
<div id='graphql-container'>
1010
{logs.length !== 0 ? (
1111
<div>
12-
<div id='req-res'>
13-
<GraphQLRequest logs={logs} log ={log}/>
14-
<GraphQLResponse logs={logs} log ={log}/>
15-
</div>
16-
<hr />
12+
<GraphQLResponse logs={logs} log={log} />
1713
<GraphQLSchema schema={schema} />
1814
</div>
1915
) : (
20-
<h1>No requests have been made yet.</h1>
21-
)}
16+
<h1>No requests have been made yet.</h1>
17+
)}
2218
</div>
2319
);
2420
};

src/devtools.js

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ class App extends Component {
2828

2929
this.handleMouseOver = this.handleMouseOver.bind(this);
3030

31-
chrome.devtools.panels.create("Lucid", null, "devtools.html");
31+
chrome.devtools.panels.create('Lucid', null, 'devtools.html');
3232
}
3333

3434
componentDidMount() {
@@ -76,8 +76,8 @@ class App extends Component {
7676

7777
if (httpReq.response.content) {
7878
httpReq.getContent(responseBody => {
79-
if (responseBody === "") {
80-
log.res = "No response received";
79+
if (responseBody === '') {
80+
log.res = 'No response received';
8181
} else {
8282
const parsedResponseBody = JSON.parse(responseBody);
8383
log.res = parsedResponseBody;
@@ -111,13 +111,11 @@ class App extends Component {
111111

112112
//* invoke schema fetch only after a log object from a previous response is available
113113
componentDidUpdate(prevProps, prevState) {
114-
console.log('LENGTH: ', this.state.appFilteredDOM.length)
115-
if (this.state.schema === "GraphQL schema not available.") {
114+
if (this.state.schema === 'GraphQL schema not available.') {
116115
this.fetchSchemaFromGraphQLServer();
117116
}
118117

119118
if (prevState.appState !== this.state.appState) {
120-
console.log(this.state.componentsToFilter);
121119
if (this.state.componentsToFilter.length) {
122120
let result = [];
123121
filter(this.state.appState, this.state.componentsToFilter, result);
@@ -186,7 +184,9 @@ class App extends Component {
186184
// * handles the change of a log
187185
handleLogChange(reqId) {
188186
let req = this.state.logs[reqId];
189-
this.setState({ logView: req })
187+
req.id = reqId;
188+
console.log('HandleChange: ', req)
189+
this.setState({ logView: req });
190190
}
191191

192192
render() {
@@ -195,6 +195,7 @@ class App extends Component {
195195
<div>
196196
{this.state.appState.length === 0 ?
197197
<div id='devToolsLoader'>
198+
<img src='./logo.png' alt='devtool logo'/>
198199
<h1>Please trigger a setState() to activate Lucid devtool.<br /></h1>
199200
<p>Lucid works best on React v15/16</p>
200201
</div>

0 commit comments

Comments
 (0)