diff --git a/@empirica-mocks/core/mocks.js b/@empirica-mocks/core/mocks.js index da61a3b..94b8fe3 100644 --- a/@empirica-mocks/core/mocks.js +++ b/@empirica-mocks/core/mocks.js @@ -110,6 +110,7 @@ export function usePlayers() { export function useGlobal() { // This is a mock function that returns a mock global object + // UPDATE CDN IF TESTING LOCALLY / DEPLOYING const global = { isMock: true, recruitingBatchConfig: { diff --git a/src/app/editor/components/RenderPanel.tsx b/src/app/editor/components/RenderPanel.tsx index 7426276..9d3d4b4 100644 --- a/src/app/editor/components/RenderPanel.tsx +++ b/src/app/editor/components/RenderPanel.tsx @@ -37,6 +37,12 @@ export function RenderPanel() { //console.log('Current stage', localStorage.getItem('currentStageIndex')) + useEffect(() => { + // Updates value of timeline slider when elapsed time changes + console.log('Elapsed time changed:', elapsed) + setTime(elapsed) + }, [elapsed]) + return (
{currentStageIndex === 'default' && ( diff --git a/src/app/editor/stageContext.jsx b/src/app/editor/stageContext.jsx index 80a3b82..ef8f93f 100644 --- a/src/app/editor/stageContext.jsx +++ b/src/app/editor/stageContext.jsx @@ -1,17 +1,17 @@ //import { set } from 'node_modules/cypress/types/lodash'; -import { createContext, useState } from 'react'; +import { createContext, useState } from 'react' // export const StageContext = createContext({ // currentStageIndex: "default", // elapsed: "default" // }); -const StageContext = createContext(); +const StageContext = createContext() const StageProvider = ({ children }) => { - const [currentStageIndex, setCurrentStageIndex] = useState('default'); - const [elapsed, setElapsed] = useState('default'); - const [treatment, setTreatment] = useState(null); + const [currentStageIndex, setCurrentStageIndex] = useState('default') + const [elapsed, setElapsed] = useState(0) + const [treatment, setTreatment] = useState(null) const contextValue = { currentStageIndex, @@ -19,17 +19,17 @@ const StageProvider = ({ children }) => { elapsed, setElapsed, treatment, - setTreatment - }; + setTreatment, + } return ( {children} - ); -}; + ) +} -export { StageContext, StageProvider }; +export { StageContext, StageProvider } // import React, { createContext, useState, useContext } from 'react';