Skip to content

Conversation

@hannesrudolph
Copy link
Collaborator

@hannesrudolph hannesrudolph commented Jul 28, 2025

Description

import.export.modes.mp4

Fixes #6320

This PR adds export/import functionality directly to the mode selector popover, allowing users to manage modes without navigating away from their current context.

Changes Made

  • Added Export Buttons: Each mode in the popover now has an export button that appears on hover

    • Uses the Upload icon from lucide-react
    • Shows loading state while exporting
    • Sends exportMode message to VSCode backend
  • Added Import Button: Added an import button in the popover footer

    • Styled to match existing IconButton components for perfect alignment
    • Uses the Download icon from lucide-react
    • Opens an import dialog when clicked
  • Import Dialog: Implemented inline import dialog matching ModesView pattern

    • Allows selection between project-level and global import
    • Shows loading state during import
    • Sends importMode message to VSCode backend
  • State Management: Added necessary state variables for tracking operations

    • isExporting: Tracks which mode is being exported
    • isImporting: Tracks import operation status
    • showImportDialog: Controls import dialog visibility

Testing

  • ✅ All existing ModeSelector tests pass (7 tests)
  • ✅ Export/import functionality uses the same message protocol as ModesView
  • ✅ Visual alignment verified - import button perfectly aligns with other footer buttons

Verification of Acceptance Criteria

  • ✅ Export button added for each mode (visible on hover)
  • ✅ Import button added to popover footer
  • ✅ Import dialog allows selection of import level (project/global)
  • ✅ Loading states implemented for both operations
  • ✅ Uses existing backend message handlers (no backend changes needed)
  • ✅ Maintains consistency with ModesView implementation

Screenshots/Demo

The import button is now perfectly aligned with the marketplace and settings buttons in the popover footer.

Checklist


Important

Adds export/import buttons to ModeSelector popover, enabling mode management directly from the UI with new state management and tests.

  • Behavior:
    • Adds export button to each mode in ModeSelector.tsx, visible on hover, using Upload icon.
    • Adds import button to popover footer, using Download icon, opens import dialog.
    • Import dialog allows project/global selection, shows loading state, and sends importMode message.
  • State Management:
    • Adds isExporting, isImporting, showImportDialog state variables in ModeSelector.tsx.
  • Testing:
    • New tests in ModeSelector.export-import.spec.tsx for export/import button visibility, message sending, and dialog behavior.
    • Tests handle success, error, and cancellation scenarios for both export and import.
  • Misc:
    • Uses existing backend message handlers, no backend changes needed.

This description was created by Ellipsis for b48e8c8. You can customize this summary. It will automatically update as commits are pushed.

Copilot AI review requested due to automatic review settings July 28, 2025 23:24
@hannesrudolph hannesrudolph requested review from cte, jr and mrubens as code owners July 28, 2025 23:24
@dosubot dosubot bot added size:L This PR changes 100-499 lines, ignoring generated files. enhancement New feature or request labels Jul 28, 2025
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR adds export and import functionality directly to the mode selector popover, allowing users to manage modes without leaving their current context. The implementation follows the existing ModesView pattern for consistency.

  • Added hover-triggered export buttons for each mode using the Upload icon
  • Added an import button to the popover footer that opens an inline dialog
  • Implemented state management for tracking export/import operations with loading states

@hannesrudolph hannesrudolph added the Issue/PR - Triage New issue. Needs quick review to confirm validity and assign labels. label Jul 28, 2025
@dosubot dosubot bot added size:XL This PR changes 500-999 lines, ignoring generated files. and removed size:L This PR changes 100-499 lines, ignoring generated files. labels Jul 28, 2025
- Add export button for each mode (visible on hover)
- Add import button in popover footer matching IconButton styling
- Implement import dialog with project/global level selection
- Add state management for export/import operations
- Handle message responses for export/import results
- Ensure perfect vertical alignment with existing buttons

Fixes #6320
- Replace raw button with IconButton component for consistency
- Add proper error handling with inline error messages
- Add aria-label to export button for accessibility
- Add unique IDs to radio inputs in import dialog
- Add comprehensive test coverage for export/import functionality
- Convert uncontrolled radio inputs to controlled components
- Add selectedImportLevel state to track selected import level
- Reset import level to default when dialog is closed
- Addresses Copilot review feedback about potential state inconsistency
- Change OR (||) to AND (&&) operator for conditional opacity classes
- Fixes issue where string operand would always be truthy
- Addresses additional Copilot review feedback
@hannesrudolph hannesrudolph force-pushed the feat/issue-6320-mode-selector-export-import branch from 5722bd1 to 63fcac7 Compare July 29, 2025 00:31
- Replace codicon-cloud-download with Download icon to match ModesView
- Update Button styling to match other footer buttons
- Update tests to check for SVG icon instead of codicon class
…ence

- Add check to ensure message event handler only processes relevant messages
- Prevents ModeSelector from interfering with integration test message handling
- This should fix the intermittent integration test timeouts
@hannesrudolph hannesrudolph moved this from Triage to PR [Needs Prelim Review] in Roo Code Roadmap Jul 29, 2025
@hannesrudolph hannesrudolph added PR - Needs Preliminary Review and removed Issue/PR - Triage New issue. Needs quick review to confirm validity and assign labels. labels Jul 29, 2025
daniel-lxs

This comment was marked as outdated.

Copy link
Member

@daniel-lxs daniel-lxs left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for your contribution! I've reviewed the changes and found that all the previous review comments have been successfully addressed. The implementation looks good overall with just 2 minor suggestions for improvement.

@daniel-lxs daniel-lxs moved this from PR [Needs Prelim Review] to PR [Changes Requested] in Roo Code Roadmap Jul 30, 2025
@hannesrudolph hannesrudolph self-assigned this Jul 30, 2025
@hannesrudolph hannesrudolph marked this pull request as draft July 30, 2025 20:49
@daniel-lxs daniel-lxs moved this from PR [Changes Requested] to PR [Draft / In Progress] in Roo Code Roadmap Jul 31, 2025
@github-project-automation github-project-automation bot moved this from New to Done in Roo Code Roadmap Aug 19, 2025
@github-project-automation github-project-automation bot moved this from PR [Draft / In Progress] to Done in Roo Code Roadmap Aug 19, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request PR - Draft / In Progress size:XL This PR changes 500-999 lines, ignoring generated files.

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

Mode Selector: Add export/import buttons to popover for quick mode management

3 participants