diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md
new file mode 100644
index 0000000..d9ebdb0
--- /dev/null
+++ b/.github/ISSUE_TEMPLATE/bug_report.md
@@ -0,0 +1,31 @@
+---
+name: Bug report
+about: Create a report to help us improve
+title: ''
+labels: Bug
+assignees: nicodinh
+
+---
+
+## *Who* is the bug affecting?
+
+
+## *What* is affected by this bug?
+
+
+## *When* does this occur?
+
+
+## *Where* on the platform does it happen?
+
+
+
+## *How* do we replicate the issue?
+
+
+
+## Expected behavior (i.e. solution)
+
+
+
+## Other Comments/Screenshots
\ No newline at end of file
diff --git a/.github/ISSUE_TEMPLATE/config.yml b/.github/ISSUE_TEMPLATE/config.yml
new file mode 100644
index 0000000..6d34f46
--- /dev/null
+++ b/.github/ISSUE_TEMPLATE/config.yml
@@ -0,0 +1,8 @@
+blank_issues_enabled: true
+contact_links:
+ - name: Discord Community Chat
+ url: https://discord.gg/PvDca3
+ about: Please ask and answer questions here.
+# - name: GitHub Security Bug Bounty
+# url: https://bounty.github.com/
+# about: Please report security vulnerabilities here.
diff --git a/.github/ISSUE_TEMPLATE/feature_request.md b/.github/ISSUE_TEMPLATE/feature_request.md
new file mode 100644
index 0000000..9349803
--- /dev/null
+++ b/.github/ISSUE_TEMPLATE/feature_request.md
@@ -0,0 +1,20 @@
+---
+name: Feature request
+about: Suggest an idea for this project
+title: ''
+labels: Feature
+assignees: nicodinh
+
+---
+
+## **Is your feature request related to a problem? Please describe.**
+
+
+## **Describe the solution you'd like**
+
+
+## **Describe alternatives you've considered**
+
+
+## **Additional context**
+
\ No newline at end of file
diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md
new file mode 100644
index 0000000..0c76a91
--- /dev/null
+++ b/.github/pull_request_template.md
@@ -0,0 +1,28 @@
+
+
+## Description
+
+
+## Motivation and Context
+
+
+
+## How Has This Been Tested?
+
+
+
+
+## Screenshots (if appropriate):
+
+## Types of changes
+
+- [ ] Bug fix (non-breaking change which fixes an issue)
+- [ ] New feature (non-breaking change which adds functionality)
+- [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected)
+
+## Checklist:
+
+
+- [ ] My code follows the code style of this project.
+- [ ] My change requires a change to the documentation.
+- [ ] I have updated the documentation accordingly.
\ No newline at end of file
diff --git a/components/BatteryChart.js b/components/BatteryChart.js
index af49e06..34953f8 100644
--- a/components/BatteryChart.js
+++ b/components/BatteryChart.js
@@ -1,12 +1,30 @@
import React from 'react'
-import { VictoryChart, VictoryLine, VictoryTheme, VictoryLegend } from 'victory'
+import {
+ VictoryChart,
+ VictoryLine,
+ VictoryTheme,
+ VictoryLegend,
+ VictoryContainer
+} from 'victory'
+import { useStoreState } from 'easy-peasy'
const BatteryChart = () => {
+ const { chartValues, values } = useStoreState(state => state.battery)
+
return (
+ }
>
{
border: { stroke: 'black' },
title: { fontSize: 16 }
}}
- data={[{ name: 'Charge. %', symbol: { fill: 'green' } }]}
+ data={[{ name: 'Charge. %', symbol: { fill: 'blue' } }]}
/>
1 ? chartValues : []}
/>
diff --git a/components/Bluetooth.js b/components/Bluetooth.js
deleted file mode 100644
index c06629f..0000000
--- a/components/Bluetooth.js
+++ /dev/null
@@ -1,189 +0,0 @@
-import React from 'react'
-import { useStoreState } from 'easy-peasy'
-import { celciusToFahrenheit } from '../lib/celciusToFahrenheit'
-
-let myCharacteristicNotify = null
-
-class Bluetooth extends React.Component {
- constructor (props) {
- super(props)
- this.onButtonClick = this.onButtonClick.bind(this)
- this.handleNotifications = this.handleNotifications.bind(this)
- }
-
- componentWillUnmount () {
- myCharacteristicNotify.removeEventListener(
- 'characteristicvaluechanged',
- this.handleNotifications,
- false
- )
- clearInterval(this.interval)
- }
-
- state = {
- deviceName: '',
- deviceID: '',
- deviceConnected: false,
- error: '',
- service: '0000fee9-0000-1000-8000-00805f9b34fb',
- characteristicNotify: 'd44bc439-abfd-45a2-b575-925416129601',
- characteristic: 'd44bc439-abfd-45a2-b575-925416129600',
- temperaturePrefix: 'aa8f',
- batteryPrefix: 'aa8e',
- temperatureC: 3,
- temperatureF: 37,
- battery: null,
- isSectorAndBatteryInCharge: false, // button on
- isBatteryDischarge: false, // button on
- isSectorAndBatteryOff: false, // button off
- batteryStatus: null
- }
-
- handleNotifications (event) {
- let value = event.target.value
- let a = []
-
- for (let i = 0; i < value.byteLength; i++) {
- a.push(('00' + value.getUint8(i).toString(16)).slice(-2))
- }
-
- const hexString = a.join('')
-
- if (hexString.substr(0, 4) === 'aa8f') {
- const hex2dec = parseInt(a[2], 16)
- const celcius = hex2dec / 10
-
- this.setState({
- temperatureC: celcius,
- temperatureF: celciusToFahrenheit(celcius)
- })
- }
-
- if (hexString.substr(0, 4) === 'aa8e') {
- const binaryBattery = parseInt(a[2], 16)
- .toString(2)
- .padStart(8, '0')
-
- if (binaryBattery === '10000000') {
- this.setState(prevState => ({
- isSectorAndBatteryInCharge: false,
- isBatteryDischarge: false,
- isSectorAndBatteryOff: true,
- batteryStatus: 'Plugged in main',
- battery: null
- }))
- }
-
- if (binaryBattery < '10000000') {
- this.setState({
- isSectorAndBatteryInCharge: false,
- isBatteryDischarge: true,
- isSectorAndBatteryOff: false,
- batteryStatus: 'Discharging',
- battery:
- parseInt(binaryBattery.substr(1), 2) >= 100
- ? 100
- : parseInt(binaryBattery.substr(1), 2)
- })
- }
-
- if (binaryBattery > '10000000') {
- this.setState({
- isSectorAndBatteryInCharge: true,
- isBatteryDischarge: false,
- isSectorAndBatteryOff: false,
- batteryStatus: 'In Charge',
- battery:
- parseInt(binaryBattery.substr(1), 2) >= 100
- ? 100
- : parseInt(binaryBattery.substr(1), 2)
- })
- }
- }
- }
- async onButtonClick () {
- const {
- lifeinaboxName,
- lifeinaboxService,
- lifeinaboxCharacteristicNotify,
- lifeinaboxCharacteristic
- } = useStoreState(state => state.device)
- try {
- const device = await navigator.bluetooth.requestDevice({
- filters: [{ name: lifeinaboxName }],
- optionalServices: [lifeinaboxService]
- })
- const server = await device.gatt.connect()
- const deviceConnected = server.connected ? 'yes' : 'no'
- console.log(device.name)
- console.log(device.id)
- this.setState({
- deviceName: device.name,
- deviceID: device.id,
- deviceConnected
- })
- const service = await server.getPrimaryService(lifeinaboxService)
- myCharacteristicNotify = await service.getCharacteristic(
- lifeinaboxCharacteristicNotify
- )
- await myCharacteristicNotify.startNotifications()
- myCharacteristicNotify.addEventListener(
- 'characteristicvaluechanged',
- this.handleNotifications
- )
- const commandTMP1H = new Uint8Array([0xaa, 0x8f, 0x01, 0x55])
- const commandBATTERY = new Uint8Array([0xaa, 0x8e, 0xff, 0x55])
- const myCharacteristic = await service.getCharacteristic(
- this.state.characteristic
- )
- await myCharacteristic.writeValue(commandTMP1H)
- await myCharacteristic.writeValue(commandBATTERY)
- this.interval = setInterval(async () => {
- await myCharacteristic.writeValue(commandTMP1H)
- await myCharacteristic.writeValue(commandBATTERY)
- console.log('interval')
- }, 1000) //600000
- } catch (error) {
- console.log('Argh! ' + error)
- this.setState({
- error
- })
- }
- }
-
- render () {
- return (
-
-
-
-
-
-
-
-
- {this.state.deviceConnected ? this.state.temperatureC : null}
-
-
-
- {this.state.deviceConnected && !this.state.isSectorAndBatteryOff
- ? Math.round(this.state.battery)
- : this.state.deviceConnected && this.state.isSectorAndBatteryOff
- ? 'Battery is off'
- : null}
-
-
-
-
- {this.state.deviceConnected ? this.state.batteryStatus : null}
-
- )
- }
-}
-
-export default Bluetooth
diff --git a/components/FindButton.js b/components/FindButton.js
new file mode 100644
index 0000000..8305f00
--- /dev/null
+++ b/components/FindButton.js
@@ -0,0 +1,169 @@
+import React from 'react'
+import { useStoreState, useStoreActions } from 'easy-peasy'
+import { lastBatteryBuffer, lastTemperatureBuffer } from '../lib/'
+
+let myCharacteristicNotify = null
+let interval = null
+
+const FindButton = () => {
+ // Device Model
+ const {
+ lifeinaboxName,
+ lifeinaboxService,
+ lifeinaboxCharacteristicNotify,
+ lifeinaboxCharacteristic,
+ isConnected
+ } = useStoreState(state => state.device)
+
+ const { updateDeviceID, updateIsConnected } = useStoreActions(
+ actions => actions.device
+ )
+ const resetDevice = useStoreActions(actions => actions.device.reset)
+
+ // Temperature Model
+ const addTemperature = useStoreActions(
+ actions => actions.temperature.addValue
+ )
+ const resetTemperature = useStoreActions(actions => actions.temperature.reset)
+ // Battery Model
+ const addBatteryValue = useStoreActions(actions => actions.battery.addValue)
+ const updateBatteryStatus = useStoreActions(
+ actions => actions.battery.updateStatus
+ )
+ const resetBattery = useStoreActions(actions => actions.battery.reset)
+
+ // Settings Model
+ const { pollInterval, unit } = useStoreState(state => state.settings)
+
+ const handleNotifications = event => {
+ let value = event.target.value
+ let a = []
+
+ for (let i = 0; i < value.byteLength; i++) {
+ a.push(('00' + value.getUint8(i).toString(16)).slice(-2))
+ }
+
+ const hexString = a.join('')
+
+ if (hexString.substr(0, 4) === 'aa8f') {
+ const hex2dec = parseInt(a[2], 16)
+ const celcius = hex2dec / 10
+
+ // console.log(celcius)
+ addTemperature(celcius)
+ }
+
+ if (hexString.substr(0, 4) === 'aa8e') {
+ const binaryBattery = parseInt(a[2], 16)
+ .toString(2)
+ .padStart(8, '0')
+
+ if (binaryBattery === '10000000') {
+ updateBatteryStatus('Plugged in main')
+ }
+
+ if (binaryBattery < '10000000') {
+ updateBatteryStatus('Discharging')
+ addBatteryValue(
+ parseInt(binaryBattery.substr(1), 2) >= 100
+ ? 100
+ : parseInt(binaryBattery.substr(1), 2)
+ )
+ }
+
+ if (binaryBattery > '10000000') {
+ updateBatteryStatus('In Charge')
+ addBatteryValue(
+ parseInt(binaryBattery.substr(1), 2) >= 100
+ ? 100
+ : parseInt(binaryBattery.substr(1), 2)
+ )
+ }
+ }
+ }
+
+ const onClickDiscoverButton = async e => {
+ e.preventDefault()
+
+ try {
+ const device = await navigator.bluetooth.requestDevice({
+ filters: [{ name: lifeinaboxName }],
+ optionalServices: [lifeinaboxService]
+ })
+ const server = await device.gatt.connect()
+
+ updateDeviceID(device.id)
+ updateIsConnected(server.connected)
+
+ const service = await server.getPrimaryService(lifeinaboxService)
+ myCharacteristicNotify = await service.getCharacteristic(
+ lifeinaboxCharacteristicNotify
+ )
+ await myCharacteristicNotify.startNotifications()
+ myCharacteristicNotify.addEventListener(
+ 'characteristicvaluechanged',
+ handleNotifications
+ )
+
+ const myCharacteristic = await service.getCharacteristic(
+ lifeinaboxCharacteristic
+ )
+
+ interval = setInterval(async () => {
+ await myCharacteristic.writeValue(lastTemperatureBuffer)
+ await myCharacteristic.writeValue(lastBatteryBuffer)
+ }, pollInterval)
+ } catch (error) {
+ console.error(error)
+ }
+ }
+
+ const onClickDisconnectButton = async e => {
+ e.preventDefault()
+
+ // remove listeners
+ if (myCharacteristicNotify && interval) {
+ myCharacteristicNotify.removeEventListener(
+ 'characteristicvaluechanged',
+ handleNotifications,
+ false
+ )
+ clearInterval(interval)
+
+ // and clean them
+ myCharacteristicNotify = null
+ interval = null
+ }
+
+ // and reset redux
+ try {
+ await resetBattery()
+ await resetDevice()
+ await resetTemperature()
+ } catch (error) {
+ console.log(error)
+ }
+ }
+
+ return (
+ <>
+
+ >
+ )
+}
+
+export { FindButton }
diff --git a/components/LifeinaBoxStats.js b/components/LifeinaBoxStats.js
index 16c764b..b7b1629 100644
--- a/components/LifeinaBoxStats.js
+++ b/components/LifeinaBoxStats.js
@@ -4,6 +4,7 @@ import { useStoreState } from 'easy-peasy'
const LifeinaBoxStats = () => {
const temperatureValue = useStoreState(state => state.temperature.value)
const batteryValue = useStoreState(state => state.battery.value)
+ const batteryStatus = useStoreState(state => state.battery.status)
return (
@@ -24,6 +25,11 @@ const LifeinaBoxStats = () => {
{`${batteryValue} %`}
) : null}
+ {batteryStatus ? (
+
+ {`${batteryStatus}`}
+
+ ) : null}
)
diff --git a/components/Nav.js b/components/Nav.js
new file mode 100644
index 0000000..ad977c6
--- /dev/null
+++ b/components/Nav.js
@@ -0,0 +1,44 @@
+import React from 'react'
+import Link from 'next/link'
+import { FindButton } from './FindButton'
+
+const Nav = () => {
+ // current page class color: text-teal-200
+
+ return (
+
+ )
+}
+
+export { Nav }
diff --git a/components/TemperatureChart.js b/components/TemperatureChart.js
index 300a131..26782e8 100644
--- a/components/TemperatureChart.js
+++ b/components/TemperatureChart.js
@@ -1,5 +1,11 @@
import React from 'react'
-import { VictoryChart, VictoryLine, VictoryTheme, VictoryLegend } from 'victory'
+import {
+ VictoryChart,
+ VictoryLine,
+ VictoryTheme,
+ VictoryLegend,
+ VictoryContainer
+} from 'victory'
import { useStoreState } from 'easy-peasy'
const TemperatureChart = () => {
@@ -10,6 +16,15 @@ const TemperatureChart = () => {
+ }
>
{
/>
11 ? chartValues : []}
data={values.length > 1 ? chartValues : []}
/>
diff --git a/components/index.js b/components/index.js
index 85b39a8..65bdd12 100644
--- a/components/index.js
+++ b/components/index.js
@@ -1,3 +1,4 @@
export * from './BatteryChart'
export * from './LifeinaBoxStats'
export * from './TemperatureChart'
+export * from './Nav'
diff --git a/components/Menu.js b/i18n/enGB.js
similarity index 100%
rename from components/Menu.js
rename to i18n/enGB.js
diff --git a/i18n/frFR.js b/i18n/frFR.js
new file mode 100644
index 0000000..e69de29
diff --git a/lib/handleNotifications.js b/lib/handleNotifications.js
new file mode 100644
index 0000000..e69de29
diff --git a/lib/onClickDisconnectButton.js b/lib/onClickDisconnectButton.js
new file mode 100644
index 0000000..e69de29
diff --git a/lib/onClickDiscoverButton.js b/lib/onClickDiscoverButton.js
new file mode 100644
index 0000000..e69de29
diff --git a/model/battery-model.js b/model/battery-model.js
index a097fe6..1b80cba 100644
--- a/model/battery-model.js
+++ b/model/battery-model.js
@@ -1,7 +1,34 @@
-import { action } from 'easy-peasy'
+import { action, computed } from 'easy-peasy'
+import { nth } from 'lodash'
const batteryModel = {
- values: []
+ values: [],
+ status: '',
+ reset: action(state => {
+ ;(state.values = []), (state.status = '')
+ }),
+ addValue: action((state, payload) => {
+ state.values.push(payload)
+ }),
+ updateStatus: action((state, payload) => {
+ state.status = payload
+ }),
+ value: computed(state => nth(state.values, -1)),
+ chartValues: computed(state => {
+ return [
+ { x: 0, y: nth(state.values, -1) },
+ { x: -1, y: nth(state.values, -2) || 0 },
+ { x: -2, y: nth(state.values, -3) || 0 },
+ { x: -3, y: nth(state.values, -4) || 0 },
+ { x: -4, y: nth(state.values, -5) || 0 },
+ { x: -5, y: nth(state.values, -6) || 0 },
+ { x: -6, y: nth(state.values, -7) || 0 },
+ { x: -7, y: nth(state.values, -8) || 0 },
+ { x: -8, y: nth(state.values, -9) || 0 },
+ { x: -9, y: nth(state.values, -10) || 0 },
+ { x: -10, y: nth(state.values, -11) || 0 }
+ ]
+ })
}
export default batteryModel
diff --git a/model/device-model.js b/model/device-model.js
index 379a050..ae2e8db 100644
--- a/model/device-model.js
+++ b/model/device-model.js
@@ -7,6 +7,9 @@ const deviceModel = {
lifeinaboxCharacteristic: 'd44bc439-abfd-45a2-b575-925416129600',
deviceID: '',
isConnected: false,
+ reset: action(state => {
+ ;(state.deviceID = ''), (state.isConnected = false)
+ }),
updateDeviceID: action((state, payload) => {
state.deviceID = payload
}),
diff --git a/model/index.js b/model/index.js
index d54c72a..9ccde53 100644
--- a/model/index.js
+++ b/model/index.js
@@ -2,12 +2,14 @@ import temperatureModel from './temperature-model'
import batteryModel from './battery-model'
import settingsModel from './settings-model'
import deviceModel from './device-model'
+import uiModel from './ui-model'
const storeModel = {
temperature: temperatureModel,
battery: batteryModel,
settings: settingsModel,
- device: deviceModel
+ device: deviceModel,
+ ui: uiModel
// devices: [
// {1: {temperature: temperatureModel}},
// {2: {temperature: temperatureModel}},
diff --git a/model/temperature-model.js b/model/temperature-model.js
index 75dc78b..f2950e5 100644
--- a/model/temperature-model.js
+++ b/model/temperature-model.js
@@ -3,6 +3,9 @@ import { nth } from 'lodash'
const temperatureModel = {
values: [],
+ reset: action(state => {
+ state.values = []
+ }),
addValue: action((state, payload) => {
state.values.push(payload)
}),
diff --git a/model/ui-model.js b/model/ui-model.js
new file mode 100644
index 0000000..9c7a724
--- /dev/null
+++ b/model/ui-model.js
@@ -0,0 +1,7 @@
+import { action } from 'easy-peasy'
+
+const uiModel = {
+ currentNavigationItem: ''
+}
+
+export default uiModel
diff --git a/package.json b/package.json
index 9741007..0fa4566 100644
--- a/package.json
+++ b/package.json
@@ -37,6 +37,7 @@
"prop-types": "^15.7.2",
"react": "latest",
"react-dom": "latest",
+ "styled-components": "^5.0.1",
"victory": "^34.1.1",
"yup": "^0.28.1"
},
diff --git a/pages/chat-with-us.js b/pages/chat-with-us.js
index 6a2991f..428e597 100644
--- a/pages/chat-with-us.js
+++ b/pages/chat-with-us.js
@@ -1,50 +1,10 @@
import React from 'react'
import '../styles/index.css'
+import { Nav } from '../components/'
export default () => (
<>
-
+
>
diff --git a/pages/faq.js b/pages/faq.js
deleted file mode 100644
index 99d0c64..0000000
--- a/pages/faq.js
+++ /dev/null
@@ -1,51 +0,0 @@
-import React from 'react'
-import '../styles/index.css'
-
-export default () => (
- <>
-
-
- FAQ
- >
-)
diff --git a/pages/index.js b/pages/index.js
index c96399d..5dfb2a2 100644
--- a/pages/index.js
+++ b/pages/index.js
@@ -1,227 +1,36 @@
import React from 'react'
import '../styles/index.css'
-import { useStoreState, useStoreActions } from 'easy-peasy'
-import { LifeinaBoxStats, BatteryChart, TemperatureChart } from '../components/'
-import { lastBatteryBuffer, lastTemperatureBuffer } from '../lib/'
+import {
+ LifeinaBoxStats,
+ BatteryChart,
+ TemperatureChart,
+ Nav
+} from '../components/'
export default () => {
- // Device Model
- const {
- lifeinaboxName,
- lifeinaboxService,
- lifeinaboxCharacteristicNotify,
- lifeinaboxCharacteristic
- } = useStoreState(state => state.device)
-
- const { updateDeviceID, updateIsConnected } = useStoreActions(
- actions => actions.device
- )
-
- // Temperature Model
- const temperatureValues = useStoreState(state => state.temperature.values)
-
- const addTemperature = useStoreActions(
- actions => actions.temperature.addValue
- )
-
- // Battery Model
- const batteryValues = useStoreState(state => state.battery.values)
-
- // Settings Model
- const { pollInterval, unit } = useStoreState(state => state.settings)
-
- let myCharacteristicNotify = null
- let interval = null
-
- const handleNotifications = event => {
- let value = event.target.value
- let a = []
-
- for (let i = 0; i < value.byteLength; i++) {
- a.push(('00' + value.getUint8(i).toString(16)).slice(-2))
- }
-
- const hexString = a.join('')
-
- if (hexString.substr(0, 4) === 'aa8f') {
- const hex2dec = parseInt(a[2], 16)
- const celcius = hex2dec / 10
-
- // console.log(celcius)
- addTemperature(celcius)
-
- // this.setState({
- // temperatureC: celcius,
- // temperatureF: celciusToFahrenheit(celcius)
- // })
- }
-
- // if (hexString.substr(0, 4) === 'aa8e') {
- // const binaryBattery = parseInt(a[2], 16)
- // .toString(2)
- // .padStart(8, '0')
-
- // if (binaryBattery === '10000000') {
- // this.setState(prevState => ({
- // isSectorAndBatteryInCharge: false,
- // isBatteryDischarge: false,
- // isSectorAndBatteryOff: true,
- // batteryStatus: 'Plugged in main',
- // battery: null
- // }))
- // }
-
- // if (binaryBattery < '10000000') {
- // this.setState({
- // isSectorAndBatteryInCharge: false,
- // isBatteryDischarge: true,
- // isSectorAndBatteryOff: false,
- // batteryStatus: 'Discharging',
- // battery:
- // parseInt(binaryBattery.substr(1), 2) >= 100
- // ? 100
- // : parseInt(binaryBattery.substr(1), 2)
- // })
- // }
-
- // if (binaryBattery > '10000000') {
- // this.setState({
- // isSectorAndBatteryInCharge: true,
- // isBatteryDischarge: false,
- // isSectorAndBatteryOff: false,
- // batteryStatus: 'In Charge',
- // battery:
- // parseInt(binaryBattery.substr(1), 2) >= 100
- // ? 100
- // : parseInt(binaryBattery.substr(1), 2)
- // })
- // }
- // }
- }
-
- const onClickDiscoverButton = async e => {
- e.preventDefault()
-
- try {
- const device = await navigator.bluetooth.requestDevice({
- filters: [{ name: lifeinaboxName }],
- optionalServices: [lifeinaboxService]
- })
- const server = await device.gatt.connect()
-
- updateDeviceID(device.id)
- updateIsConnected(server.connected)
-
- const service = await server.getPrimaryService(lifeinaboxService)
- myCharacteristicNotify = await service.getCharacteristic(
- lifeinaboxCharacteristicNotify
- )
- await myCharacteristicNotify.startNotifications()
- myCharacteristicNotify.addEventListener(
- 'characteristicvaluechanged',
- handleNotifications
- )
-
- const myCharacteristic = await service.getCharacteristic(
- lifeinaboxCharacteristic
- )
-
- interval = setInterval(async () => {
- await myCharacteristic.writeValue(lastTemperatureBuffer)
- await myCharacteristic.writeValue(lastBatteryBuffer)
- }, pollInterval)
- } catch (error) {
- console.error(error)
- }
- }
-
- const onClickDisconnectButton = e => {
- e.preventDefault()
-
- myCharacteristicNotify.removeEventListener(
- 'characteristicvaluechanged',
- handleNotifications,
- false
- )
- clearInterval(interval)
- }
-
return (
<>
-
-
+
- {/* content1 */}
- {/* content1 */}
- {/* content2 */}
- {/* content2 */}
- {/* content3 */}
- {/* content3 */}
- {/* */}
>
)
}
diff --git a/pages/settings.js b/pages/settings.js
index b497ab7..824c3a0 100644
--- a/pages/settings.js
+++ b/pages/settings.js
@@ -1,51 +1,15 @@
import React from 'react'
import '../styles/index.css'
+import { Nav } from '../components/'
export default () => (
<>
-
+
-
-

-
-
-
-
-
-
Settings
+
This feature is scheduled to tomorow :-)
+
>
)
diff --git a/yarn.lock b/yarn.lock
index 9a79472..8f7f0a4 100644
--- a/yarn.lock
+++ b/yarn.lock
@@ -125,7 +125,17 @@
lodash "^4.17.13"
source-map "^0.5.0"
-"@babel/helper-annotate-as-pure@^7.8.3":
+"@babel/generator@^7.8.6":
+ version "7.8.7"
+ resolved "https://registry.yarnpkg.com/@babel/generator/-/generator-7.8.7.tgz#870b3cf7984f5297998152af625c4f3e341400f7"
+ integrity sha512-DQwjiKJqH4C3qGiyQCAExJHoZssn49JTMJgZ8SANGgVFdkupcUhLOdkAeoC6kmHZCPfoDG5M0b6cFlSN5wW7Ew==
+ dependencies:
+ "@babel/types" "^7.8.7"
+ jsesc "^2.5.1"
+ lodash "^4.17.13"
+ source-map "^0.5.0"
+
+"@babel/helper-annotate-as-pure@^7.0.0", "@babel/helper-annotate-as-pure@^7.8.3":
version "7.8.3"
resolved "https://registry.yarnpkg.com/@babel/helper-annotate-as-pure/-/helper-annotate-as-pure-7.8.3.tgz#60bc0bc657f63a0924ff9a4b4a0b24a13cf4deee"
integrity sha512-6o+mJrZBxOoEX77Ezv9zwW7WV8DdluouRKNY/IR5u/YTMuKHgugHOzYWlYvYLpLA9nPsQCAAASpCIbjI9Mv+Uw==
@@ -347,6 +357,11 @@
resolved "https://registry.yarnpkg.com/@babel/parser/-/parser-7.8.4.tgz#d1dbe64691d60358a974295fa53da074dd2ce8e8"
integrity sha512-0fKu/QqildpXmPVaRBoXOlyBb3MC+J0A66x97qEfLOMkn3u6nfY5esWogQwi/K0BjASYy4DbnsEWnpNL6qT5Mw==
+"@babel/parser@^7.8.6":
+ version "7.8.7"
+ resolved "https://registry.yarnpkg.com/@babel/parser/-/parser-7.8.7.tgz#7b8facf95d25fef9534aad51c4ffecde1a61e26a"
+ integrity sha512-9JWls8WilDXFGxs0phaXAZgpxTZhSk/yOYH2hTHC0X1yC7Z78IJfvR1vJ+rmJKq3I35td2XzXzN6ZLYlna+r/A==
+
"@babel/plugin-proposal-async-generator-functions@^7.7.0", "@babel/plugin-proposal-async-generator-functions@^7.8.3":
version "7.8.3"
resolved "https://registry.yarnpkg.com/@babel/plugin-proposal-async-generator-functions/-/plugin-proposal-async-generator-functions-7.8.3.tgz#bad329c670b382589721b27540c7d288601c6e6f"
@@ -1065,6 +1080,21 @@
"@babel/parser" "^7.8.3"
"@babel/types" "^7.8.3"
+"@babel/traverse@^7.4.5":
+ version "7.8.6"
+ resolved "https://registry.yarnpkg.com/@babel/traverse/-/traverse-7.8.6.tgz#acfe0c64e1cd991b3e32eae813a6eb564954b5ff"
+ integrity sha512-2B8l0db/DPi8iinITKuo7cbPznLCEk0kCxDoB9/N6gGNg/gxOXiR/IcymAFPiBwk5w6TtQ27w4wpElgp9btR9A==
+ dependencies:
+ "@babel/code-frame" "^7.8.3"
+ "@babel/generator" "^7.8.6"
+ "@babel/helper-function-name" "^7.8.3"
+ "@babel/helper-split-export-declaration" "^7.8.3"
+ "@babel/parser" "^7.8.6"
+ "@babel/types" "^7.8.6"
+ debug "^4.1.0"
+ globals "^11.1.0"
+ lodash "^4.17.13"
+
"@babel/traverse@^7.7.2", "@babel/traverse@^7.8.3", "@babel/traverse@^7.8.4":
version "7.8.4"
resolved "https://registry.yarnpkg.com/@babel/traverse/-/traverse-7.8.4.tgz#f0845822365f9d5b0e312ed3959d3f827f869e3c"
@@ -1089,6 +1119,15 @@
lodash "^4.17.13"
to-fast-properties "^2.0.0"
+"@babel/types@^7.8.6", "@babel/types@^7.8.7":
+ version "7.8.7"
+ resolved "https://registry.yarnpkg.com/@babel/types/-/types-7.8.7.tgz#1fc9729e1acbb2337d5b6977a63979b4819f5d1d"
+ integrity sha512-k2TreEHxFA4CjGkL+GYjRyx35W0Mr7DP5+9q6WMkyKXB+904bYmG40syjMFV0oLlhhFCwWl0vA0DyzTDkwAiJw==
+ dependencies:
+ esutils "^2.0.2"
+ lodash "^4.17.13"
+ to-fast-properties "^2.0.0"
+
"@csstools/convert-colors@^1.4.0":
version "1.4.0"
resolved "https://registry.yarnpkg.com/@csstools/convert-colors/-/convert-colors-1.4.0.tgz#ad495dc41b12e75d588c6db8b9834f08fa131eb7"
@@ -1137,6 +1176,13 @@
dependencies:
"@emotion/memoize" "0.7.4"
+"@emotion/is-prop-valid@^0.8.3":
+ version "0.8.7"
+ resolved "https://registry.yarnpkg.com/@emotion/is-prop-valid/-/is-prop-valid-0.8.7.tgz#803449993f436f9a6c67752251ea3fc492a1044c"
+ integrity sha512-OPkKzUeiid0vEKjZqnGcy2mzxjIlCffin+L2C02pdz/bVlt5zZZE2VzO0D3XOPnH0NEeF21QNKSXiZphjr4xiQ==
+ dependencies:
+ "@emotion/memoize" "0.7.4"
+
"@emotion/memoize@0.7.4":
version "0.7.4"
resolved "https://registry.yarnpkg.com/@emotion/memoize/-/memoize-0.7.4.tgz#19bf0f5af19149111c40d98bb0cf82119f5d9eeb"
@@ -1176,12 +1222,12 @@
"@emotion/styled-base" "^10.0.27"
babel-plugin-emotion "^10.0.27"
-"@emotion/stylis@0.8.5":
+"@emotion/stylis@0.8.5", "@emotion/stylis@^0.8.4":
version "0.8.5"
resolved "https://registry.yarnpkg.com/@emotion/stylis/-/stylis-0.8.5.tgz#deacb389bd6ee77d1e7fcaccce9e16c5c7e78e04"
integrity sha512-h6KtPihKFn3T9fuIrwvXXUOwlx3rfUvfZIcP5a6rh8Y7zjE3O06hT5Ss4S/YI1AYhuZ1kjaE/5EaOOI2NqSylQ==
-"@emotion/unitless@0.7.5":
+"@emotion/unitless@0.7.5", "@emotion/unitless@^0.7.4":
version "0.7.5"
resolved "https://registry.yarnpkg.com/@emotion/unitless/-/unitless-0.7.5.tgz#77211291c1900a700b8a78cfafda3160d76949ed"
integrity sha512-OWORNpfjMsSSUBVrRBVGECkhWcULOAJz9ZW8uK9qgxD+87M7jHRcvh/A96XXNhXTLmKcoYSQtBEX7lHMO7YRwg==
@@ -2619,6 +2665,16 @@ babel-plugin-react-docgen@^4.0.0:
react-docgen "^5.0.0"
recast "^0.14.7"
+"babel-plugin-styled-components@>= 1":
+ version "1.10.7"
+ resolved "https://registry.yarnpkg.com/babel-plugin-styled-components/-/babel-plugin-styled-components-1.10.7.tgz#3494e77914e9989b33cc2d7b3b29527a949d635c"
+ integrity sha512-MBMHGcIA22996n9hZRf/UJLVVgkEOITuR2SvjHLb5dSTUyR4ZRGn+ngITapes36FI3WLxZHfRhkA1ffHxihOrg==
+ dependencies:
+ "@babel/helper-annotate-as-pure" "^7.0.0"
+ "@babel/helper-module-imports" "^7.0.0"
+ babel-plugin-syntax-jsx "^6.18.0"
+ lodash "^4.17.11"
+
babel-plugin-syntax-jsx@6.18.0, babel-plugin-syntax-jsx@^6.18.0:
version "6.18.0"
resolved "https://registry.yarnpkg.com/babel-plugin-syntax-jsx/-/babel-plugin-syntax-jsx-6.18.0.tgz#0af32a9a6e13ca7a3fd5069e62d7b0f58d0d8946"
@@ -3133,6 +3189,11 @@ camelcase@5.3.1, camelcase@^5.3.1:
resolved "https://registry.yarnpkg.com/camelcase/-/camelcase-5.3.1.tgz#e3c9b31569e106811df242f715725a1f4c494320"
integrity sha512-L28STB170nwWS63UjtlEOE3dldQApaJXZkOI1uMFfzf3rRuPegHaHesyee+YxQ+W6SvRDQV6UrdOdRiR153wJg==
+camelize@^1.0.0:
+ version "1.0.0"
+ resolved "https://registry.yarnpkg.com/camelize/-/camelize-1.0.0.tgz#164a5483e630fa4321e5af07020e531831b2609b"
+ integrity sha1-FkpUg+Yw+kMh5a8HAg5TGDGyYJs=
+
can-use-dom@^0.1.0:
version "0.1.0"
resolved "https://registry.yarnpkg.com/can-use-dom/-/can-use-dom-0.1.0.tgz#22cc4a34a0abc43950f42c6411024a3f6366b45a"
@@ -3740,6 +3801,11 @@ css-blank-pseudo@^0.1.4:
dependencies:
postcss "^7.0.5"
+css-color-keywords@^1.0.0:
+ version "1.0.0"
+ resolved "https://registry.yarnpkg.com/css-color-keywords/-/css-color-keywords-1.0.0.tgz#fea2616dc676b2962686b3af8dbdbe180b244e05"
+ integrity sha1-/qJhbcZ2spYmhrOvjb2+GAskTgU=
+
css-has-pseudo@^0.10.0:
version "0.10.0"
resolved "https://registry.yarnpkg.com/css-has-pseudo/-/css-has-pseudo-0.10.0.tgz#3c642ab34ca242c59c41a125df9105841f6966ee"
@@ -3843,6 +3909,15 @@ css-selector-tokenizer@^0.7.0:
fastparse "^1.1.1"
regexpu-core "^1.0.0"
+css-to-react-native@^3.0.0:
+ version "3.0.0"
+ resolved "https://registry.yarnpkg.com/css-to-react-native/-/css-to-react-native-3.0.0.tgz#62dbe678072a824a689bcfee011fc96e02a7d756"
+ integrity sha512-Ro1yETZA813eoyUp2GDBhG2j+YggidUmzO1/v9eYBKR2EHVEniE2MI/NqpTQ954BMpTPZFsGNPm46qFB9dpaPQ==
+ dependencies:
+ camelize "^1.0.0"
+ css-color-keywords "^1.0.0"
+ postcss-value-parser "^4.0.2"
+
css-tree@1.0.0-alpha.37:
version "1.0.0-alpha.37"
resolved "https://registry.yarnpkg.com/css-tree/-/css-tree-1.0.0-alpha.37.tgz#98bebd62c4c1d9f960ec340cf9f7522e30709a22"
@@ -5728,7 +5803,7 @@ hmac-drbg@^1.0.0:
minimalistic-assert "^1.0.0"
minimalistic-crypto-utils "^1.0.1"
-hoist-non-react-statics@^3.3.0:
+hoist-non-react-statics@^3.0.0, hoist-non-react-statics@^3.3.0:
version "3.3.2"
resolved "https://registry.yarnpkg.com/hoist-non-react-statics/-/hoist-non-react-statics-3.3.2.tgz#ece0acaf71d62c2969c2ec59feff42a4b1a85b45"
integrity sha512-/gGivxi8JPKWNm/W0jSmzcMPpfpPLc3dY/6GxhX2hQ9iGj3aDfklV4ET7NjKpSinLpJ5vafa9iiGIEZg10SfBw==
@@ -10511,6 +10586,22 @@ style-loader@^1.0.0:
loader-utils "^1.2.3"
schema-utils "^2.6.4"
+styled-components@^5.0.1:
+ version "5.0.1"
+ resolved "https://registry.yarnpkg.com/styled-components/-/styled-components-5.0.1.tgz#57782a6471031abefb2db5820a1876ae853bc619"
+ integrity sha512-E0xKTRIjTs4DyvC1MHu/EcCXIj6+ENCP8hP01koyoADF++WdBUOrSGwU1scJRw7/YaYOhDvvoad6VlMG+0j53A==
+ dependencies:
+ "@babel/helper-module-imports" "^7.0.0"
+ "@babel/traverse" "^7.4.5"
+ "@emotion/is-prop-valid" "^0.8.3"
+ "@emotion/stylis" "^0.8.4"
+ "@emotion/unitless" "^0.7.4"
+ babel-plugin-styled-components ">= 1"
+ css-to-react-native "^3.0.0"
+ hoist-non-react-statics "^3.0.0"
+ shallowequal "^1.1.0"
+ supports-color "^5.5.0"
+
styled-jsx@3.2.4:
version "3.2.4"
resolved "https://registry.yarnpkg.com/styled-jsx/-/styled-jsx-3.2.4.tgz#cbcdedcfb81d717fd355c4a0d8443f8e74527b60"
@@ -10552,7 +10643,7 @@ supports-color@^3.2.3:
dependencies:
has-flag "^1.0.0"
-supports-color@^5.3.0, supports-color@^5.4.0:
+supports-color@^5.3.0, supports-color@^5.4.0, supports-color@^5.5.0:
version "5.5.0"
resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-5.5.0.tgz#e2e69a44ac8772f78a1ec0b35b689df6530efc8f"
integrity sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==