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

Add scores on request page #1957

Merged
merged 2 commits into from
May 20, 2024
Merged

Add scores on request page #1957

merged 2 commits into from
May 20, 2024

Conversation

maamalama
Copy link
Collaborator

Add scores on request page

Copy link

vercel bot commented May 17, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
helicone ✅ Ready (Inspect) Visit Preview 💬 Add feedback May 20, 2024 5:02pm

/>
</div>
</div>
<button
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: Use HcButton component

Key
</label>
<div className="">
<input
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: Use TextInput

Value
</label>
<div className="">
<input
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: see above

<div className="font-semibold text-gray-900 dark:text-gray-100 text-sm items-center flex">
Scores{" "}
<Tooltip title="Add a new score" placement="top">
<button
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: Use HcButton

return;
}
try {
const res = await addRequestScore(
Copy link
Contributor

Choose a reason for hiding this comment

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

Q: Can a request have more than 1 score? If im understanding right, the addRequestScore function adds a score to an array of scores?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@ScottMktn Yes, request can have multiple scores but user can add scores 1 by 1 like custom properties


if (currentScores && currentScores[key]) {
setNotification("Score already exists", "error");
setIsScoresAdding(false);
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: in the future, to avoid having to set states everything for loading, use useMutation

https://tanstack.com/query/v4/docs/framework/react/reference/useMutation

@ScottMktn
Copy link
Contributor

For next time, for frontend stuff, please post a screenshot so that it's slightly easier to test. But otherwise, code looks good!

@maamalama
Copy link
Collaborator Author

It's gonna look like this
image

@ScottMktn ScottMktn merged commit 9154ed1 into main May 20, 2024
8 of 9 checks passed
@ScottMktn ScottMktn deleted the request-add-scores branch May 20, 2024 17:16
chitalian pushed a commit that referenced this pull request Jun 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants