Watts-Lab / researcher-portal

deliberation lab collaborator tools
0 stars 0 forks source link

Allow for users to enter in reference data #79

Open shapeseas opened 1 month ago

shapeseas commented 1 month ago
JamesPHoughton commented 1 month ago

maybe steps:

  1. Add a reference data structure (starting empty) to the stageContext, use a useReducer pattern to create a function we can use to update values in the reference data structure
  2. probably also need a displayPosition variable in the reference sidebar(?) to select which player gets rendered in the display panel
  3. expose the setReferenceData reducer function and the setDisplayPosition function in the stageContext, along with their direct values
  4. expose a function from the context that gets player data for the given stage and position
  5. update the usePlayer hook mock to use the reference data from context.
acao22 commented 1 month ago

update for 10/10 meeting:

  1. I passed the treatment object as a parameter to the reference component in the sidebar so now it is no longer hardcoded and is correctly linked up with the preview. It's also filtered by stage (using stageIndex), and only shows the references for the current stage that the editor is on
  2. added a save button and handleInput function
  3. added a feature that pre-initializes a JSON structure with empty references for each stage and allows users to input values for these - after saving, the relevant stage in the JSON structure is updated w/ the newly entered reference values

note: each stage's references are kept independent, so the input values are stored and updated only for the current stage

Files changed:

Future steps:

I decided to hold off on making a PR until the json local storage is verified, but beyond that I think it should be mostly done. Let me know what people think and thanks!