Skip to content

Macros tab "Move To Group" context menu command#530

Merged
Reetus merged 2 commits intomasterfrom
macros-tab-move-to-group-command
Nov 9, 2025
Merged

Macros tab "Move To Group" context menu command#530
Reetus merged 2 commits intomasterfrom
macros-tab-move-to-group-command

Conversation

@Reetus
Copy link
Owner

@Reetus Reetus commented Nov 9, 2025

Summary by CodeRabbit

  • New Features

    • Added a "Move to group" context-menu option to move macro entries between groups for improved organisation and selection handling.
  • Refactor

    • Reworked converter references and resource wiring to use a central value-converter resource, simplifying UI resource resolution and consistency.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Nov 9, 2025

Walkthrough

DraggableGroupVisibilityValueConverter was moved to a new namespace; a MoveToGroupCommand and supporting selection/move logic were added to MacrosTabViewModel; XAML resources and a context-menu item were updated in AutolootTabControl.xaml and MacrosTabControl.xaml to reference the converter and wire the new command.

Changes

Cohort / File(s) Summary
Value Converter Namespace Reorganisation
ClassicAssist/UI/Misc/ValueConverters/DraggableGroupVisibilityValueConverter.cs
Changed namespace from ClassicAssist.UI.Views.Agents.Autoloot to ClassicAssist.UI.Misc.ValueConverters. No other code changes.
ViewModel — Move-to-Group Logic
ClassicAssist/UI/ViewModels/MacrosTabViewModel.cs
Added _moveToGroupCommand backing field and public MoveToGroupCommand (ICommand). Implemented MoveToGroup() to relocate a selected MacroEntry into a target MacroGroup, update its Group property, mutate source/target collections, and call SetNewSelectedIndex(); added SetNewSelectedIndex(int) and GetNewSelectedIndex(MacroEntry) selection helpers.
XAML — Converter & Context Menu Wiring
ClassicAssist/UI/Views/Agents/AutolootTabControl.xaml, ClassicAssist/UI/Views/MacrosTabControl.xaml
Switched DraggableGroupVisibilityValueConverter resource type usage in AutolootTabControl.xaml from autoloot2:... to ValueConverters:.... Added DraggableGroupVisibilityConverter resource in MacrosTabControl, inserted a context-menu Separator and Move_to_group MenuItem bound to MoveToGroupCommand with visibility driven by the converter and command parameter bound to the target group/item.

Sequence Diagram

sequenceDiagram
    participant User
    participant UI as MacrosTabControl
    participant VM as MacrosTabViewModel
    participant Src as SourceCollection
    participant Dst as TargetGroup.Children

    User->>UI: Right-click MacroEntry
    UI->>UI: Evaluate DraggableGroupVisibilityConverter
    User->>UI: Select "Move to group" (passes target group)
    UI->>VM: Execute MoveToGroupCommand(targetGroup)
    VM->>Src: Remove MacroEntry (if in a group use old group's Children else Draggables)
    VM->>VM: Set MacroEntry.Group = targetGroup
    VM->>Dst: Add MacroEntry to targetGroup.Children
    VM->>VM: newIndex = GetNewSelectedIndex(oldItem)
    VM->>VM: SetNewSelectedIndex(newIndex)
    VM->>UI: Notify UI of collection/selection changes
    UI->>User: Updated tree shows item in new group
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

  • Check selection index calculations and edge cases in GetNewSelectedIndex() / SetNewSelectedIndex().
  • Verify MoveToGroup() correctly removes from the original container (group vs root) and updates collections/events.
  • Confirm XAML resource namespace change resolves at runtime and that MoveToGroupCommand parameter binding passes the expected target group/item.

Possibly related PRs

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately describes the main change: adding a 'Move To Group' context menu command to the Macros tab, which is reflected throughout the changeset.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch macros-tab-move-to-group-command

📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between c3d76ed and 36052cf.

📒 Files selected for processing (1)
  • ClassicAssist/UI/ViewModels/MacrosTabViewModel.cs (4 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • ClassicAssist/UI/ViewModels/MacrosTabViewModel.cs
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: build

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between caef415 and c3d76ed.

📒 Files selected for processing (4)
  • ClassicAssist/UI/Misc/ValueConverters/DraggableGroupVisibilityValueConverter.cs (1 hunks)
  • ClassicAssist/UI/ViewModels/MacrosTabViewModel.cs (4 hunks)
  • ClassicAssist/UI/Views/Agents/AutolootTabControl.xaml (1 hunks)
  • ClassicAssist/UI/Views/MacrosTabControl.xaml (2 hunks)
🧰 Additional context used
🧠 Learnings (1)
📚 Learning: 2024-11-22T07:54:53.601Z
Learnt from: Reetus
Repo: Reetus/ClassicAssist PR: 473
File: ClassicAssist/UI/Views/Agents/Autoloot/PropertyGroupControl.xaml:19-28
Timestamp: 2024-11-22T07:54:53.601Z
Learning: In the Autoloot `PropertyGroupControl.xaml`, the `SelectedItem.Children` list is expected to be small, so UI virtualization is unnecessary.

Applied to files:

  • ClassicAssist/UI/Views/Agents/AutolootTabControl.xaml
🧬 Code graph analysis (1)
ClassicAssist/UI/ViewModels/MacrosTabViewModel.cs (3)
ClassicAssist/UI/ViewModels/Agents/AutolootViewModel.cs (3)
  • MoveToGroup (873-889)
  • GetNewSelectedIndex (912-935)
  • SetNewSelectedIndex (891-910)
ClassicAssist/Data/Macros/MacroGroup.cs (1)
  • MacroGroup (27-45)
ClassicAssist/Data/Macros/MacroEntry.cs (2)
  • MacroEntry (40-514)
  • MacroEntry (65-132)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: build
🔇 Additional comments (7)
ClassicAssist/UI/Misc/ValueConverters/DraggableGroupVisibilityValueConverter.cs (1)

26-26: LGTM! Clean namespace refactoring.

The move to a centralised ValueConverters namespace is appropriate and improves code organisation.

ClassicAssist/UI/Views/Agents/AutolootTabControl.xaml (1)

32-32: LGTM! Namespace reference updated correctly.

The resource declaration properly references the converter from its new namespace whilst maintaining the same resource key.

ClassicAssist/UI/Views/MacrosTabControl.xaml (2)

34-34: LGTM! Resource properly registered.

The converter resource is correctly added to support the new "Move to group" functionality.


127-163: LGTM! Well-structured context menu implementation.

The conditional visibility logic and command bindings follow existing patterns in the codebase and align with the AutolootTabControl implementation.

ClassicAssist/UI/ViewModels/MacrosTabViewModel.cs (3)

77-77: LGTM! Command properly declared and configured.

The MoveToGroupCommand is correctly set up with appropriate predicates to ensure SelectedItem exists and the parameter is a MacroGroup.

Also applies to: 207-207


1042-1061: LGTM! Selection management handles edge cases appropriately.

The exception handling prevents crashes when the calculated index is out of range, which is acceptable for this scenario.


1063-1088: LGTM! Index calculation logic is sound.

The method correctly returns 0 when the item is already in a group (no index adjustment needed) and calculates an appropriate selection index based on position when the item is at root level.

@sonarqubecloud
Copy link

sonarqubecloud bot commented Nov 9, 2025

@Reetus Reetus merged commit 6f35d34 into master Nov 9, 2025
4 checks passed
@Reetus Reetus deleted the macros-tab-move-to-group-command branch November 9, 2025 16:16
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.

1 participant