feat(wework): collapse composer plugin picker to an icon in conversation - #2506
Conversation
📝 WalkthroughWalkthroughAdds a reusable tooltip component for composer controls. Adds configurable icon-only plugin-picker rendering and forwards the setting through desktop and temporary chat composers. Adds tests for tooltip interactions and plugin-picker presentation. ChangesComposer UI improvements
Estimated code review effort: 3 (Moderate) | ~20 minutes Sequence Diagram(s)sequenceDiagram
participant DesktopWorkbenchMain
participant ChatInput
participant ProjectChatComposer
participant ComposerToolbar
participant PluginPickerMenu
DesktopWorkbenchMain->>ChatInput: Set pluginPickerIconOnly
ChatInput->>ProjectChatComposer: Forward pluginPickerIconOnly
ProjectChatComposer->>ComposerToolbar: Forward pluginPickerIconOnly
ComposerToolbar->>PluginPickerMenu: Enable iconOnly mode
PluginPickerMenu-->>ComposerToolbar: Render compact plugin-picker trigger
Possibly related PRs
Suggested reviewers: 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches 💡 2📝 Generate docstrings 💡
🛠️ Fix failing CI checks 💡
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@wework/src/components/ui/tooltip.tsx`:
- Around line 69-74: Update the tooltip popup className in
wework/src/components/ui/tooltip.tsx lines 69-74 to toggle pointer-events-auto
when visible while retaining pointer-events-none when hidden. Add or update the
visible-tooltip assertion in wework/src/components/ui/tooltip.test.tsx lines
14-37 to verify pointer events are enabled.
🪄 Autofix
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro Plus
Run ID: 49d63cdb-abb2-44bb-9945-a345d367b51e
📒 Files selected for processing (12)
wework/src/components/chat/ChatInput.tsxwework/src/components/chat/composer/AddContextMenu.tsxwework/src/components/chat/composer/ComposerToolbar.test.tsxwework/src/components/chat/composer/ComposerToolbar.tsxwework/src/components/chat/composer/PluginPickerMenu.test.tsxwework/src/components/chat/composer/PluginPickerMenu.tsxwework/src/components/chat/composer/ProjectChatComposer.tsxwework/src/components/chat/composer/QuickPhraseMenu.tsxwework/src/components/layout/DesktopWorkbenchMain.tsxwework/src/components/layout/workspace-panels/TemporaryChatPanel.tsxwework/src/components/ui/tooltip.test.tsxwework/src/components/ui/tooltip.tsx
| className={cn( | ||
| 'pointer-events-none absolute z-system-popover max-w-[20rem] whitespace-nowrap rounded-lg border border-border/70 bg-popover/95 px-2 py-1 text-sm leading-5 text-text-primary shadow-[0_10px_28px_rgba(0,0,0,0.18)] backdrop-blur-md transition-opacity duration-100', | ||
| visible ? 'opacity-100' : 'opacity-0', | ||
| sidePosition[side], | ||
| alignPosition[align] | ||
| )} |
There was a problem hiding this comment.
🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win
Keep visible tooltips hoverable.
Line 70 disables pointer events for the popup. When the popup is outside the trigger bounds, moving the pointer onto it dismisses the tooltip through onPointerLeave. Enable pointer events only while the popup is visible.
wework/src/components/ui/tooltip.tsx#L69-L74: Togglepointer-events-autowith visible state.wework/src/components/ui/tooltip.test.tsx#L14-L37: Assert that a visible tooltip enables pointer events.
Proposed fix
- visible ? 'opacity-100' : 'opacity-0',
+ visible ? 'pointer-events-auto opacity-100' : 'pointer-events-none opacity-0',📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| className={cn( | |
| 'pointer-events-none absolute z-system-popover max-w-[20rem] whitespace-nowrap rounded-lg border border-border/70 bg-popover/95 px-2 py-1 text-sm leading-5 text-text-primary shadow-[0_10px_28px_rgba(0,0,0,0.18)] backdrop-blur-md transition-opacity duration-100', | |
| visible ? 'opacity-100' : 'opacity-0', | |
| sidePosition[side], | |
| alignPosition[align] | |
| )} | |
| className={cn( | |
| 'pointer-events-none absolute z-system-popover max-w-[20rem] whitespace-nowrap rounded-lg border border-border/70 bg-popover/95 px-2 py-1 text-sm leading-5 text-text-primary shadow-[0_10px_28px_rgba(0,0,0,0.18)] backdrop-blur-md transition-opacity duration-100', | |
| visible ? 'pointer-events-auto opacity-100' : 'pointer-events-none opacity-0', | |
| sidePosition[side], | |
| alignPosition[align] | |
| )} |
📍 Affects 2 files
wework/src/components/ui/tooltip.tsx#L69-L74(this comment)wework/src/components/ui/tooltip.test.tsx#L14-L37
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@wework/src/components/ui/tooltip.tsx` around lines 69 - 74, Update the
tooltip popup className in wework/src/components/ui/tooltip.tsx lines 69-74 to
toggle pointer-events-auto when visible while retaining pointer-events-none when
hidden. Add or update the visible-tooltip assertion in
wework/src/components/ui/tooltip.test.tsx lines 14-37 to verify pointer events
are enabled.
背景
进入对话后,composer 里的插件入口仍然以展开形式显示“插件”文字和最多 3 个插件预览图标(超出显示 +N),占据工具栏空间。需求是:默认状态保持展开不变,只有开始对话以后才收成一个图标。
改动
ComposerToolbar新增pluginPickerIconOnly透传开关:进入对话(hasConversation)或临时对话面板时,把PluginPickerMenu收成单个 Puzzle 图标;默认(空启动台)仍保持“插件 + 预览图标”的展开形式。Tooltip组件(700ms 延迟,符合DESIGN.md6.6)。PluginPickerMenuiconOnly 渲染、ComposerToolbar对话后收起、Tooltiphover/Escape 行为。影响
验证
Summary by CodeRabbit
New Features
Tests