import React from 'react' import { Card, CardDeck } from 'react-bootstrap'; import {ActiveDeviceCollection, SensorDataCollection} from "../../client/main"; import {useTracker} from 'meteor/react-meteor-data'; export default function SensorCardDeck() { const deviceId = useTracker(() => { return ActiveDeviceCollection.find().fetch()[0]; }); const sensorData = useTracker(() => { return SensorDataCollection.find({ device_id: deviceId.deviceId }, { sort: { timestamp: -1 }, limit: 1 }).fetch(); }); 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} % ) } }