Skip to content

Add Web Push encouragement banner (CIRCLE-40)#110

Merged
HamptonMakes merged 1 commit into
mainfrom
05-12-add_web_push_encouragement_banner_circle-40_
May 12, 2026
Merged

Add Web Push encouragement banner (CIRCLE-40)#110
HamptonMakes merged 1 commit into
mainfrom
05-12-add_web_push_encouragement_banner_circle-40_

Conversation

@HamptonMakes
Copy link
Copy Markdown
Collaborator

Toast-style banner that appears after a signed-in user posts a comment, nudging them to enable browser notifications on this device.

Linear: CIRCLE-40
Stacks on (independent of): #109

Behavior

  • Mounts globally in the layout, hidden by default.
  • The reply-form Stimulus controller dispatches coplan:web-push-banner:nudge on a successful turbo:submit-end.
  • The banner controller self-evaluates eligibility and surfaces only when all hold:
    • browser supports Notification + PushManager and a VAPID key is published
    • permission isn't denied
    • not already subscribed on this device
    • dismiss count < N (default 3)
    • permanent-off flag isn't set (set after enable, or after N dismissals)
  • Enable reuses the existing coplan/web_push.subscribe() module — no new subscription plumbing. Success message replaces the body, banner auto-hides after 4s, never nags again on this device.
  • Not now bumps the dismiss count in localStorage; after 3 it flips the permanent-off flag.

Files

  • engine/app/views/coplan/shared/_web_push_banner.html.erb — partial, gated on signed_in? && CoPlan.configuration.web_push_configured?
  • engine/app/javascript/controllers/coplan/web_push_banner_controller.js — eligibility + enable/dismiss
  • engine/app/javascript/controllers/coplan/comment_form_controller.js — dispatches the nudge event on successful submit
  • engine/app/views/layouts/coplan/application.html.erb — renders the partial once globally
  • CSS: bottom-right toast, sits above the comment toolbar (z-index 60), responsive on small screens

Deferred

The ticket also mentions inbox and plan-author triggers; the post-comment trigger is the highest-signal nudge and the simplest first cut. Adding more entry points is additive — they just need to dispatch the same event.

Verification

  • 814 specs pass.
  • Manually verify in the browser: comment on a thread → banner appears bottom-right → Enable triggers permission prompt → success state shows → banner auto-hides → reload page → does not return.

Generated with Amp

Toast-style banner that appears after a signed-in user posts a comment,
nudging them to enable browser notifications on this device. Mounts
globally in the layout and stays hidden until the comment form fires
turbo:submit-end successfully, at which point the controller
self-evaluates eligibility and surfaces itself.

Eligibility (must all hold):
- browser supports Notification + PushManager + a VAPID key is published
- permission isn't already 'denied'
- not already subscribed on this device
- user hasn't dismissed N times (default 3)
- user hasn't already enabled via the banner (permanent-off flag)

Dismiss/permanent-off state lives in localStorage so it's per-device,
matching how subscriptions work. Enabling reuses the existing
coplan/web_push module, so no new subscription plumbing.

Other entry points listed in the ticket (inbox page, plan-author first
view) are deferred — the post-comment trigger is the highest-signal
nudge and ships the simplest version of the feature.

Generated with Amp
@HamptonMakes HamptonMakes force-pushed the 05-12-add_web_push_encouragement_banner_circle-40_ branch from fa46d79 to 30312a0 Compare May 12, 2026 18:45
@HamptonMakes HamptonMakes merged commit af14fdf into main May 12, 2026
5 checks passed
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