From 398ed0cd663d65aa8b03f84a369128b36f55325f Mon Sep 17 00:00:00 2001 From: Denis Thiessen Date: Mon, 27 May 2024 16:39:27 +0200 Subject: [PATCH] feat: Participant Number Setup --- src/App.js | 16 +++++++++------- src/components/DownloadButton.jsx | 11 ++++++++++- src/core/Constants.jsx | 5 ++++- src/pages/TestInfoPage2.jsx | 10 ++++++++++ 4 files changed, 33 insertions(+), 9 deletions(-) create mode 100644 src/pages/TestInfoPage2.jsx diff --git a/src/App.js b/src/App.js index 05d97a1..3aa50f0 100644 --- a/src/App.js +++ b/src/App.js @@ -4,11 +4,13 @@ import { GeistProvider, CssBaseline } from '@geist-ui/core' import RouteTracker from "./core/log/RouteTracker"; import { createStore } from 'zustand/vanilla' import { persist, createJSONStorage } from 'zustand/middleware' +import { PARTICIPANT_NUMBER } from "./core/Constants"; const NoPageFound = React.lazy(() => import("./pages/NoPageFound")); const TestPage = React.lazy(() => import("./pages/TestPage")); const TestPage2 = React.lazy(() => import("./pages/TestPage2")); const TestInfoPage = React.lazy(() => import("./pages/TestInfoPage")); +const TestInfoPage2 = React.lazy(() => import("./pages/TestInfoPage2")); const TestEndPage = React.lazy(() => import("./pages/TestEndPage")); export const sensorLogState = createStore( @@ -87,7 +89,7 @@ function App() { wait(200); - const latinSquareOrder = getLatinSquareOrder(3); + const latinSquareOrder = getLatinSquareOrder(PARTICIPANT_NUMBER); return ( @@ -95,17 +97,17 @@ function App() { ...}>} /> - ...}>} /> + ...}>} /> ...}>} /> - ...}>} /> + ...}>} /> ...}>} /> - ...}>} /> + ...}>} /> ...}>} /> - ...}>} /> + ...}>} /> ...}>} /> - ...}>} /> + ...}>} /> ...}>} /> - ...}>} /> + ...}>} /> ...}>} /> ...}>} /> ...}>} /> diff --git a/src/components/DownloadButton.jsx b/src/components/DownloadButton.jsx index f18bd65..d4b70ef 100644 --- a/src/components/DownloadButton.jsx +++ b/src/components/DownloadButton.jsx @@ -2,6 +2,8 @@ import React from "react"; import { getTranslation } from "../core/i18n/I18NHandler"; import { getSensorLog } from "../core/log/SensorLogger"; import { Button } from '@geist-ui/core'; +import { getUserID } from "./RandomIDComponent"; +import { PARTICIPANT_NUMBER } from "../core/Constants"; function DownloadButton() { const downloadFile = ({ data, fileName, fileType }) => { @@ -18,10 +20,17 @@ function DownloadButton() { a.remove(); } + + const userData = { + participantId: getUserID(), + sensorLog: getSensorLog(), + participantNumber: PARTICIPANT_NUMBER + } + const exportToJson = e => { e.preventDefault(); downloadFile({ - data: JSON.stringify(getSensorLog()), + data: JSON.stringify(userData), fileName: 'sensorData.json', fileType: 'text/json', }) diff --git a/src/core/Constants.jsx b/src/core/Constants.jsx index 8181079..8ecf8f4 100644 --- a/src/core/Constants.jsx +++ b/src/core/Constants.jsx @@ -1,2 +1,5 @@ export const MOUSE_MODE = true; -export const HEATMAP_MAX = 999; \ No newline at end of file +export const HEATMAP_MAX = 999; + + +export const PARTICIPANT_NUMBER = 7; \ No newline at end of file diff --git a/src/pages/TestInfoPage2.jsx b/src/pages/TestInfoPage2.jsx new file mode 100644 index 0000000..0f5e135 --- /dev/null +++ b/src/pages/TestInfoPage2.jsx @@ -0,0 +1,10 @@ +import React from "react"; +import InfoPageComponent from "../components/InfoPageComponent"; + +function TestInfoPage2({redirectLoc}) { + return ( +

Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet.

+
); +} + +export default TestInfoPage2; \ No newline at end of file