Skip to content

Commit bc08e4f

Browse files
committed
Tweaks
1 parent bb4e59f commit bc08e4f

File tree

12 files changed

+5263
-16888
lines changed

12 files changed

+5263
-16888
lines changed

components/Chart.js renamed to components/App.js

+40-16
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,9 @@ export default class extends React.Component {
5050
componentDidMount() {
5151
const socket = io.connect('http://localhost:3000');
5252
socket.on('data', (fetchedData) => {
53-
this.addItem(fetchedData);
53+
if (!this.state.paused) {
54+
this.addItem(fetchedData);
55+
}
5456
});
5557
}
5658

@@ -110,23 +112,45 @@ export default class extends React.Component {
110112
this.setState(_.cloneDeep(defaultState));
111113
}
112114

115+
toggle= () => this.setState({ hideMenu: !this.state.hideMenu })
116+
117+
pauseResume= () => this.setState({ paused: !this.state.paused })
118+
113119
render() {
114120
return (
115-
<div style={{ height: '100vh' }}>
116-
<div style={{ flex: 1 }}>
117-
<ReactFC
118-
type={this.state.type}
119-
width="100%"
120-
height="90%"
121-
dataFormat="json"
122-
dataSource={this.state.dataSource}
123-
/>
124-
</div>
125-
<div className="text-center mt-2">
126-
<button className="btn btn-primary mr-2" onClick={this.addSeries}>Add Variant</button>
127-
</div>
128-
<div className="text-center mt-2">
129-
<button className="btn btn-danger" onClick={this.clear}>Clear</button>
121+
<div className="container-fluid">
122+
<div className="row">
123+
<div className={`control-panel${this.state.hideMenu ? ' hidden' : ''}`}>
124+
<div style={{ flex: 1 }}>
125+
<div className="text-center mt-2">
126+
<button type="button" className="btn btn-primary mr-2" onClick={this.addSeries}>Add Variant</button>
127+
</div>
128+
<div className="text-center mt-2">
129+
<button type="button" className="btn btn-primary" onClick={this.pauseResume}>
130+
{this.state.paused ? 'Resume' : 'Pause'}
131+
</button>
132+
</div>
133+
</div>
134+
<div className="text-center mt-2 mb-2">
135+
<button type="button" className="btn btn-danger" onClick={this.clear}>Clear Tests</button>
136+
</div>
137+
</div>
138+
<div className="content">
139+
<div className="nav">
140+
<a onClick={this.toggle}>
141+
<img height={34} src="/static/menu.svg"/>
142+
</a>
143+
</div>
144+
<div className="content-inner">
145+
<ReactFC
146+
type={this.state.type}
147+
width="100%"
148+
height="85%"
149+
dataFormat="json"
150+
dataSource={this.state.dataSource}
151+
/>
152+
</div>
153+
</div>
130154
</div>
131155
</div>
132156
);

next.config.js

+2-49
Original file line numberDiff line numberDiff line change
@@ -1,49 +1,8 @@
11
const withSass = require('@zeit/next-sass');
22
const withCSS = require('@zeit/next-css');
3-
const withOffline = require('next-offline');
4-
const withBundleAnalyzer = require('@next/bundle-analyzer')({
5-
enabled: process.env.BUNDLE_ANALYZE === 'true',
6-
});
7-
const withSourceMaps = require('@zeit/next-source-maps')();
8-
93

104
const nextConfig = {
115
// next-offline options
12-
workboxOpts: {
13-
swDest: 'static/service-worker.js',
14-
runtimeCaching: [
15-
{
16-
urlPattern: new RegExp('.*?.woff'),
17-
handler: 'CacheFirst',
18-
options: {
19-
cacheName: 'fonts',
20-
expiration: {
21-
maxEntries: 150,
22-
maxAgeSeconds: (60 * 60 * 24) * 10, // 2 days
23-
},
24-
cacheableResponse: {
25-
statuses: [0, 200, 304],
26-
},
27-
},
28-
},
29-
{
30-
urlPattern: /^https?.*/,
31-
handler: 'NetworkFirst',
32-
options: {
33-
cacheName: 'https-calls',
34-
networkTimeoutSeconds: 15,
35-
expiration: {
36-
maxEntries: 150,
37-
maxAgeSeconds: 30 * 24 * 60 * 60, // 1 month
38-
},
39-
cacheableResponse: {
40-
statuses: [0, 200],
41-
},
42-
},
43-
},
44-
],
45-
},
46-
// buildId, dev, isServer, defaultLoaders, webpack
476
webpack: (config, { dev }) => {
487
const base = dev ? require('./webpack/webpack.config.dev') : require('./webpack/webpack.config.prod');
498
if (base.plugins) {
@@ -59,12 +18,6 @@ const nextConfig = {
5918
},
6019
};
6120

62-
module.exports = withOffline(
63-
withSourceMaps(
64-
withBundleAnalyzer(
65-
withSass(
66-
withCSS(nextConfig),
67-
),
68-
),
69-
),
21+
module.exports = withSass(
22+
withCSS(nextConfig),
7023
);

now.json

-33
This file was deleted.

0 commit comments

Comments
 (0)