feat: 015 — delete focus from tray - #13
Conversation
Each focus item in the tray menu is now a Submenu. Hovering the focus title reveals a "Delete \"<title>\"…" item. Clicking it shows a native macOS confirmation dialog (tauri-plugin-dialog); confirming calls delete_focus, removing the directory. The file watcher then fires and the tray rebuilds + pig disappears within 1s. - tauri-plugin-dialog added; registered in app setup - Focus items replaced with Submenus containing a delete item per focus - Delete event handler spawns a background thread: looks up title from managed state, shows blocking confirm dialog, then calls delete_focus
|
Caution Review failedThe pull request is closed. ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: ASSERTIVE Plan: Pro Plus Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughAdds ChangesDelete Focus from Tray Menu
Sequence Diagram(s)sequenceDiagram
participant Tray as Tray Menu
participant App as Main App (Tauri)
participant Dialog as tauri_plugin_dialog
participant Cmds as CommandsState
Tray->>App: Menu event "tray-delete-{id}"
App->>App: spawn thread -> call handle_delete(id)
App->>Cmds: query focus title for {id}
App->>Dialog: blocking confirm("Delete Focus?", message, buttons)
Dialog-->>App: user confirms / cancels
alt confirmed
App->>Cmds: delete_focus(&id)
Cmds-->>App: delete result (ok / err)
App->>Tray: rebuild menu (focuses-changed triggered by watcher)
else cancelled
App-->>Tray: no action
end
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Review rate limit: 9/10 reviews remaining, refill in 6 minutes. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@src-tauri/src/app/tray.rs`:
- Around line 138-142: The call to state.0.delete_focus(&focus_id) currently
discards its Result; update the confirmed block so you capture the Result from
CommandsState::delete_focus and log or surface any Err (e.g., using the same
logging approach used in ui_bridge::delete_focus/inspect_err) so failures
(filesystem errors or not-found) are recorded; locate the call inside the if let
Some(state) = app.try_state::<crate::ui_bridge::CommandsState>() block and
replace the ignored let _ = ... with handling that logs the error (including
focus_id/context) instead of silently dropping it.
🪄 Autofix (Beta)
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: Organization UI
Review profile: ASSERTIVE
Plan: Pro Plus
Run ID: 5e6c1428-877f-4399-9d99-d7c1615ac6b4
⛔ Files ignored due to path filters (1)
Cargo.lockis excluded by!**/*.lock
📒 Files selected for processing (3)
src-tauri/Cargo.tomlsrc-tauri/src/app/mod.rssrc-tauri/src/app/tray.rs
Summary
Submenu; hovering the title shows an arrowtauri-plugin-dialog)delete_focuscommand → directory removed → file watcher fires → tray rebuilds + pig disappears within 1sImplementation notes
tauri-plugin-dialog = "2"added to Cargo.toml and registered in app setuphandle_deleteruns in a spawned thread (not the menu event dispatch thread) to allow blocking dialog APICommandsStatebefore showing dialog (gives a human-readable confirmation message)tray-delete-<focus_id_string>is stored in the menu item IDTest plan
task checkgreen (CI)Closes #8
Summary by CodeRabbit