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

Changed Enter button icon and fixed sensitivity issues #4698

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

GauravVBhambhani
Copy link

@GauravVBhambhani GauravVBhambhani commented Mar 17, 2025

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:

  • the button is active sometimes when it shouldn't be (when there's no user input).
  • the styling of the button makes it appear insensitive sometimes, even when it's active.

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

Screenshot 2025-03-17 at 3 27 13 PM Screenshot 2025-03-17 at 3 26 35 PM

Granite.Code Issue #32

@GauravVBhambhani GauravVBhambhani requested a review from a team as a code owner March 17, 2025 19:40
@GauravVBhambhani GauravVBhambhani requested review from RomneyDa and removed request for a team March 17, 2025 19:40
Copy link

netlify bot commented Mar 17, 2025

Deploy Preview for continuedev canceled.

Name Link
🔨 Latest commit a94727f
🔍 Latest deploy log https://app.netlify.com/sites/continuedev/deploys/67d99df5f10b970008cc22a0

Copy link
Contributor

@halfline halfline left a 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:

  1. The styling of the button makes it sometimes appear insensitive when when it's active
  2. 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">
Copy link
Contributor

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?

Copy link
Author

@GauravVBhambhani GauravVBhambhani Mar 18, 2025

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.

Copy link
Author

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}
Copy link
Contributor

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?

Copy link
Author

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.

Comment on lines 231 to 232
props.hasText
? "text-[var(--vscode-editorForeground)]"
Copy link
Contributor

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.

Copy link
Author

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.

Copy link
Contributor

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

@halfline
Copy link
Contributor

halfline commented Mar 18, 2025

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.

❯ git reset HEAD~2

❯ git commit -a -m "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."

❯ git push --force 

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.
@GauravVBhambhani GauravVBhambhani force-pushed the send-button-sensitivity-updates branch from c868ce8 to a94727f Compare March 18, 2025 16:23
@halfline
Copy link
Contributor

lgtm

@sestinj
Copy link
Contributor

sestinj commented Mar 20, 2025

@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?

@halfline
Copy link
Contributor

Obivously, your call, Nate, but just for completeness I want to make my case and try to change your mind 😉

My arguments:

  • From a UX perspective it's better if the button represents what the action does, i.e.g, "send out the message", not what keybinding is associated with the action.
  • ⏎ is an old metaphor that rarely appears on keyboards anymore (not quite as archaic as using 💾 for save icon, but close)
  • None of Co-Pilot, ChatGPT, meta.ai, gemini, molmo. or claude.ai use the ⏎ . they all use either a straight arrow or an airplane. (cursor follows suit though)

What would you think about using a straight arrow instead? Or what about if a clear background was used?

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.

3 participants