From 1b74c3da3f636297157e39104b6150144a71d5c4 Mon Sep 17 00:00:00 2001 From: slice Date: Fri, 13 Jul 2018 19:06:38 -0700 Subject: [PATCH] create components folder --- priv/frontend/src/{ => components}/App.css | 0 priv/frontend/src/{ => components}/App.js | 19 ++++++++++--------- priv/frontend/src/{ => components}/Graph.css | 0 priv/frontend/src/{ => components}/Graph.js | 0 .../frontend/src/{ => components}/Service.css | 0 priv/frontend/src/{ => components}/Service.js | 2 +- .../{ => components}/ServicePlaceholder.css | 0 .../{ => components}/ServicePlaceholder.js | 0 priv/frontend/src/index.css | 10 ++++++++-- priv/frontend/src/index.js | 4 ++-- 10 files changed, 21 insertions(+), 14 deletions(-) rename priv/frontend/src/{ => components}/App.css (100%) rename priv/frontend/src/{ => components}/App.js (94%) rename priv/frontend/src/{ => components}/Graph.css (100%) rename priv/frontend/src/{ => components}/Graph.js (100%) rename priv/frontend/src/{ => components}/Service.css (100%) rename priv/frontend/src/{ => components}/Service.js (100%) rename priv/frontend/src/{ => components}/ServicePlaceholder.css (100%) rename priv/frontend/src/{ => components}/ServicePlaceholder.js (100%) diff --git a/priv/frontend/src/App.css b/priv/frontend/src/components/App.css similarity index 100% rename from priv/frontend/src/App.css rename to priv/frontend/src/components/App.css diff --git a/priv/frontend/src/App.js b/priv/frontend/src/components/App.js similarity index 94% rename from priv/frontend/src/App.js rename to priv/frontend/src/components/App.js index 5498b5b..4f3718e 100644 --- a/priv/frontend/src/App.js +++ b/priv/frontend/src/components/App.js @@ -3,8 +3,8 @@ import React, { Component } from 'react'; import './App.css'; import Service from './Service.js'; import ServicePlaceholder from './ServicePlaceholder.js'; -import OP from './ws/op.js'; -import { log } from './util.js'; +import OP from '../ws/op.js'; +import { log } from '../util.js'; const DOMAIN = 'https://elstatus.stayathomeserver.club'; // const ENDPOINT = 'http://localhost:8069/api/status' @@ -106,7 +106,6 @@ export default class App extends Component { } } - render() { const metrics = !this.state.metrics ? null : (
@@ -123,21 +122,23 @@ export default class App extends Component {
); - return (

elstatus

+ + {this.state.error ? ( +
+ Error: {this.state.error} +
+ ) : null} + {this.state.loading ? ( - ) : null} - {this.state.error ? ( -
Error: {this.state.error}
- ) : null} - {metrics} + ) : metrics}
); } diff --git a/priv/frontend/src/Graph.css b/priv/frontend/src/components/Graph.css similarity index 100% rename from priv/frontend/src/Graph.css rename to priv/frontend/src/components/Graph.css diff --git a/priv/frontend/src/Graph.js b/priv/frontend/src/components/Graph.js similarity index 100% rename from priv/frontend/src/Graph.js rename to priv/frontend/src/components/Graph.js diff --git a/priv/frontend/src/Service.css b/priv/frontend/src/components/Service.css similarity index 100% rename from priv/frontend/src/Service.css rename to priv/frontend/src/components/Service.css diff --git a/priv/frontend/src/Service.js b/priv/frontend/src/components/Service.js similarity index 100% rename from priv/frontend/src/Service.js rename to priv/frontend/src/components/Service.js index 48c0da8..b66aea2 100644 --- a/priv/frontend/src/Service.js +++ b/priv/frontend/src/components/Service.js @@ -3,8 +3,8 @@ import PropTypes from 'prop-types'; import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'; -import Graph from './Graph.js'; import './Service.css'; +import Graph from './Graph.js'; const Service = ({ graph, name, status, latency, description }) => (
diff --git a/priv/frontend/src/ServicePlaceholder.css b/priv/frontend/src/components/ServicePlaceholder.css similarity index 100% rename from priv/frontend/src/ServicePlaceholder.css rename to priv/frontend/src/components/ServicePlaceholder.css diff --git a/priv/frontend/src/ServicePlaceholder.js b/priv/frontend/src/components/ServicePlaceholder.js similarity index 100% rename from priv/frontend/src/ServicePlaceholder.js rename to priv/frontend/src/components/ServicePlaceholder.js diff --git a/priv/frontend/src/index.css b/priv/frontend/src/index.css index 9bde4b7..8d548fc 100644 --- a/priv/frontend/src/index.css +++ b/priv/frontend/src/index.css @@ -2,6 +2,10 @@ html, body { box-sizing: border-box; } +*, *:before, *:after { + box-sizing: inherit; +} + body { margin: 0; padding: 2rem; @@ -12,6 +16,8 @@ h1:first-child { margin-top: 0; } -*, *:before, *:after { - box-sizing: inherit; +.error { + background: pink; + padding: 1rem; + border-radius: 0.15rem; } diff --git a/priv/frontend/src/index.js b/priv/frontend/src/index.js index 072bd8d..af0200f 100644 --- a/priv/frontend/src/index.js +++ b/priv/frontend/src/index.js @@ -1,9 +1,9 @@ import React from 'react'; import ReactDOM from 'react-dom'; -import register from './icons.js'; import './index.css'; -import App from './App'; +import App from './components/App'; +import register from './icons.js'; register();