feat: add mode selector dropdown to chat input toolbar#325
Open
ccfco wants to merge 1 commit intoop7418:mainfrom
Open
feat: add mode selector dropdown to chat input toolbar#325ccfco wants to merge 1 commit intoop7418:mainfrom
ccfco wants to merge 1 commit intoop7418:mainfrom
Conversation
…#320, closes op7418#317) Multiple users reported they couldn't find the mode switching UI (Code/Plan). The backend (ChatView.handleModeChange + /api/chat/mode) already works, but there was no visible entry point in the chat input toolbar. Changes: - New ModeSelectorDropdown component (follows EffortSelectorDropdown pattern) - MessageInput: accept mode/onModeChange props, render selector in toolbar - ChatView: pass mode + handleModeChange down to MessageInput - i18n: add 'messageInput.modeLabel' key for en/zh Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
|
Someone is attempting to deploy a commit to the op7418's projects Team on Vercel. A member of the Team first needs to authorize it. |
There was a problem hiding this comment.
Pull request overview
Adds a visible “Mode” (Code/Plan) selector to the chat input toolbar so users can switch modes without needing a slash command, leveraging the existing ChatView.handleModeChange + /api/chat/mode backend support.
Changes:
- Introduce
ModeSelectorDropdowncomponent using the existingCommandListdropdown pattern. - Wire
mode/onModeChangethroughChatView -> MessageInputand render the selector in the input toolbar. - Add
messageInput.modeLabeli18n strings for EN/ZH.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| src/components/chat/ModeSelectorDropdown.tsx | New dropdown UI for selecting Code/Plan mode. |
| src/components/chat/MessageInput.tsx | Accepts mode/onModeChange props and renders the selector in the footer tools row. |
| src/components/chat/ChatView.tsx | Passes current mode and handleModeChange down to MessageInput. |
| src/i18n/en.ts | Adds translation for the mode group label (“Mode”). |
| src/i18n/zh.ts | Adds translation for the mode group label (“模式”). |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
You can also share your feedback on Copilot code review. Take the survey.
Comment on lines
+17
to
+19
| interface ModeSelectorDropdownProps { | ||
| currentMode: string; | ||
| onModeChange: (mode: string) => void; |
Comment on lines
+41
to
+43
|
|
||
| const labelKey = `messageInput.mode${currentMode.charAt(0).toUpperCase() + currentMode.slice(1)}` as TranslationKey; | ||
|
|
Comment on lines
+57
to
+59
| /** Current chat mode (code / plan) */ | ||
| mode?: string; | ||
| onModeChange?: (mode: string) => void; |
Comment on lines
+439
to
+440
| mode={mode} | ||
| onModeChange={handleModeChange} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
Closes #320, Closes #317
Multiple users reported they couldn't find the mode switching UI (Code / Plan). The backend already works (
ChatView.handleModeChange+/api/chat/modeAPI), but there was no visible entry point in the chat input toolbar.This PR adds a
ModeSelectorDropdownto the message input footer, following the same pattern as the existingEffortSelectorDropdown.Changes
src/components/chat/ModeSelectorDropdown.tsxsrc/components/chat/MessageInput.tsxmode/onModeChangeprops, render selector in toolbarsrc/components/chat/ChatView.tsxmode+handleModeChangedown to MessageInputsrc/i18n/en.tsmessageInput.modeLabelkeysrc/i18n/zh.tsmessageInput.modeLabelkeyHow it works
CommandList/CommandListItempattern componentsChatView(useState+handleModeChange)/api/chat/mode(SDKsetPermissionMode), same as the bridge/modecommandmodeandonModeChangeare both provided (backward compatible)Test plan
planpermission modeacceptEditspermission modenpm run testpasses (typecheck + unit tests)🤖 Generated with Claude Code