Skip to content
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

Conversation

BitterKanegul
Copy link
Contributor

No description provided.

Copy link
Collaborator

@fozziethebeat fozziethebeat left a 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.

@AbdBarho AbdBarho linked an issue Dec 31, 2022 that may be closed by this pull request

export type TextFlagProps = {
text: string;
label_map;
Copy link
Collaborator

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 = {
Copy link
Collaborator

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?

Copy link
Contributor Author

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) => {
Copy link
Collaborator

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[] = [
Copy link
Collaborator

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?

Copy link
Collaborator

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.

@fozziethebeat
Copy link
Collaborator

Assuming that a follow on PR will use this component in each of the tasks, this looks good once pre-commits are green.

@yk
Copy link
Collaborator

yk commented Jan 1, 2023

@BitterKanegul run pre-commit run --all-files until it passes to make the linters happy.

@BitterKanegul BitterKanegul force-pushed the 42-implement-text-labels-web-frontend branch from 567fc25 to e81c3cd Compare January 2, 2023 03:45
Copy link
Collaborator

@fozziethebeat fozziethebeat left a 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 = () => {
Copy link
Collaborator

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

Copy link
Contributor Author

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!

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

image

Copy link
Collaborator

@fozziethebeat fozziethebeat left a 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

@fozziethebeat fozziethebeat merged commit 2d98259 into LAION-AI:main Jan 2, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Implement Text Labels in web frontend
4 participants