Skip to content

Commit

Permalink
timeline slider fixed, works for displayTime and hideTime attribute f…
Browse files Browse the repository at this point in the history
…or elements
  • Loading branch information
evanping committed Sep 24, 2024
1 parent 235de41 commit 1881685
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 10 deletions.
1 change: 1 addition & 0 deletions @empirica-mocks/core/mocks.js
Original file line number Diff line number Diff line change
Expand Up @@ -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: {
Expand Down
6 changes: 6 additions & 0 deletions src/app/editor/components/RenderPanel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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 (
<div className="flex" data-cy="render-panel">
{currentStageIndex === 'default' && (
Expand Down
20 changes: 10 additions & 10 deletions src/app/editor/stageContext.jsx
Original file line number Diff line number Diff line change
@@ -1,35 +1,35 @@
//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,
setCurrentStageIndex,
elapsed,
setElapsed,
treatment,
setTreatment
};
setTreatment,
}

return (
<StageContext.Provider value={contextValue}>
{children}
</StageContext.Provider>
);
};
)
}

export { StageContext, StageProvider };
export { StageContext, StageProvider }

// import React, { createContext, useState, useContext } from 'react';

Expand Down

0 comments on commit 1881685

Please sign in to comment.