-
Notifications
You must be signed in to change notification settings - Fork 418
feat(ui): add keyboard shortcut hint to chat input #1408
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
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -74,6 +74,13 @@ export default function ChatInterface({ selectedAgentName, selectedNamespace, se | |
| }, | ||
| }); | ||
|
|
||
| const [shortcutKey, setShortcutKey] = useState("Ctrl"); | ||
| useEffect(() => { | ||
| if (/Mac|iPhone|iPad|iPod/.test(navigator.userAgent)) { | ||
| setShortcutKey("⌘"); | ||
| } | ||
| }, []); | ||
|
Comment on lines
+77
to
+82
|
||
|
|
||
| const { handleMessageEvent } = createMessageHandlers({ | ||
| setMessages: setStreamingMessages, | ||
| setIsStreaming, | ||
|
|
@@ -441,6 +448,7 @@ export default function ChatInterface({ selectedAgentName, selectedNamespace, se | |
| /> | ||
|
|
||
| <div className="flex items-center justify-end gap-2 mt-4"> | ||
| <span className="mr-auto text-xs text-muted-foreground">{shortcutKey}+Enter to send</span> | ||
| {isVoiceSupported && ( | ||
| <TooltipProvider> | ||
| <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.
The shortcut hint will render as "Ctrl" initially and then flip to "⌘" after mount on macOS, causing an avoidable extra render and a brief incorrect hint. Consider deriving the value in the
useStatelazy initializer (or auseMemo) so it’s correct on the first client render without needingsetShortcutKeyin an effect.