-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
Changed Enter button icon and fixed sensitivity issues #4698
base: main
Are you sure you want to change the base?
Changed Enter button icon and fixed sensitivity issues #4698
Conversation
✅ Deploy Preview for continuedev canceled.
|
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.
So, I haven't tried it yet, but to me, in a cursory review this looks pretty good.
Beefing up the state management for hasText seems like good idea, but don't know what Dallin/Nate's takes are.
I would improve the commit message a bit...maybe something like:
chat: Improve look and feel of enter button
The chat view for continue currently features a submit button that looks like an enter key icon.
This metaphor isn't ideal, since many keyboards these days don't use that icon. Furthermore, there are some sensitivity issues:
- The styling of the button makes it sometimes appear insensitive when when it's active
- The button is active sometimes when it shouldn't be (when there is no user input).
This commit addresses those issues, by switching to a more modern airplane icon instead of a return key icon, using vscode theme colors for styling, and marking the button insensitive when there is no user input, respectively.
⏎ {props.toolbarOptions?.enterText ?? "Enter"} | ||
</span> | ||
<span className="md:hidden">⏎</span> | ||
<div data-tooltip-id="submit-tooltip"> |
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.
is there a reason this needs to be a div and not a span?
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 chose a div in this case because it naturally behaves as a block-level element so the tooltip is correctly positioned. But, I can use a span as well. I might have to add a inline-block style for proper layout. I'll test it out.
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.
Nevermind, works the same without any additional styling. Changed to span.
@@ -1015,6 +1015,7 @@ function TipTapEditor(props: TipTapEditorProps) { | |||
}); | |||
}} | |||
disabled={isStreaming} | |||
hasText={editor ? editor.getText().trim().length > 0 : false} |
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.
instead of doing this here, can you just put hasText={hasText}
and then do:
const [hasText, setHasText] = useState(false);
useEffect(() => {
...
if (!editor) return;
const updateEditorHandler = () => {
const text = editor.getText().trim();
setHasText(text.length > 0);
};
const clearUpdateEditorHandler = () => {
editor.off("update", clearUpdateHandler);
}
updateEditorHandler();
return clearUpdateEditorHandler;
}
...
or something like that, so it tracks state more robustly?
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.
Sure! I'll look into it.
props.hasText | ||
? "text-[var(--vscode-editorForeground)]" |
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.
you have some trailing whitespace here I think.
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.
That's just to make it more readable.
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.
you already have line breaks for readability... i'm talking about after prop.hasText
there's a space before the line break. same with at the end of the ? "text-..."
line
this looks good to me. only other change I would recommend (aside from the whitespace nit above) is squashing the two commits together and using something like my proposed commit message for clarity.
or similar |
The chat view for continue currently features a submit button that looks like an enter key icon. This metaphor isn't ideal, since many keyboards these days don't use that icon. Furthermore, there are some sensitivity issues: - The styling of the button makes it sometimes appear insensitive when it's active. - The button is active sometimes when it shouldn't be (when there is no user input). This commit addresses those issues, by switching to a more modern airplane icon instead of a return key icon, using VSCode theme colors for styling, and marking the button insensitive when there is no user input.
c868ce8
to
a94727f
Compare
lgtm |
@GauravVBhambhani thanks for taking the time to make this PR, and @halfline for the preliminary review! The change in button icon and size is not something we will be willing to merge, as it appears a bit clunkier than we would wish for, however the sensitivity issues would be important to solve. Would you be interested in making those updates in a separate PR, or just adjusting this one to remove the change in appearance? |
Obivously, your call, Nate, but just for completeness I want to make my case and try to change your mind 😉 My arguments:
What would you think about using a straight arrow instead? Or what about if a clear background was used? |
Description
Chat view: Improve look and feel of the enter button
The chat view for continue currently consists of a Send(Enter) button that looks like an enter key icon (↵), which isn't ideal as many keyboards don't use that icon anymore.
Furthermore, there are some sensitivity issues:
This commit addresses these issues, by switching to a more modern airplane icon, using vscode theme colors for styling.
Marking the button insensitive when there's no user input.
Screenshots
Granite.Code Issue #32