Skip to content

feat(frontend): dismissible flash banner and safe placement#79

Merged
evan-taylor merged 4 commits intodevfrom
fix/flash-banner-dismiss-and-placement
Apr 16, 2026
Merged

feat(frontend): dismissible flash banner and safe placement#79
evan-taylor merged 4 commits intodevfrom
fix/flash-banner-dismiss-and-placement

Conversation

@dfed25
Copy link
Copy Markdown
Collaborator

@dfed25 dfed25 commented Apr 16, 2026

  • Add FlashProvider with bottom-inset positioning above tab/home area
  • pointerEvents box-none/auto so banner receives taps; tap or Dismiss clears
  • Shorter auto-dismiss when reduce motion is enabled
  • Wire create/edit listing, mark sold, and report success to setFlash
  • ReportModal optional onReportSuccess for non-blocking confirmation

Made-with: Cursor

Linked Issues

Closes #79
Linear: POLY-56 (e.g., POLY-123)

Summary

Briefly explain the change and why.

How to Test

Steps to verify locally:

  • npm run lint
  • npm run typecheck
  • npm test
  • Manual flow:
    1. npm run dev:backend (in terminal A)
    2. npm run dev (in terminal B)
    3. Verify the change: <describe expected behavior/screens>

Checklist

  • Tests added/updated (if applicable)
  • Lint/tests pass locally (npm run lint)
  • Docs updated (README/ADR/changelog if needed)
  • Follows conventional commit format
  • No merge conflicts with dev

Screenshots / Demos

(if UI or visible behavior - attach images, videos, or GIFs)

Summary by CodeRabbit

Release Notes

  • New Features
    • Introduced flash notification system for displaying action confirmations as non-blocking banners
    • Listing creation, updates, and status changes now trigger auto-dismissing success notifications
    • Report submissions now display success messages as flash notifications
    • Added accessibility features including reduced motion support and live region announcements

@vercel
Copy link
Copy Markdown

vercel Bot commented Apr 16, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
poly-buys Ready Ready Preview, Comment Apr 16, 2026 1:55pm

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Apr 16, 2026

Warning

Rate limit exceeded

@evan-taylor has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 1 minutes and 11 seconds before requesting another review.

Your organization is not enrolled in usage-based pricing. Contact your admin to enable usage-based pricing to continue reviews beyond the rate limit, or try again in 1 minutes and 11 seconds.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: c06e103c-2ddf-4718-bdd3-5032b9f057be

📥 Commits

Reviewing files that changed from the base of the PR and between 099c77a and 3a9a22e.

📒 Files selected for processing (8)
  • frontend/app/_layout.tsx
  • frontend/app/listings/[id].tsx
  • frontend/app/listings/[id]/edit.tsx
  • frontend/app/listings/new.tsx
  • frontend/app/profile/[userId].tsx
  • frontend/components/ReportModal.tsx
  • frontend/constants/feedbackMessages.ts
  • frontend/contexts/FlashContext.tsx
📝 Walkthrough

Walkthrough

This PR introduces a flash messaging system (temporary banner notifications) to the app by creating a FlashContext provider with accessibility support, integrating it into the app layout, and replacing blocking alert dialogs with non-blocking flash messages across multiple screens and components.

Changes

Cohort / File(s) Summary
Core Flash System
frontend/contexts/FlashContext.tsx
New context-based flash/banner notification system with auto-dismiss, reduced motion support, and accessibility features (live region, alert role, hints/labels). Exposes useFlash() hook and FlashProvider component.
App Layout Integration
frontend/app/_layout.tsx
Wrapped PushNotificationsBootstrap, StatusBar, and Stack navigator with FlashProvider to enable flash messaging throughout the app.
Screen Flash Integration
frontend/app/listings/[id].tsx, frontend/app/listings/[id]/edit.tsx, frontend/app/listings/new.tsx, frontend/app/profile/[userId].tsx
Added useFlash hook usage; replaced blocking showAlert success confirmations with non-blocking flash messages on listing creation, updates, and report submissions.
ReportModal Enhancement
frontend/components/ReportModal.tsx
Extended props with optional onReportSuccess() callback; on successful report submission, invokes callback if provided, otherwise falls back to existing alert behavior.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant Screen as Screen Component
    participant Flash as FlashProvider
    participant Banner as Flash Banner
    participant Timer as Auto-dismiss Timer

    User->>Screen: Triggers action (e.g., create listing)
    Screen->>Screen: Action succeeds
    Screen->>Flash: setFlash("Listing created.")
    Flash->>Flash: Clear existing timeout
    Flash->>Flash: Set message state
    Flash->>Banner: Render banner at bottom
    Banner->>User: Display notification
    Flash->>Timer: Schedule auto-dismiss (2000ms)
    Timer->>Flash: Timeout fires
    Flash->>Flash: Clear message state
    Flash->>Banner: Remove banner from view
Loading
sequenceDiagram
    participant User
    participant ReportModal as Report Modal
    participant API as API
    participant Screen as Screen Component
    participant Flash as FlashProvider

    User->>ReportModal: Submit report
    ReportModal->>API: POST report
    API->>ReportModal: Success response
    ReportModal->>Screen: onReportSuccess() callback
    Screen->>Flash: setFlash("Report submitted...")
    Flash->>User: Display confirmation banner
    ReportModal->>ReportModal: handleClose()
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

  • Fix/team feedback UI issues #75: Modifies the listing detail screen (frontend/app/listings/[id].tsx) with additional UI interactions; this PR also updates the same file to add flash messaging for status changes.

