EnCiv / undebate-ssp

Undebate Self Service Portal- Web portal where election administrators of democratically run organizations create undebates for their candidates and voters
Other
6 stars 9 forks source link

UndebatesList #21

Closed ddfridley closed 2 years ago

ddfridley commented 3 years ago
<UndebatesList
  className={}
  style={}
  electionObjs:={[]}
  onDone={{valid: true, value: id})=>{}}
>

electionObjs is an array like elections as defined in #46 onDone is a function to call when the user selects an election to administer, with one parameter {valid, value) where valid is always true in this case, and the value is the _id of the electionObj selected.

After someone creates Undebates, then the page shows a list of them like this: https://www.figma.com/file/yXrcMvg5EIwdLkHHxIdILh/Undebate?node-id=326%3A2268

image

The top bar of this will be UndebatesHeaderBar a parent component will render that, and this. So this component should ignore that part.

NavigationPanel has a lot of functions for getting the status of an election - and someone is working on #105 to pull those methods out into a separate module. You might copy what you need out of the file to get started with the idea of swicthing over to the module when it is ready. Also, if there are other status functions that are needed, plan to put those into the new module when it's ready.

NavigationPanel also shows how to use ElectionCategory to graphically show the status. The idea would be to either continue to use ElectionCategoy or to refactor it, so there is code common between ElectionCategory and what's used to render the status in UndebateList.

The story for this is going to need to generate several (3 to 5) electionObj's. Check out how the story for NavigationPanel is creating a base electionObj and then making changes to it.

ddfridley commented 2 years ago

I agree with not useMemo. I understand their concern, but electionObj is stable at the top unless it changes.

''Error: Rendered more hooks than during the previous render.'' happens you you have hooks inside of logic or for loops that cause the number of hooks executed with the component to be different on different renders. Has been a pain sometimes.

Fine to have highlight in a separate issue for later. Is there something easy do do instead?

We have an ambiguity that the 'submission' component is hendered to show the moderators submission and the 'submissions' (with the s at the end) component is renedered for candidate submissions. It would have been clearer to call them moderator_submission and candidate_submissions. Maybe we should make an issue for refactoring some of the names - there are many I think could be clearer and more consistent.

so without looking at the code - counting submissions should look at the candidate. But maybe I have to look at where it's used.

ice1080 commented 2 years ago

Ok ya in that case I believe that we do have an issue then, all of the candidate table stuff uses countSubmission methods instead of countSubmissions. I'll try to refactor all that as part of this issue, as my stories would have to be either wrong or I wouldn't be able to test.

ice1080 commented 2 years ago

Hey @ddfridley, for the search functionality, just confirming that the search bar at the top will only display after clicking the search magnifying glass, and that it will shift to the center of the screen instead of staying where it currently is?