Skip to content

Feat:Add Warning modals#453

Open
Reva2473 wants to merge 1 commit into
Kuldeeep18:mainfrom
Reva2473:Warning-modal
Open

Feat:Add Warning modals#453
Reva2473 wants to merge 1 commit into
Kuldeeep18:mainfrom
Reva2473:Warning-modal

Conversation

@Reva2473

@Reva2473 Reva2473 commented Jun 24, 2026

Copy link
Copy Markdown

Pull Request

🔗 Related Issue

Closes #448


📝 Summary of Changes

Added validation checks and modals to the campaign activation toggle to prevent activating incomplete or empty campaigns.

  • Added an Activation Error Modal to prevent campaign activation if the sequence has 0 steps.
  • Added a Confirm Activation Warning Modal to display a confirmation prompt if the campaign has 0 enrolled leads.
  • Updated the #status-toggle event listener logic in campaign-builder.html to trigger these modals appropriately.
  • Fixed a JavaScript syntax error (missing backticks in template literals) within the renderFlowchart function.

🏷️ Type of Change

  • 🐛 Bug fix
  • ✨ New feature
  • ♻️ Refactor
  • 📝 Documentation update
  • 🎨 UI / Style change
  • 🔧 Chore

🧪 Testing

Steps to test:

  1. Open the LeadOrbit frontend and navigate to the Campaign Builder
  2. Test Steps Modal: Without adding any steps to the sequence click the Status Toggle in the top right. Verify that the "Activation Error" modal appears.
  3. Test Leads Modal: Add at least one step to the sequence, but leave the enrolled leads at 0. Click the Status Toggle again. Verify that the "Confirm Activation" warning modal appears.
  4. Test Activation: Click "Yes, activate" in the warning modal and verify that the campaign toggle successfully switches to the "ON" (green) state.

📸 Screenshots (if applicable)

cannot activate campaign 0 active lead yes click

✅ Checklist

  • No merge conflicts
  • Changes follow the project guidelines
  • Documentation updated (if applicable)
  • Related issue linked
  • Changes tested locally (if applicable)

Summary by CodeRabbit

  • New Features

    • Added activation checks that block campaigns with no sequence steps.
    • Added a confirmation prompt when activating a campaign with zero selected leads.
  • Bug Fixes

    • Improved flowchart rendering so step nodes and click actions work correctly.
    • Fixed condition step handling to support multiple step type variants.

@coderabbitai

coderabbitai Bot commented Jun 24, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Walkthrough

Two Bootstrap modals are added to frontend/campaign-builder.html to gate campaign activation: one blocking when no sequence steps exist, and one confirming activation with zero enrolled leads. The #status-toggle handler is updated to enforce these checks, and Mermaid flowchart node ID generation and condition-type matching are corrected.

Changes

Activation Gating Modals and Flowchart Fixes

Layer / File(s) Summary
Activation gating modal markup
frontend/campaign-builder.html
Adds the "Cannot Activate" modal (shown when steps count is 0) and the "Confirm Activation" modal (shown when enrolled leads count is 0), including the #confirm-activation-btn to proceed.
Status-toggle guard logic
frontend/campaign-builder.html
Updates the #status-toggle click handler to show the cannot-activate modal when steps.length === 0 and the confirm-activation modal when selectedLeadIds.size === 0, wiring #confirm-activation-btn to finalize the toggle and re-render the launch tab.
Mermaid flowchart node ID and condition-type fix
frontend/campaign-builder.html
Corrects Mermaid graph generation to use `step${i}` template-literal node IDs, handle both condition and CONDITION step type strings for condition node rendering, and emit correct per-node openStepDetail click handlers.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

  • Kuldeeep18/LeadOrbit#308: Modifies the same Mermaid flowchart rendering section in frontend/campaign-builder.html, specifically around step${i} node IDs, condition/CONDITION type handling, and per-node click handlers.

Suggested labels

frontend, type:feature, type:design

Poem

🐇 Hop! No steps? The modal blocks the way,
Zero leads? A gentle warning saves the day.
Mermaid charts now know their step IDs right,
Condition nodes glow with corrected light.
LaunchOrbit safely, every campaign tight! 🚀

