-
Notifications
You must be signed in to change notification settings - Fork 3.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
#42 Adding popover to flag text with labels #189
#42 Adding popover to flag text with labels #189
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a great start. I added some small cleanup requests then I'll approve.
|
||
export type TextFlagProps = { | ||
text: string; | ||
label_map; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
label_map: Record<string, string>
?
import { QuestionMarkCircleIcon, FlagIcon } from "@heroicons/react/20/solid"; | ||
import { useState } from "react"; | ||
|
||
export type TextFlagProps = { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is not referenced anywhere?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have removed it now!
let label_map: Map<string, number> = new Map(); | ||
label_refs | ||
.filter((flagRef) => flagRef.isChecked) | ||
.map((refs) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe you want forEach
? or replacee the entire thing with reduce
?
labelText: string; | ||
additionalExplanation?: string; | ||
} | ||
const TEXT_LABEL_FLAGS: textFlagLabels[] = [ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is the same as in rate_summary.tsx
right? should we extract it to some shared variable?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the simpler thing to do is in a follow up PR delete the code in rate_summary.tsx
when this component is added to it.
Assuming that a follow on PR will use this component in each of the tasks, this looks good once pre-commits are green. |
@BitterKanegul run |
567fc25
to
e81c3cd
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
npm run build
reports a few warnings and errors. Please make sure those are fixed and no warnings or errors are reported.
const [checkboxValues, setCheckboxValues] = useState(new Array(TEXT_LABEL_FLAGS.length).fill(false)); | ||
const [sliderValues, setSliderValues] = useState(new Array(TEXT_LABEL_FLAGS.length).fill(1)); | ||
|
||
const fetchData = () => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
small detail, does this need to be a separate function? It seems to only be called when calling submitResponse. We could simplify this by putting it all in submitResponse
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thank you! I've added the same and ran precommit and npm run build. No issues now!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great start! I look forward to seeing this show up in the other tasks
No description provided.