diff --git a/client/main.jsx b/client/main.jsx
index c719b8a..decd92b 100644
--- a/client/main.jsx
+++ b/client/main.jsx
@@ -23,7 +23,5 @@ Meteor.startup(() => {
Meteor.subscribe('sensorDataCollection');
}
- Meteor.setTimeout(function() {
- ReactDOM.render(, document.getElementById('root'));
- }, 1250);
+ ReactDOM.render(, document.getElementById('root'));
});
\ No newline at end of file
diff --git a/imports/ui/Home.jsx b/imports/ui/Home.jsx
index 1399c17..d413e61 100644
--- a/imports/ui/Home.jsx
+++ b/imports/ui/Home.jsx
@@ -4,68 +4,83 @@ import SensorCardDeck from './SensorCardDeck'
import {SensorDataCollection} from "../../client/main";
import {useTracker} from 'meteor/react-meteor-data';
import {Col, Row} from "react-bootstrap";
+import { Card, CardDeck } from 'react-bootstrap';
+
export default function Home() {
const sensorData = useTracker(() => {
return SensorDataCollection.find({ device_id: 'esp-andy' }, { sort: { timestamp: -1 }, limit: 10 }).fetch().reverse();
});
- return (
- <>
-
+ if (sensorData.length <= 0) {
+ return (
+
+
+
+ Loading!
+ Please wait...
+
+
+
+ )
+ } else {
+ return (
+ <>
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- >
- )
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ >
+ )
+ }
}
\ No newline at end of file
diff --git a/imports/ui/SensorCardDeck.jsx b/imports/ui/SensorCardDeck.jsx
index 46709ef..f0bcbed 100644
--- a/imports/ui/SensorCardDeck.jsx
+++ b/imports/ui/SensorCardDeck.jsx
@@ -7,33 +7,45 @@ export default function SensorCardDeck() {
const sensorData = useTracker(() => {
return SensorDataCollection.find({ device_id: 'esp-andy' }, { sort: { timestamp: -1 }, limit: 1 }).fetch();
});
-
- return (
-
-
-
- Temperature
- {sensorData[0].temperature} °C
-
-
-
-
- Humidity
- {sensorData[0].humidity} %
-
-
-
-
- Brightness
- {sensorData[0].brightness} lux
-
-
-
-
- Moisture
- {sensorData[0].moisture} %
-
-
-
- )
+ if (sensorData.length <= 0) {
+ return (
+
+
+
+ Loading!
+ Please wait...
+
+
+
+ )
+ } else {
+ return (
+
+
+
+ Temperature
+ {sensorData[0].temperature} °C
+
+
+
+
+ Humidity
+ {sensorData[0].humidity} %
+
+
+
+
+ Brightness
+ {sensorData[0].brightness} lux
+
+
+
+
+ Moisture
+ {sensorData[0].moisture} %
+
+
+
+ )
+ }
}
\ No newline at end of file
diff --git a/package.json b/package.json
index afc917c..bceda08 100644
--- a/package.json
+++ b/package.json
@@ -2,7 +2,8 @@
"name": "smart_garden_server",
"private": true,
"scripts": {
- "start": "meteor run",
+ "start": "MONGO_URL=mongodb://garden:99009911@cloud.timovolkmann.de:27017/Smart_Garden meteor run",
+ "plainstart": "meteor run",
"test": "meteor test --once --driver-package meteortesting:mocha",
"test-app": "TEST_WATCH=1 meteor test --full-app --driver-package meteortesting:mocha",
"visualize": "meteor --production --extra-packages bundle-visualizer"