Dion/task/71 eco s15 multiple choice for participants - #80
Conversation
… submit button, updates db and clears state
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
| } | ||
| `; | ||
|
|
||
| const CheckboxOptionParticipantStyled = styled.div<{ $selected: boolean }>` |
There was a problem hiding this comment.
this should be fixed, i changed styles but i cant test it without some templates and prompt options. I am not exactly sure how to add a participant into game and begin testing this. Perhaps we can look through on wednesday?
|
|
||
| type Props = { | ||
| options: PromptOption[]; | ||
| value: string[]; |
There was a problem hiding this comment.
Maybe you can make this a Set instead? might be easier to add and remove
There was a problem hiding this comment.
Hello! Do you mean to use a Set structure to hold values i.e. the participants responses?
Right now the structure is that if the user clicks an option (be it a selected option or non selected), it makes a new array and replaces parent state with the new copy. If we change to set, we will still have to make a new set and replace the parent state with the new set copy because React state updates should be immutable iirc. Hence im not really sure what benefits changing from string[] to set will bring?
To make it easier for search, adding and removing, I updated the toggle function to use a set structure u mentioned instead for cleaner code but it is still O(n) (same as prev implementation) because it needs to make a copy of the previous values.
Let me know if this is what you mean
… style fix for checkboxes, and set struct for onToggle


🦜 What's new in this PR
🦋 Description
Done with functionality and styling of participant flow page.
Integrated Dylan's saved answers onBlur as well.
🦧 Screenshots
Design

Answer sent when user clicks away from from the prompt box.

Updated rows in Supabase

🐸 How to review
open participant flow, type in answers check rows in supabase and check styling.
input some answers and submit and check whether supabase field appears. There should be 1 row per prompt response. If there are multiple rows i.e. checkboxes, there will be 1 prompt response row created per checked box.
🐙 Next steps
🐆 Relevant links
Online sources
🐁 Related PRs
CC: @eshabansiya