Skip to content

fix: mobile responsiveness and sign-in flash prevention - #214

Merged
ayoub3bidi merged 7 commits into
developfrom
fix/landing-page-sign-in-flash
Jul 26, 2026
Merged

fix: mobile responsiveness and sign-in flash prevention#214
ayoub3bidi merged 7 commits into
developfrom
fix/landing-page-sign-in-flash

Conversation

@ayoub3bidi

@ayoub3bidi ayoub3bidi commented Jul 26, 2026

Copy link
Copy Markdown
Owner

Contribution workflow

  • Base branch is develop: This PR targets develop, not main.
  • Guidelines and docs: I have read CONTRIBUTING.md and the docs relevant to my change.
  • This template: I kept the PR template structure and filled in the sections below.

Description

Fixes several mobile responsiveness issues and prevents a sign-in button flash on the landing page for authenticated users. The changes improve the UX on small screens across the complexity panel, Python code panel, and the /pro page.

Type of Change

  • Bug fix (non-breaking change which fixes an issue)
  • Style/UI improvement

Related Issues

Changes Made

  • Landing page sign-in flash fix: Modified UserMenu.jsx to return null during auth loading state when hideAvatar is true, preventing a flash of the sign-in button for authenticated users
  • Complexity panel responsive redesign: Replaced fixed SVG dimensions with a fixed viewBox (650x350) + CSS scaling via preserveAspectRatio, added responsive margins/text sizes via useMediaQuery hook, made complexity badges wrap horizontally on mobile, added touch-friendly tap-to-toggle tooltip on data points
  • New useMediaQuery hook: Reactive CSS media query hook following the same pattern as useIsBelowLg but accepting any valid matchMedia query
  • Python code panel mobile fixes: Run button collapses to icon-only on mobile (hides label text), "Completed" status text hidden on mobile, "Experimental" pill removed from Test Cases tab
  • Pro page responsiveness: Sort animation bars use responsive widths (w-7 sm:w-8 lg:w-12), gap and padding scale with breakpoints, waitlist form skips for users who already joined

Testing

  • All existing tests pass (pnpm test:run)
  • New tests added for new functionality
  • Manual testing completed

Test Results

src/components/ComplexityPanel.test.jsx (16 tests)
src/hooks/useMediaQuery.test.js (5 tests)

Test Files  2 passed (2)
     Tests  21 passed (21)

Code Quality

  • Code follows the project's coding standards
  • ESLint passes (pnpm lint)
  • Prettier formatting applied (pnpm format:check)
  • No console errors or warnings
  • Code is properly documented with JSDoc (if applicable)

Performance Impact

  • No performance impact

Breaking Changes

  • None

Checklist

  • I have completed the Contribution workflow checklist at the top of this template
  • My code follows the project's style guidelines
  • I have performed a self-review of my code
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes

Summary by CodeRabbit

  • New Features
    • Added responsive layouts for complexity charts, controls, badges, and output console actions.
    • Added touch-friendly chart tooltips with accessible status messaging.
    • Added responsive viewport detection for adapting layouts across screen sizes.
  • Bug Fixes
    • Improved menu visibility behavior during loading and authentication states.
    • Preserved waitlist status when returning to the Pro coming-soon page.
  • Style
    • Refined mobile spacing, sizing, typography, and sorting animation presentation.

- Add useMediaQuery hook for reactive viewport detection
- Replace hardcoded SVG dimensions with viewBox for fluid scaling
- Responsive SVG margins by breakpoint
- Show title/algorithm name on mobile (was hidden)
- Compact horizontal badge layout on small screens
- Touch-friendly tooltip (tap to toggle, tap chart to dismiss)
- Hide scale toggle on mobile to save space
- Responsive axis text sizing inside SVG
- Larger toggle touch target on desktop
@github-actions github-actions Bot added style Improve styling, design, and animation tests labels Jul 26, 2026
@coderabbitai

coderabbitai Bot commented Jul 26, 2026

Copy link
Copy Markdown

Review Change Stack

Warning

Review limit reached

@ayoub3bidi, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 47 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 629f1254-b704-4d9f-bbff-6c7495fbb34c

📥 Commits

Reviewing files that changed from the base of the PR and between 9535739 and 90fad94.

📒 Files selected for processing (2)
  • src/pages/ProComingSoonPage.jsx
  • src/pages/ProComingSoonPage.test.jsx
📝 Walkthrough

Walkthrough

The pull request adds a reusable media-query hook, responsive complexity chart and console layouts, touch tooltip interactions, updated avatar visibility logic, and responsive Pro waitlist rendering with stored-email-based initialization.

Changes

Complexity Panel Responsiveness

Layer / File(s) Summary
Media-query hook and validation
src/hooks/useMediaQuery.js, src/hooks/useMediaQuery.test.js
Adds useMediaQuery with listener synchronization, legacy fallback support, cleanup, and tests for matching, updates, registration, and unmounting.
Responsive chart and tooltip behavior
src/components/ComplexityPanel.jsx, src/components/ComplexityPanel.test.jsx
Uses a fixed SVG viewBox with responsive sizing and text classes, reorganizes mobile badges, adds tappable tooltip toggling and wrapper dismissal, and covers the new rendering and interaction behavior.

Output Console Responsive Controls

Layer / File(s) Summary
Responsive console controls
src/components/OutputConsole.jsx
Adjusts run-button sizing and label visibility across breakpoints, simplifies the Test Cases tab, removes its Experimental badge, and hides the Completed label on extra-small screens.

User Menu Loading State

Layer / File(s) Summary
Avatar visibility gating
src/components/UserMenu.jsx
Returns no avatar when hiding avatars during loading or authenticated states, independent of profile presence.