🚥 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 is concise and accurately highlights the warning modals added to campaign activation.
Linked Issues check ✅ Passed The PR adds activation guards for both 0 steps and 0 leads as required by #448.
Out of Scope Changes check ✅ Passed No obvious out-of-scope changes appear; the flowchart edits align with the stated renderFlowchart syntax fix.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

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

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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

@Reva2473

Copy link
Copy Markdown
Author

Hi @Kuldeeep18, Please review and merge this PR.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

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 current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@frontend/campaign-builder.html`:
- Around line 1230-1253: Add accessible naming and title linkage for both modal
dialogs: give the close buttons in activationErrorModal and
activationWarningModal an accessible label, and connect each modal to its
heading via aria-labelledby using the existing modal-title elements. Update the
modal root elements and the btn-close controls so screen readers can identify
the dialog purpose and the close action without relying on visual text.
🪄 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: a6642162-b6e9-4b58-9b9b-13b9fff9f17d

📥 Commits

Reviewing files that changed from the base of the PR and between 4a33158 and db3b503.

📒 Files selected for processing (1)
  • frontend/campaign-builder.html

Comment on lines +1230 to +1253
<div class="modal fade" id="activationErrorModal" tabindex="-1">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title">Cannot Activate</h5>
<button type="button" class="btn-close" data-bs-dismiss="modal"></button>
</div>
<div class="modal-body">
Cannot activate campaign with no sequence steps.
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-bs-dismiss="modal">Close</button>
</div>
</div>
</div>
</div>

<div class="modal fade" id="activationWarningModal" tabindex="-1">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title">Confirm Activation</h5>
<button type="button" class="btn-close" data-bs-dismiss="modal"></button>
</div>

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

Add accessible labels/relationships to both modals.

The close buttons (Line 1235, Line 1252) have no accessible name, and the modals are missing aria-labelledby linkage to titles, which hurts screen-reader usability.

Suggested patch
-<div class="modal fade" id="activationErrorModal" tabindex="-1">
+<div class="modal fade" id="activationErrorModal" tabindex="-1" aria-labelledby="activationErrorModalLabel" aria-hidden="true">
@@
-        <h5 class="modal-title">Cannot Activate</h5>
-        <button type="button" class="btn-close" data-bs-dismiss="modal"></button>
+        <h5 class="modal-title" id="activationErrorModalLabel">Cannot Activate</h5>
+        <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
@@
-<div class="modal fade" id="activationWarningModal" tabindex="-1">
+<div class="modal fade" id="activationWarningModal" tabindex="-1" aria-labelledby="activationWarningModalLabel" aria-hidden="true">
@@
-        <h5 class="modal-title">Confirm Activation</h5>
-        <button type="button" class="btn-close" data-bs-dismiss="modal"></button>
+        <h5 class="modal-title" id="activationWarningModalLabel">Confirm Activation</h5>
+        <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
<div class="modal fade" id="activationErrorModal" tabindex="-1">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title">Cannot Activate</h5>
<button type="button" class="btn-close" data-bs-dismiss="modal"></button>
</div>
<div class="modal-body">
Cannot activate campaign with no sequence steps.
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-bs-dismiss="modal">Close</button>
</div>
</div>
</div>
</div>
<div class="modal fade" id="activationWarningModal" tabindex="-1">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title">Confirm Activation</h5>
<button type="button" class="btn-close" data-bs-dismiss="modal"></button>
</div>
<div class="modal fade" id="activationErrorModal" tabindex="-1" aria-labelledby="activationErrorModalLabel" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="activationErrorModalLabel">Cannot Activate</h5>
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
</div>
<div class="modal-body">
Cannot activate campaign with no sequence steps.
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-bs-dismiss="modal">Close</button>
</div>
</div>
</div>
</div>
<div class="modal fade" id="activationWarningModal" tabindex="-1" aria-labelledby="activationWarningModalLabel" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="activationWarningModalLabel">Confirm Activation</h5>
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
</div>
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@frontend/campaign-builder.html` around lines 1230 - 1253, Add accessible
naming and title linkage for both modal dialogs: give the close buttons in
activationErrorModal and activationWarningModal an accessible label, and connect
each modal to its heading via aria-labelledby using the existing modal-title
elements. Update the modal root elements and the btn-close controls so screen
readers can identify the dialog purpose and the close action without relying on
visual text.

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.

LO-102 [Easy]: Show Warning Modal on Campaign Launch if Validation Fails

1 participant