Suggested reviewers

  • jaydonkc

Poem

🐰 A flash of green banners now grace the screen,
No blocking alerts to interrupt the flow!
Auto-dismiss magic in two seconds keen,
Accessibility-aware, a thoughtful show.

🚥 Pre-merge checks | ✅ 1 | ❌ 2

❌ Failed checks (2 warnings)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 9.09% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
Description check ⚠️ Warning The pull request description is incomplete and does not follow the template structure. Critical sections lack detail. Add a detailed summary explaining why the flash banner is needed and how it improves UX. Complete the testing section with specific verification steps. Mark checklist items as completed and update placeholders like issue numbers and add screenshots of the banner UI.
✅ Passed checks (1 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately describes the main changes: implementing a dismissible flash banner with safe area positioning, which is the primary objective of this PR.

✏️ 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 fix/flash-banner-dismiss-and-placement

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

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

@dfed25
Copy link
Copy Markdown
Collaborator Author

dfed25 commented Apr 16, 2026

@CodeRabbit

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Apr 16, 2026

@dfed25 Sure! I'll kick off a review of this PR right away.

✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

Copy link
Copy Markdown
Contributor

@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

🧹 Nitpick comments (1)
frontend/app/listings/[id].tsx (1)

199-200: Flash wiring works, but extract shared report-success copy.

The repeated string ('Report submitted. Thanks for helping keep PolyBuys safe.') now appears in multiple screens. Consider a shared constant to prevent drift in future copy updates.

Also applies to: 567-569

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@frontend/app/listings/`[id].tsx around lines 199 - 200, The same success copy
is duplicated; extract it to a shared constant (e.g., REPORT_SUBMITTED_MESSAGE)
and replace inline string occurrences where setFlash is called (referenced in
this file around the setFlash calls in listings/[id].tsx, including the
try/catch block that currently uses 'Report submitted. Thanks for helping keep
PolyBuys safe.' and the other occurrence at lines ~567-569) so both places
import and use the constant; add the constant to a shared module (or top-level
of this file if already shared) and update imports/usages to reference
REPORT_SUBMITTED_MESSAGE instead of the hard-coded literal.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@frontend/contexts/FlashContext.tsx`:
- Around line 19-21: The reduced-motion auto-dismiss timeout is shorter
(FLASH_DURATION_REDUCED_MS = 900) which makes confirmations harder to read when
reduceMotion === true; update FLASH_DURATION_REDUCED_MS to be at least as long
as FLASH_DURATION_MS (or longer, e.g., 2000–3000ms) and ensure the reduceMotion
branch that reads reduceMotion uses that constant so the auto-dismiss behavior
does not shorten for users who requested reduced motion (symbols to change:
FLASH_DURATION_MS, FLASH_DURATION_REDUCED_MS, and the reduceMotion conditional
in FlashContext/any dismiss logic).

---

Nitpick comments:
In `@frontend/app/listings/`[id].tsx:
- Around line 199-200: The same success copy is duplicated; extract it to a
shared constant (e.g., REPORT_SUBMITTED_MESSAGE) and replace inline string
occurrences where setFlash is called (referenced in this file around the
setFlash calls in listings/[id].tsx, including the try/catch block that
currently uses 'Report submitted. Thanks for helping keep PolyBuys safe.' and
the other occurrence at lines ~567-569) so both places import and use the
constant; add the constant to a shared module (or top-level of this file if
already shared) and update imports/usages to reference REPORT_SUBMITTED_MESSAGE
instead of the hard-coded literal.
🪄 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: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: f30eeab4-cc57-41cf-8bcb-96f371ddac2d

📥 Commits

Reviewing files that changed from the base of the PR and between 9e5c87d and 099c77a.

📒 Files selected for processing (7)
  • frontend/app/_layout.tsx
  • frontend/app/listings/[id].tsx
  • frontend/app/listings/[id]/edit.tsx
  • frontend/app/listings/new.tsx
  • frontend/app/profile/[userId].tsx
  • frontend/components/ReportModal.tsx
  • frontend/contexts/FlashContext.tsx

Comment thread frontend/contexts/FlashContext.tsx
dfed25 added 4 commits April 16, 2026 06:54
- Add FlashProvider with bottom-inset positioning above tab/home area
- pointerEvents box-none/auto so banner receives taps; tap or Dismiss clears
- Shorter auto-dismiss when reduce motion is enabled
- Wire create/edit listing, mark sold, and report success to setFlash
- ReportModal optional onReportSuccess for non-blocking confirmation

Made-with: Cursor
- Add feedbackMessages constants for report success (flash + Alert)
- Use REPORT_SUBMITTED_MESSAGE in listing and profile screens
- Increase FLASH_DURATION_REDUCED_MS to 4000 for readability

Made-with: Cursor
@evan-taylor evan-taylor force-pushed the fix/flash-banner-dismiss-and-placement branch from 5fa6cd3 to 3a9a22e Compare April 16, 2026 13:54
@evan-taylor evan-taylor merged commit 3bdb15e into dev Apr 16, 2026
2 of 4 checks passed
@evan-taylor evan-taylor deleted the fix/flash-banner-dismiss-and-placement branch April 16, 2026 13:55
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.

2 participants