Pro Waitlist Page Updates

Layer / File(s) Summary
Waitlist animation and initial state
src/pages/ProComingSoonPage.jsx
Makes sorting animation tiles responsive and initializes the submission state from stored waitlist email presence.

Estimated code review effort: 3 (Moderate) | ~25 minutes

Possibly related PRs

Suggested labels: tests

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately summarizes the main changes: mobile responsiveness improvements and preventing sign-in/avatar flash for authenticated users.
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.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/landing-page-sign-in-flash

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.

@codecov

codecov Bot commented Jul 26, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 94.33962% with 3 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
src/components/OutputConsole.jsx 50.00% 3 Missing ⚠️

📢 Thoughts on this report? Let us know!

@github-actions

github-actions Bot commented Jul 26, 2026

Copy link
Copy Markdown

Preview for Bayan Flow Staging ready!

Name Link
🔨 Latest commit 90fad94
🔍 Latest deploy log https://github.com/ayoub3bidi/bayan-flow/actions/runs/30210146934
😎 Deploy Preview https://pr-214-bayan-flow-staging.ayoub3bidi.workers.dev
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

Preview alias pr-214 on the staging worker. Updates automatically with new commits.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 1

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
src/components/ComplexityPanel.jsx (1)

306-321: 🎯 Functional Correctness | 🟠 Major | 🏗️ Heavy lift

Resolve mobile taps at the chart level, not on 3-unit markers.

At Line 317, the 50 points become about 5.7px apart on a 320px-wide SVG, while each clickable marker is only about 3px wide. Taps cannot reliably select a point; larger per-point hit areas would overlap. Convert the SVG click coordinate to the nearest graph point, and dismiss only when no point is selected.

🤖 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 `@src/components/ComplexityPanel.jsx` around lines 306 - 321, The chart
currently relies on tiny 3-unit marker click targets, making mobile point
selection unreliable. Move point selection to the chart-level SVG handler,
convert the tap’s SVG coordinate to the nearest graph point using the existing
scales/data, and call handlePointInteraction for that point; dismiss only when
no point is found. Remove or bypass per-marker click handling while preserving
hover behavior.
🧹 Nitpick comments (1)
src/hooks/useMediaQuery.test.js (1)

79-87: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Assert that the listener is actually removed.

This passes even if cleanup is omitted, so it cannot catch a leaked media-query subscription.

Proposed test update
-    // Should not throw on unmount
-    expect(() => unmount()).not.toThrow();
+    expect(listeners).toHaveLength(1);
+    unmount();
+    expect(listeners).toHaveLength(0);
🤖 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 `@src/hooks/useMediaQuery.test.js` around lines 79 - 87, Strengthen the “should
clean up listener on unmount” test by spying on the media-query listener removal
API and asserting it is called during unmount. Keep the existing render and
no-throw checks, and target the listener cleanup performed by useMediaQuery
rather than only verifying that unmount completes.
🤖 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 `@src/pages/ProComingSoonPage.jsx`:
- Around line 72-74: Update the submitState initialization in ProComingSoonPage
to mark a user as already_joined only when the stored waitlist email matches the
current authenticated user or profile email; otherwise keep idle and preserve
the prefilled-email behavior. Also handle identity changes by re-evaluating or
clearing stale stored state, and add a regression test covering different stored
and authenticated emails.

---

Outside diff comments:
In `@src/components/ComplexityPanel.jsx`:
- Around line 306-321: The chart currently relies on tiny 3-unit marker click
targets, making mobile point selection unreliable. Move point selection to the
chart-level SVG handler, convert the tap’s SVG coordinate to the nearest graph
point using the existing scales/data, and call handlePointInteraction for that
point; dismiss only when no point is found. Remove or bypass per-marker click
handling while preserving hover behavior.

---

Nitpick comments:
In `@src/hooks/useMediaQuery.test.js`:
- Around line 79-87: Strengthen the “should clean up listener on unmount” test
by spying on the media-query listener removal API and asserting it is called
during unmount. Keep the existing render and no-throw checks, and target the
listener cleanup performed by useMediaQuery rather than only verifying that
unmount completes.
🪄 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: 96c22f59-e1bc-4f76-b7cd-1a11147dfee1

📥 Commits

Reviewing files that changed from the base of the PR and between 60809e4 and 9535739.

📒 Files selected for processing (7)
  • src/components/ComplexityPanel.jsx
  • src/components/ComplexityPanel.test.jsx
  • src/components/OutputConsole.jsx
  • src/components/UserMenu.jsx
  • src/hooks/useMediaQuery.js
  • src/hooks/useMediaQuery.test.js
  • src/pages/ProComingSoonPage.jsx

Comment thread src/pages/ProComingSoonPage.jsx Outdated
Prevent a stale waitlist email in localStorage from showing
'already_joined' to a different user on the same browser.
Only mark as already_joined when the stored email matches the
authenticated user's email, and re-evaluate when auth state loads.

Adds regression test for cross-user stored email scenario.
@ayoub3bidi

Copy link
Copy Markdown
Owner Author

Fixed the CodeRabbit review comment: the stored waitlist email is now scoped to the current user. Only marks already_joined when the stored email matches the authenticated user's email. A useEffect re-evaluates when auth state loads, and a regression test covers cross-user scenarios.

@ayoub3bidi
ayoub3bidi merged commit 64ae009 into develop Jul 26, 2026
15 checks passed
@ayoub3bidi
ayoub3bidi deleted the fix/landing-page-sign-in-flash branch July 26, 2026 16:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

style Improve styling, design, and animation tests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant