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

Adds TagsSelect component to Predict component #59

Merged
merged 13 commits into from
Sep 24, 2024
Merged

Conversation

jonnyspicer
Copy link
Collaborator

Pull Request: Adds TagsSelect to Predict component

Related Issue

Asana ref

Changes Made

  • Added TagsSelect component to Predict component
  • Added custom styles prop for TagsSelect component
  • Updated styling of inner components for TagsSelect component
  • Updated questionSuggestionsButton to have "Suggestions" label rather than use lightbulb icon

Testing

Tested locally and in preview, for TagsSelect components in Predict, Question and Calibration components.

Copy link

vercel bot commented Sep 24, 2024

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

Name Status Preview Comments Updated (UTC)
forecast-bot ✅ Ready (Inspect) Visit Preview 💬 Add feedback Sep 24, 2024 6:29pm

@@ -447,11 +488,6 @@ export function Predict({
)}
</Transition>
</div>
{tagsPreview?.length > 0 && (
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Not really sure what this code was doing before, as it doesn't look like tagsPreview was ever getting updated

Copy link
Contributor

Choose a reason for hiding this comment

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

This was for if you used a hashtag in the question title to quick-add a tag. Probably we should remove that functionality as it is superseded by this select

Copy link
Contributor

@adam-binks adam-binks left a comment

Choose a reason for hiding this comment

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

Looks lovely in general! A few minor changes and most notably we should remove the existing #hashtag functionality before shipping this I think.

@@ -359,6 +359,10 @@ export function Predict({
}
}

// used to calculate width of TagsSelect menu
const containerRef = useRef<HTMLDivElement>(null);
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: ; should be removed by prettier

I use this as my cursor "Rules for AI", and find it doesn't generate semicolons: Always use typescript, React, Tailwind, daisy-ui, clsx, HeroIcons, and TRPC. No semicolons. Prefer useState to React.useState. Use typed reducers (inline type). Prefer inline function props.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Thanks, clearly I also have my format on save setup wrong, I'll fix both

: "opacity-80",
small && "btn-xs px-5",
"w-full resize-none rounded-md p-4 -mb-2 border-b bg-white",
"focus:outline-indigo-700 placeholder:text-neutral-400",
Copy link
Contributor

Choose a reason for hiding this comment

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

the outline on this when not focussed is thinner than our other input components, e.g. the resolve by and make prediction inputs below, maybe increase it to match (and so it looks more input-y)? Or could up the outline on the parent div maybe, whatever you think looks best

image

ref={mergeRefs([textAreaRef, formRef])}
/>
<div className="flex flex-row items-center p-2 sm:px-4 gap-1 z-20">
<TagsSelect
Copy link
Contributor

Choose a reason for hiding this comment

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

minor: It's a bit strange that the add new icon is not full width, not a big deal though. Maybe could make the background of the empty space be the same grey so it looks a bit more like it spans the full width?
image

@@ -447,11 +488,6 @@ export function Predict({
)}
</Transition>
</div>
{tagsPreview?.length > 0 && (
Copy link
Contributor

Choose a reason for hiding this comment

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

This was for if you used a hashtag in the question title to quick-add a tag. Probably we should remove that functionality as it is superseded by this select

@@ -109,6 +119,84 @@ export function TagsSelect({
// 2px box shadow
Copy link
Contributor

Choose a reason for hiding this comment

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

We could improve this by using the classNames prop instead of styles, so we can use tailwind styles and keep it consistent with the rest of our styles. Notably could use max-sm instead of doing manual media breakpoints. Probably not worth switching costs unless Claude can ~one-shot it! https://react-select.com/styles#the-classnames-prop

…t component, updates TagsSelect component to only use a single column menuList during tag creation
@adam-binks
Copy link
Contributor

bug: When I submit a prediction, keep the tags and submit another, the tags stay visually in the select but aren't applied to the second prediction

  • maybe because the form state is reset but that doesn't change the react-select?
  • I think we should keep the tags after submission as we discussed, so IMO the bug is just that they're not applied to the second forecast

@adam-binks
Copy link
Contributor

minor: the outline when focussed doesn't match (it's thinner)
image
image
image

@jonnyspicer jonnyspicer merged commit ed6b0f2 into main Sep 24, 2024
3 checks passed
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