Skip to content

refactor(gui): simplify delete-confirm overlay logic and deduplicate clamping#129

Merged
StudentWeis merged 1 commit into
mainfrom
refactor/simplify-delete-confirm
May 12, 2026
Merged

refactor(gui): simplify delete-confirm overlay logic and deduplicate clamping#129
StudentWeis merged 1 commit into
mainfrom
refactor/simplify-delete-confirm

Conversation

@StudentWeis
Copy link
Copy Markdown
Owner

Summary

Simplifies the delete-confirm dialog integration by extracting shared helpers and using idiomatic GPUI patterns, with no behavior change.

Linked Issue

Closes #128

Changes

  • Add UiState::any_overlay_visible() method to replace duplicated clear_confirm_visible() || delete_confirm_visible() checks
  • Extract clamp_selection_after_delete() helper to deduplicate index-clamping logic in on_delete_record and confirm_pending_delete
  • Move cx.notify() inside !showed_confirm branch to avoid redundant notification when dialog already triggers one
  • Replace two-let if/else builder split in decorate_record_card with idiomatic .when(!overlay_visible, ...) chain

Testing

  • scripts/precheck.sh passes locally
  • New / updated tests cover the change

Self-Check

  • PR title follows Conventional Commits
  • No hardcoded user-facing strings — i18n keys added to all locale files
  • Errors defined with thiserror (no manual impl Display/Error)
  • No unrelated changes mixed in

…clamping

- Add UiState::any_overlay_visible() to replace scattered OR checks
- Extract clamp_selection_after_delete() to eliminate duplicated index logic
- Move cx.notify() inside !showed_confirm branch to avoid redundant notification
- Use .when() builder pattern in decorate_record_card instead of split let chain

Refs #128
@StudentWeis StudentWeis merged commit c391904 into main May 12, 2026
8 checks passed
@StudentWeis StudentWeis deleted the refactor/simplify-delete-confirm branch May 12, 2026 11:25
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.

refactor: simplify delete-confirm overlay logic and deduplicate clamping

1 participant