Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR adds a proper stop button to the AI menu and also updates the UX.
I ended up having to refactor the
PromptSuggestionMenu
component quite a bit, since I wasn't able to copy how Notion displays the loading indicator right after the "Thinking" text due to an annoying quirk of text inputs (see comment inPromptSuggestionMenu.tsx
for more info).To get around this, I made it so the
PromptSuggestionMenu
now has its ownleftSection
andrightSection
which are used for the AI icon on the left and pause button/error icon on the right. These have been moved out of the text input, as we now render aloader
element instead while theisLoading
prop is true.For the AI menu, the
loader
element consists of the same placeholder text and loading indicator that was previously in the text input. However, since the placeholder text is now in a regulardiv
, we can place the indicator right after it.This is quite a big workaround for the fact that text input width can't scale to the length of their content/placeholder, but unfortunately the CSS/JS workarounds I've found are all super hacky, whereas this refactor is imo at least somewhat sensible.
TODO: