diff --git a/src/components/PageSwitcher/PageSwitcher.js b/src/components/PageSwitcher/PageSwitcher.js index c0ab424..28bb64e 100644 --- a/src/components/PageSwitcher/PageSwitcher.js +++ b/src/components/PageSwitcher/PageSwitcher.js @@ -63,7 +63,7 @@ export function PageSwitcher() { // pipe settings const [introSettings] = useState(funIntro.getSettings); const [heartRawSettings] = useState(funHeartRaw.getSettings); - const [heartSpectraSettings] = useState(funHeartSpectra.getSettings); + const [heartSpectraSettings, setHeartSpectraSettings] = useState(funHeartSpectra.getSettings); const [rawSettings, setRawSettings] = useState(funRaw.getSettings); const [spectraSettings, setSpectraSettings] = useState(funSpectra.getSettings); const [bandsSettings, setBandsSettings] = useState(funBands.getSettings); @@ -71,7 +71,7 @@ export function PageSwitcher() { const [spectroSettings, setSpectroSettings] = useState(funSpectro.getSettings); const [alphaSettings, setAlphaSettings] = useState(funAlpha.getSettings); const [ssvepSettings, setSsvepSettings] = useState(funSsvep.getSettings); - const [evokedSettings] = useState(funEvoked.getSettings); + const [evokedSettings, setEvokedSettings] = useState(funEvoked.getSettings); const [predictSettings, setPredictSettings] = useState(funPredict.getSettings); // connection status @@ -349,19 +349,19 @@ export function PageSwitcher() { return null case heartSpectra: return ( - funHeartSpectra.renderRecord(recordPopChange, recordPop, status, heartSpectraSettings) + funHeartSpectra.renderRecord(recordPopChange, recordPop, status, heartSpectraSettings, setHeartSpectraSettings) ) case raw: return ( - funRaw.renderRecord(recordPopChange, recordPop, status, rawSettings) + funRaw.renderRecord(recordPopChange, recordPop, status, rawSettings, setRawSettings) ) case spectra: return ( - funSpectra.renderRecord(recordPopChange, recordPop, status, spectraSettings) + funSpectra.renderRecord(recordPopChange, recordPop, status, spectraSettings, setSpectraSettings) ) case bands: return ( - funBands.renderRecord(recordPopChange, recordPop, status, bandsSettings) + funBands.renderRecord(recordPopChange, recordPop, status, bandsSettings, setBandsSettings) ) case animate: return null @@ -369,15 +369,15 @@ export function PageSwitcher() { return null case alpha: return ( - funAlpha.renderRecord(recordPopChange, recordPop, status, alphaSettings, recordTwoPopChange, recordTwoPop) + funAlpha.renderRecord(recordPopChange, recordPop, status, alphaSettings, recordTwoPopChange, recordTwoPop, setAlphaSettings) ) case ssvep: return ( - funSsvep.renderRecord(recordPopChange, recordPop, status, ssvepSettings, recordTwoPopChange, recordTwoPop) + funSsvep.renderRecord(recordPopChange, recordPop, status, ssvepSettings, recordTwoPopChange, recordTwoPop, setSsvepSettings) ) case evoked: return ( - funEvoked.renderRecord(recordPopChange, recordPop, status, evokedSettings) + funEvoked.renderRecord(recordPopChange, recordPop, status, evokedSettings, setEvokedSettings) ) case predict: return ( diff --git a/src/components/PageSwitcher/components/EEGEduAlpha/EEGEduAlpha.js b/src/components/PageSwitcher/components/EEGEduAlpha/EEGEduAlpha.js index 85bd4d9..4204852 100644 --- a/src/components/PageSwitcher/components/EEGEduAlpha/EEGEduAlpha.js +++ b/src/components/PageSwitcher/components/EEGEduAlpha/EEGEduAlpha.js @@ -3,8 +3,8 @@ import { catchError, multicast } from "rxjs/operators"; import { TextContainer, Card, Stack, RangeSlider, Button, ButtonGroup, Modal } from "@shopify/polaris"; import { saveAs } from 'file-saver'; -import { take } from "rxjs/operators"; -import { Subject } from "rxjs"; +import { take, takeUntil } from "rxjs/operators"; +import { Subject, timer } from "rxjs"; import { channelNames } from "muse-js"; import { Line } from "react-chartjs-2"; @@ -36,7 +36,8 @@ export function getSettings() { sliceFFTHigh: 30, duration: 1024, srate: 256, - name: 'Alpha' + name: 'Alpha', + secondsToSave: 10 } }; @@ -247,10 +248,23 @@ export function renderSliders(setData, setSettings, status, Settings) { ) } -export function renderRecord(recordPopChange, recordPop, status, Settings, recordTwoPopChange, recordTwoPop) { +export function renderRecord(recordPopChange, recordPop, status, Settings, recordTwoPopChange, recordTwoPop, setSettings) { + + function handleSecondsToSaveRangeSliderChange(value) { + setSettings(prevState => ({...prevState, secondsToSave: value})); + } + return( +