Skip to content

Commit

Permalink
feat: formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
TyIsI committed Sep 23, 2024
1 parent c613215 commit 3038fbe
Show file tree
Hide file tree
Showing 17 changed files with 1,669 additions and 1,029 deletions.
1,228 changes: 614 additions & 614 deletions .eslintrc.json

Large diffs are not rendered by default.

3 changes: 3 additions & 0 deletions .stylelintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"extends": ["stylelint-config-standard", "stylelint-prettier/recommended"]
}
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ The `pages/api` directory is mapped to `/api/*`. Files in this directory are tre

To learn more about Next.js, take a look at the following resources:

- [Next.js Documentation](https://nextjs.org/docs) - learn about Next.js features and API.
- [Learn Next.js](https://nextjs.org/learn) - an interactive Next.js tutorial.
- [Next.js Documentation](https://nextjs.org/docs) - learn about Next.js features and API.
- [Learn Next.js](https://nextjs.org/learn) - an interactive Next.js tutorial.

You can check out [the Next.js GitHub repository](https://github.com/vercel/next.js/) - your feedback and contributions are welcome!

Expand Down
26 changes: 12 additions & 14 deletions docker-compose.dev.yml
Original file line number Diff line number Diff line change
@@ -1,14 +1,12 @@
version: '3.4'

services:
masks-override-page:
image: local/${DOCKER_TEMPLATE}
build: .
ports:
- "7442:3000"
environment:
- DEBUG=app:*
env_file:
- .env.local
volumes:
- ./public/config.json:/app/public/config.json
services:
masks-override-page:
image: local/${DOCKER_TEMPLATE}
build: .
ports:
- '7442:3000'
environment:
- DEBUG=app:*
env_file:
- .env.local
volumes:
- ./public/config.json:/app/public/config.json
8 changes: 3 additions & 5 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
version: '3.4'

services:
masks-override-page:
image: ${DOCKER_TEMPLATE}
services:
masks-override-page:
image: ${DOCKER_TEMPLATE}
76 changes: 38 additions & 38 deletions jsconfig.json
Original file line number Diff line number Diff line change
@@ -1,41 +1,41 @@
{
"compilerOptions": {
"baseUrl": ".",
"checkJs": false,
"resolveJsonModule": true,
"moduleResolution": "node",
"target": "es2020",
"module": "es2015",
"paths": {
"@/components/*": [
"components/*"
],
"@/styles/*": [
"styles/*"
],
"@/pages/*": [
"pages/*"
]
}
},
"exclude": [
"dist",
"node_modules",
"build",
".vscode",
".next",
"coverage",
".npm",
".yarn"
],
"include": [
"."
],
"typeAcquisition": {
"enable": true,
"compilerOptions": {
"baseUrl": ".",
"checkJs": false,
"resolveJsonModule": true,
"moduleResolution": "node",
"target": "es2020",
"module": "es2015",
"paths": {
"@/components/*": [
"components/*"
],
"@/styles/*": [
"styles/*"
],
"@/pages/*": [
"pages/*"
]
}
},
"exclude": [
"dist",
"node_modules",
"build",
".vscode",
".next",
"coverage",
".npm",
".yarn"
],
"include": [
"react",
"react-dom"
]
}
"."
],
"typeAcquisition": {
"enable": true,
"include": [
"react",
"react-dom"
]
}
}
21 changes: 13 additions & 8 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,6 @@
"autoprefixer": "^10.4.7",
"bootstrap": "5.2.0-beta1",
"debug": "^4.3.4",
"eslint-config-standard": "^17.0.0",
"eslint-plugin-jest": "^26.5.3",
"eslint-plugin-node": "^11.1.0",
"eslint-plugin-promise": "^6.0.0",
"eslint-plugin-standard": "^5.0.0",
"moment": "^2.29.4",
"next": "14.1.1",
"postcss": "^8.4.14",
Expand All @@ -29,9 +24,19 @@
"react-dom": "18.2.0",
"react-toastify": "^9.0.4"
},
"packageManager": "[email protected]",
"devDependencies": {
"eslint": "8.17.0",
"eslint-config-next": "12.1.6"
},
"packageManager": "[email protected]"
"eslint-config-next": "12.1.6",
"eslint-config-prettier": "^9.1.0",
"eslint-config-standard": "^17.0.0",
"eslint-plugin-jest": "^26.5.3",
"eslint-plugin-node": "^11.1.0",
"eslint-plugin-promise": "^6.0.0",
"eslint-plugin-standard": "^5.0.0",
"prettier": "^3.3.3",
"stylelint": "^16.9.0",
"stylelint-config-standard": "^36.0.1",
"stylelint-prettier": "^5.0.2"
}
}
30 changes: 13 additions & 17 deletions src/components/Clock/Clock.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,29 +3,25 @@ import PropTypes from 'prop-types'
import styles from './Clock.module.css'

const Clock = ({ time, color }) => {
if (time == null || time === false) {
return (
<div className={styles.Clock}>
__:__
</div>
)
}
if (time == null || time === false) {
return <div className={styles.Clock}>__:__</div>
}

const date = new Date(time)
const date = new Date(time)

const hours = date.getHours().toString().padStart(2, '0')
const minutes = date.getMinutes().toString().padStart(2, '0')
const hours = date.getHours().toString().padStart(2, '0')
const minutes = date.getMinutes().toString().padStart(2, '0')

return (
<div className={styles.Clock} style={{ color }}>
{hours}:{minutes}
</div>
)
return (
<div className={styles.Clock} style={{ color }}>
{hours}:{minutes}
</div>
)
}

Clock.propTypes = {
time: PropTypes.any.isRequired,
color: PropTypes.string
time: PropTypes.any.isRequired,
color: PropTypes.string
}

Clock.defaultProps = {}
Expand Down
18 changes: 9 additions & 9 deletions src/components/Clock/Clock.module.css
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
.Clock {
display : flex;
flex-direction : column;
align-items : center;
justify-content : center;
background-color: #EDEDED;
border-radius : 5px;
box-shadow : 0 0 10px rgba(0, 0, 0, 0.1);
font-family : "Helvetica Neue Regular", Helvetica, Arial, sans-serif;
font-size : 4rem;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
background-color: #ededed;
border-radius: 5px;
box-shadow: 0 0 10px rgb(0 0 0 / 10%);
font-family: 'Helvetica Neue Regular', Helvetica, Arial, sans-serif;
font-size: 4rem;
}
73 changes: 39 additions & 34 deletions src/lib/mqtt-beacon/service.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,10 @@ import Debug from 'debug'
const debug = Debug('app:mqtt-beacon:service')

const mqttUri = process.env.MQTT_URI ?? 'wss://test.mosquitto.org:8081/mqtt'
const mqttTopic = process.env.MQTT_TOPIC ?? '/test/vhs/spacebus/status/space/mask-override'
const mqttInterval = (process.env.MQTT_INTERVAL != null) ? parseInt(process.env.MQTT_INTERVAL) : 1
const mqttTopic =
process.env.MQTT_TOPIC ?? '/test/vhs/spacebus/status/space/mask-override'
const mqttInterval =
process.env.MQTT_INTERVAL != null ? parseInt(process.env.MQTT_INTERVAL) : 1
const mqttStoppedValue = process.env.MQTT_STOPPED_VALUE ?? 'off'

class MQTTBeaconService {
Expand All @@ -14,55 +16,58 @@ class MQTTBeaconService {
static intervalId = null
static beaconValue = mqttStoppedValue

static start () {
debug('start')
static start() {
debug('start')

if (!MQTTBeaconService.started) {
debug('start', 'Connecting to', mqttUri)
MQTTBeaconService.client = MQTT.connect(mqttUri)
if (!MQTTBeaconService.started) {
debug('start', 'Connecting to', mqttUri)
MQTTBeaconService.client = MQTT.connect(mqttUri)

MQTTBeaconService.client.on('connect', () => {
debug('start', 'Subscribing to', mqttTopic)
MQTTBeaconService.client.subscribe(mqttTopic)
})
MQTTBeaconService.client.on('connect', () => {
debug('start', 'Subscribing to', mqttTopic)
MQTTBeaconService.client.subscribe(mqttTopic)
})

MQTTBeaconService.intervalId = setInterval(() => MQTTBeaconService.sendBeacon(), (mqttInterval < 1000 ? mqttInterval * 1000 : mqttInterval))
MQTTBeaconService.intervalId = setInterval(
() => MQTTBeaconService.sendBeacon(),
mqttInterval < 1000 ? mqttInterval * 1000 : mqttInterval
)

MQTTBeaconService.started = true
}
MQTTBeaconService.started = true
}
}

static stop () {
debug('stop')
MQTTBeaconService.client.end()
clearInterval(MQTTBeaconService.intervalId)
MQTTBeaconService.started = false
MQTTBeaconService.client = null
MQTTBeaconService.intervalId = null
static stop() {
debug('stop')
MQTTBeaconService.client.end()
clearInterval(MQTTBeaconService.intervalId)
MQTTBeaconService.started = false
MQTTBeaconService.client = null
MQTTBeaconService.intervalId = null
}

static getBeaconValue () {
return MQTTBeaconService.beaconValue
static getBeaconValue() {
return MQTTBeaconService.beaconValue
}

static setBeaconValue (value) {
MQTTBeaconService.beaconValue = value
MQTTBeaconService.sendBeacon(value)
static setBeaconValue(value) {
MQTTBeaconService.beaconValue = value
MQTTBeaconService.sendBeacon(value)
}

static sendBeacon (value) {
value = value ?? MQTTBeaconService.getBeaconValue()
static sendBeacon(value) {
value = value ?? MQTTBeaconService.getBeaconValue()

if (value != null && MQTTBeaconService.client != null) {
debug('publish', MQTTBeaconService.beaconValue)
MQTTBeaconService.client.publish(mqttTopic, value)
}
if (value != null && MQTTBeaconService.client != null) {
debug('publish', MQTTBeaconService.beaconValue)
MQTTBeaconService.client.publish(mqttTopic, value)
}
}
}

if (global.MQTTBeaconServiceInstance == null) {
global.MQTTBeaconServiceInstance = MQTTBeaconService
global.MQTTBeaconServiceInstance.start()
global.MQTTBeaconServiceInstance = MQTTBeaconService
global.MQTTBeaconServiceInstance.start()
}

const MQTTBeaconServiceInstance = global.MQTTBeaconServiceInstance
Expand Down
Loading

0 comments on commit 3038fbe

Please sign in to comment.