diff --git a/.vscode-janus-debug b/.vscode-janus-debug deleted file mode 100644 index e69de29b..00000000 diff --git a/.vscode/settings.json b/.vscode/settings.json deleted file mode 100644 index 3da12932..00000000 --- a/.vscode/settings.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "eslint.enable": false, - "tslint.enable": false -} \ No newline at end of file diff --git a/react-frontend/public/sounds/zapsplat_science_fiction_alarm_big_warning_meltdown_wailing_deep_tone_fast_40027.mp3 b/react-frontend/public/sounds/zapsplat_science_fiction_alarm_big_warning_meltdown_wailing_deep_tone_fast_40027.mp3 deleted file mode 100644 index d50f13a0..00000000 Binary files a/react-frontend/public/sounds/zapsplat_science_fiction_alarm_big_warning_meltdown_wailing_deep_tone_fast_40027.mp3 and /dev/null differ diff --git a/react-frontend/src/actions/alarms.js b/react-frontend/src/actions/alarms.js deleted file mode 100644 index 2b2a30a5..00000000 --- a/react-frontend/src/actions/alarms.js +++ /dev/null @@ -1,48 +0,0 @@ - -export let overflowAlarm = (currentWaterLevel, currentTankId) => { - const dangerousWaterLevel = 98; - const audio = new Audio('/sounds/zapsplat_science_fiction_alarm_big_warning_meltdown_wailing_deep_tone_fast_40027'); - /* sound source: https://www.zapsplat.com/music/big-science-fiction-alarm-siren-warning-of-meltdown-or-catastrophe-wailing-deep-tone-fast/ - license: https://www.zapsplat.com/license-type/standard-license/ */ - - const startAudioAlarm = () => { - audio.play(); - audio.loop = true; - }; - - const stopAudioAlarm = () => { - audio.pause(); - audio.currentTime = 0; - }; - - const addStopAlarmButton = () => { - let currentTank = document.getElementById(`${currentTankId}`); - const stopAlarmButton = document.createElement('button'); - stopAlarmButton.className = 'alarm-button'; - stopAlarmButton.style.display = 'flex'; - stopAlarmButton.style.justifyContent = 'center'; - stopAlarmButton.style.alignItems = 'center'; - stopAlarmButton.addEventListener('click', stopAlarm); - currentTank.appendChild(stopAlarmButton); - }; - - const removeStopAlarmButton = (clickedButton) => { - clickedButton.parentNode.removeChild(clickedButton); - }; - - const stopAlarm = (event) => { - stopAudioAlarm(); - removeStopAlarmButton(event.target); - }; - - // when water level becomes dangerous triggers the alarm - const checkWaterLevel = () => { - if (currentWaterLevel >= dangerousWaterLevel) { - startAudioAlarm(); - addStopAlarmButton(); - } - }; - - const repeatWaterLevelCheck = setInterval(checkWaterLevel, 1000); - repeatWaterLevelCheck(); -}; diff --git a/react-frontend/src/actions/tankActions.js b/react-frontend/src/actions/tankActions.js index a0796f76..752f0c96 100644 --- a/react-frontend/src/actions/tankActions.js +++ b/react-frontend/src/actions/tankActions.js @@ -11,4 +11,3 @@ export const fetchTanks = () => { ] }; }; - diff --git a/react-frontend/src/pages/Home.js b/react-frontend/src/pages/Home.js index f2ca7c52..eb152463 100644 --- a/react-frontend/src/pages/Home.js +++ b/react-frontend/src/pages/Home.js @@ -1,11 +1,8 @@ - -import React, { Component } from 'react' -import {TankCircle, TankWaterValue} from '../components/Tank'; -import {Sticker} from '../components/Sticker' -import { connect } from 'react-redux'; -import { fetchTanks } from '../actions/tankActions'; -import {overflowAlarm} from '../actions/alarms'; - +import React, { Component } from "react"; +import { TankCircle, TankWaterValue } from "../components/Tank"; +import { Sticker } from "../components/Sticker"; +import { connect } from "react-redux"; +import { fetchTanks } from "../actions/tankActions"; class Home extends Component { componentWillMount() { @@ -41,10 +38,8 @@ class Home extends Component { Tank{tank.id} - {overflowAlarm(tank.value, tank.id)} - ))}