Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Click on MEAC/interaction plot should ask the user to remove the plot#235

Merged
daattali merged 4 commits into
masterfrom
issue-230
May 2, 2026
Merged

Click on MEAC/interaction plot should ask the user to remove the plot#235
daattali merged 4 commits into
masterfrom
issue-230

Conversation

@daattali
Copy link
Copy Markdown
Collaborator

@daattali daattali commented May 2, 2026

Summary by CodeRabbit

  • New Features

    • MEAC and Interaction plots can now be removed via single-click confirmation modal.
  • Style

    • Removed fade animation from intro modal for improved responsiveness.

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 2, 2026

📝 Walkthrough

Walkthrough

This PR adds confirmation modal dialogs for removing MEAC and Interaction plots from the visualization. Single-click now triggers a removal confirmation modal for these plot types, while double-click is ignored. The hit-testing logic for determining clicked plot identity has been updated to use yaxis panel mappings.

Changes

Plot Removal Confirmation Flow

Layer / File(s) Summary
Data Shape & Configuration
R/app_globals.R
bookmarksToExclude extended with "confirmRemoveMEAC" and "confirmRemoveInteraction" bookmark IDs.
Click Handling & Hit-Testing
R/app_server.R (lines 761–777, 678–707)
imgDrugTime() now derives plot identity from e$panelvar1 via yaxis mapping. Single-click opens removal modal for MEAC/Interaction; double-click no-ops for these plots.
Modal & Confirmation Logic
R/app_server.R (lines 789–822)
showRemoveAddedPlotModal(plot) helper and observers for input$confirmRemoveMEAC and input$confirmRemoveInteraction update addedPlots upon confirmation.
UI Polish
R/server-helpers.R
Removed fade = TRUE from showIntroModal() modal configuration.

Sequence Diagram

sequenceDiagram
    participant User
    participant ClickHandler as Single-Click Handler
    participant Modal as Removal Modal
    participant Observer as Confirmation Observer
    participant Plot as addedPlots State

    User->>ClickHandler: Click on MEAC/Interaction plot
    ClickHandler->>ClickHandler: Parse drug from panelvar1 & yaxis
    ClickHandler->>Modal: Invoke showRemoveAddedPlotModal(plot)
    Modal->>User: Display "Remove <plot> plot?" dialog
    User->>Modal: Confirm removal
    Modal->>Observer: Trigger input$confirmRemove<Plot>
    Observer->>Plot: Remove plot from addedPlots
    Plot->>User: Visualization updates
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related issues

Possibly related PRs

Suggested labels

DEPLOY


🐰 A plot to remove, a modal to show,
Click once and confirm if you wish to let go,
MEAC and Interaction fade from the view,
Double-click does nothing—hop through and through!

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 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: implementing a confirmation modal when users click on MEAC/interaction plots to remove them, which is the core functionality added across the modified files.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch issue-230

Review rate limit: 9/10 reviews remaining, refill in 6 minutes.

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

Copy link
Copy Markdown

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request introduces the ability to remove 'MEAC' and 'Interaction' plots through a new confirmation modal and updates the plot identification logic. Additionally, the fade effect has been removed from several modal dialogs across the application. Review feedback suggests adding a null check for e$panelvar1 to prevent potential crashes when clicking non-faceted areas and refactoring duplicated observeEvent logic using lapply for better maintainability.

Comment thread R/app_server.R
Comment thread R/app_server.R
@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 2, 2026

Preview Deployment

This PR has been deployed to: https://steveshafer.shinyapps.io/stanpumpr_PR_235/

This deployment will be automatically cleaned up when the PR is closed.

Copy link
Copy Markdown

@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

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@R/app_server.R`:
- Around line 761-768: In imgDrugTime(), guard access to e$panelvar1 before
calling gsub: if e$panelvar1 is NULL, return early or set yaxis to
plottedDrugs[1] (matching the pattern used in xy_str()); then derive drug from
yaxis as currently done. Specifically, add a null-check for e$panelvar1 prior to
computing yaxis (the variable used in the current gsub call) so that gsub is
never called on NULL and the fallback plottedDrugs[1] is used when panelvar1 is
missing.
🪄 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: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: a5c20de4-7f89-4b36-8f74-c4ae9e583931

📥 Commits

Reviewing files that changed from the base of the PR and between e5a691d and a8720ab.

📒 Files selected for processing (3)
  • R/app_globals.R
  • R/app_server.R
  • R/server-helpers.R
💤 Files with no reviewable changes (1)
  • R/server-helpers.R

Comment thread R/app_server.R
@daattali daattali merged commit 844502c into master May 2, 2026
7 checks passed
@github-actions github-actions Bot removed the DEPLOY label May 2, 2026
@daattali daattali deleted the issue-230 branch May 2, 2026 22:00
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.

Click on MEAC/interaction plot should ask the user to remove the plot. Ignore double click

2 participants