Skip to content

[web] Prevent life event controls from overlapping - #2278

Merged
Asherlc merged 6 commits into
mainfrom
codex/issue-2159
Jul 29, 2026
Merged

Asherlc merged 6 commits into
mainfrom
codex/issue-2159

Conversation

@Asherlc

@Asherlc Asherlc commented Jul 29, 2026

Copy link
Copy Markdown
Owner

Summary

  • stack Life Events pills and + Add event on narrow web viewports while restoring the existing row layout at sm
  • let the event-pill group shrink and wrap instead of competing with the add control
  • stack the add form's grid, type choices, and actions below sm so enlarged text remains operable
  • add a fluid Travel Week Storybook reproduction and colocated responsive regression tests

Root cause

The wrapping event-pill group and non-shrinking add button shared an always-horizontal flex row. The pill group retained its automatic minimum width, so the two controls competed for the same narrow line. The add form had the same narrow-layout assumption in its fixed two-column grid and horizontal control groups.

Responsive proof

Production Storybook Body/LifeEventsPanel/TravelWeek was measured with browser viewport emulation:

Viewport Root text Document width Closed controls Open form
320 px 16 px 320 / 320 px client/scroll column; no overlap, clipping, or off-screen controls no overflow, clipping, or off-screen controls; Save visible
375 px 16 px 375 / 375 px client/scroll column; no overlap, clipping, or off-screen controls no overflow, clipping, or off-screen controls; Save visible
390 px 16 px 390 / 390 px client/scroll column; no overlap, clipping, or off-screen controls no overflow, clipping, or off-screen controls; Save visible
320 px 32 px (200%) 320 / 320 px client/scroll Travel Week 224 × 154 px; Add 224 × 58 px; no overlap or clipping no overflow, clipping, or off-screen controls; type/actions column; Save visible

The 320 px / 200% open-form screenshot was visually inspected; the full event date, form fields, and action controls remained visible.

Testing

  • pnpm exec vitest run --project unit packages/web/src/components/LifeEventsPanel.test.tsx
  • pnpm --filter dofek-web build-storybook
  • pnpm exec biome check packages/web/src/components/LifeEventsPanel.tsx packages/web/src/components/LifeEventsPanel.test.tsx packages/web/src/components/LifeEventsPanel.stories.tsx
  • pnpm --filter dofek-web typecheck
  • pnpm typecheck
  • pnpm spellcheck
  • pnpm knip
  • pnpm lint
  • CI=1 pnpm test (921 files, 14,451 tests passed; 21 skipped)

Fixes #2159

Summary by Sourcery

Improve Life Events panel responsiveness on narrow web viewports to prevent overlapping controls and ensure accessibility with enlarged text.

New Features:

  • Add a Travel Week Storybook story with mobile viewport settings to reproduce responsive behavior.

Bug Fixes:

  • Prevent the Life Events pill list and '+ Add event' control from overlapping on narrow screens by stacking and resizing controls responsively.
  • Ensure the Life Events add form fields and actions stack appropriately on small viewports so all controls remain visible and operable with large text.

Enhancements:

  • Make the Life Events Storybook frame fluid with a max width to better simulate different viewport sizes.
  • Document a TDD-style responsive controls plan for the Life Events panel, including testing and audit strategy.

Tests:

  • Add regression tests verifying stacked layout, shrinkable event list, and full-width add control on narrow screens for the Life Events panel.
  • Add regression tests ensuring the add-event form grid, type choices, and action buttons stack correctly below the small breakpoint.

Summary by cubic

Fixes #2159 by preventing the Life Event pills and “+ Add event” from overlapping on small web screens. Controls stack below sm and return to a row at sm+, and the add form is now mobile-friendly.

  • Bug Fixes

    • Stack Life Event pills and “+ Add event” below sm; restore row layout at sm+.
    • Allow the event list to shrink (min-w-0) and make “+ Add event” full-width on mobile; sm:w-auto on desktop.
    • Stack add-form grid, type choices, and actions on mobile with sm overrides to keep desktop layout.
  • New Features

    • Make the Storybook frame fluid and add TravelWeek (mobile viewport) and Loading stories.
    • Add responsive unit tests for stacked controls and form layout; document the web-only parity exception in a TDD plan.

Written for commit 942ade6. Summary will update on new commits.

Review in cubic

Summary by CodeRabbit

  • New Features

    • Added Storybook scenarios for loading and Travel Week event states.
    • Added mobile viewport coverage for Life Events layouts.
  • Bug Fixes

    • Improved narrow-screen layouts so event controls and event pills no longer overlap.
    • Updated the Add Event form to stack fields and actions cleanly on mobile screens.
  • Tests

    • Added responsive layout coverage for event lists and the Add Event form.

Copilot AI review requested due to automatic review settings July 29, 2026 06:35
@Asherlc Asherlc linked an issue Jul 29, 2026 that may be closed by this pull request
@cursor

cursor Bot commented Jul 29, 2026

Copy link
Copy Markdown

Bugbot is not enabled for your account, so this pull request was not reviewed.

Enable Bugbot in the Cursor dashboard to get automatic reviews on future PRs.

Copilot AI 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.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@sourcery-ai sourcery-ai 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.

Sorry @Asherlc, you have reached your weekly rate limit of 500000 diff characters.

Please try again later or upgrade to continue using Sourcery

@coderabbitai

coderabbitai Bot commented Jul 29, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

LifeEventsPanel now uses responsive stacking for event controls and the add-event form, with regression tests and Storybook scenarios covering narrow layouts, Travel Week data, and loading behavior.

Changes

Life Events responsive controls

Layer / File(s) Summary
Responsive layout and regression coverage
docs/superpowers/plans/..., packages/web/src/components/LifeEventsPanel.tsx, packages/web/src/components/LifeEventsPanel.test.tsx
The event controls and add-event form stack below sm, regain horizontal layouts at sm, and are covered by narrow-screen class assertions.
Storybook responsive scenarios
packages/web/src/components/LifeEventsPanel.stories.tsx
Storybook adds Travel Week and loading scenarios, pending mock behavior, and a fluid full-width wrapper with a mobile viewport story.

Estimated code review effort: 2 (Simple) | ~15 minutes

Assessment against linked issues

Objective Addressed Explanation
Prevent + Add event from overlapping the Travel Week card on mobile, with responsive tests and Storybook coverage at narrow widths and large text [#2159]

Out-of-scope changes

Code Change Explanation
Add a loading scenario and pending TRPC mock behavior (packages/web/src/components/LifeEventsPanel.stories.tsx:12,81-116,190-200) The linked objective covers mobile responsive controls and Travel Week reproduction; loading-state Storybook behavior is unrelated to that scope.

Suggested labels: area/web, type/bug

🚥 Pre-merge checks | ✅ 2
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title is imperative, under 70 characters, prefixed with [web], and accurately describes the overlap fix in this PR.

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.

@codereviewbot-ai

Copy link
Copy Markdown

🤖 Review skipped: Repository rate limit exceeded. Free accounts are limited to 2 reviews per 4 hours per repository. Upgrade to a paid plan for unlimited reviews.

@sourcery-ai

sourcery-ai Bot commented Jul 29, 2026

Copy link
Copy Markdown
Contributor

Reviewer's Guide

Makes LifeEventsPanel controls responsive on narrow web viewports by stacking controls, allowing the pill list to shrink, and adding colocated regression tests and a Storybook Travel Week scenario to prevent overlapping controls.

State diagram for responsive LifeEventsPanel controls layout

stateDiagram-v2
  [*] --> MobileBelowSm
  MobileBelowSm: viewport < sm
  MobileBelowSm --> DesktopSmAndAbove: viewport >= sm
  DesktopSmAndAbove --> MobileBelowSm: viewport < sm

  state MobileBelowSm {
    [*] --> MobileControls
    MobileControls: stacked controls

    state MobileControls {
      EventList: flex min-w-0 flex-wrap
      AddButton: w-full shrink-0
      FormGrid: grid-cols-1
      TypeChoices: flex-col
      FormActions: flex-col
    }
  }

  state DesktopSmAndAbove {
    [*] --> DesktopControls
    DesktopControls: horizontal layout

    state DesktopControls {
      EventList: flex-row flex-wrap
      AddButton: sm:w-auto
      FormGrid: sm:grid-cols-2
      TypeChoices: sm:flex-row
      FormActions: sm:flex-row sm:justify-end
    }
  }
Loading

File-Level Changes

Change Details Files
Make the Life Events event list and add control responsive and non-overlapping on narrow screens.
  • Wrap the event list and add button container in a flex column that stacks on mobile and switches back to a row at the small breakpoint.
  • Allow the event-pill list to shrink by adding a zero minimum width so it wraps instead of forcing overlap.
  • Make the '+ Add event' button full-width on narrow viewports and revert to auto width at the small breakpoint.
packages/web/src/components/LifeEventsPanel.tsx
Make the add-event form layout stack vertically on mobile while preserving the existing desktop layout.
  • Change the form grid to a single-column layout on mobile and restore two columns at the small breakpoint.
  • Adjust label and notes fields to span both columns only at the small breakpoint and above.
  • Make type choices and form action buttons flex columns on mobile and flex rows at the small breakpoint, with actions right-aligned only on larger screens.
packages/web/src/components/LifeEventsPanel.tsx
Add regression tests for responsive stacking behavior of LifeEventsPanel controls and form.
  • Add a test that renders a Travel Week event and asserts mobile-first stacking, event-list shrinkability, and full-width add control with small-breakpoint overrides.
  • Add a test that opens the add-event form and asserts stacked grid, type choice orientation, and actions orientation, with corresponding small-breakpoint overrides.
packages/web/src/components/LifeEventsPanel.test.tsx
Update Storybook stories to support responsive reproduction and add a Travel Week scenario.
  • Introduce a Travel Week event fixture and scenario with representative data.
  • Make the LifeEventsPanel Storybook frame fluid with a max width cap and reduced padding on small screens to better emulate mobile viewports.
  • Add a TravelWeek Storybook story configured with a mobile viewport to reproduce and manually verify the responsive behavior.
packages/web/src/components/LifeEventsPanel.stories.tsx
Document the responsive controls test-driven development plan and responsive audit steps.
  • Add a markdown plan describing the TDD approach, evidence, test strategy, file changes, and verification tasks for the Life Events responsive controls fix.
docs/superpowers/plans/2026-07-28-life-events-responsive-controls.md

Assessment against linked issues

Issue Objective Addressed Explanation
#2159 Update the LifeEventsPanel layout so that the Life Events '+ Add event' control no longer overlaps the Travel Week event on narrow web viewports by stacking controls, allowing the event list to shrink/wrap, and restoring the existing horizontal layout at the small breakpoint and above.
#2159 Ensure the Life Events add form fields and controls are responsive so that on narrow viewports and with enlarged text they stack appropriately and remain fully operable (no clipping or off-screen controls).
#2159 Add regression coverage and documentation for the responsive Life Events controls, including tests and Storybook scenarios that reproduce the Travel Week mobile layout and a TDD plan documenting the responsive behavior requirements.

Possibly linked issues

  • #TRACK-06: PR implements responsive stacking, shrinkable event list, and tests to fix the audited mobile overlap issue.

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@qodo-code-review

Copy link
Copy Markdown

PR Summary by Qodo

Prevent Life Event Controls from Overlapping on Narrow Screens

🐞 Bug fix 🧪 Tests 📝 Documentation 🕐 10-20 Minutes

Grey Divider

AI Description

• Stack life-event controls and form actions below sm to prevent narrow-screen overlap.
• Restore desktop rows at sm while allowing event pills to shrink and wrap.
• Add Travel Week Storybook coverage, responsive tests, and a documented verification plan.
Diagram

graph TD
  P["Life Events Panel"] --> B{"Below sm?"} -->|Yes| M["Stacked controls"] --> F["Single-column form"]
  B -->|No| D["Desktop controls"] --> G["Two-column form"]
Loading
High-Level Assessment

The component-local, mobile-first Tailwind approach is appropriate because the defect is purely presentational and the application already uses the sm breakpoint. JavaScript viewport detection would add runtime state and synchronization risk, while container queries would introduce unnecessary complexity for this focused fix.

Files changed (4) +146 / -9

Bug fix (1) +8 / -8
LifeEventsPanel.tsxMake Life Events controls responsive below the small breakpoint +8/-8

Make Life Events controls responsive below the small breakpoint

• Stacks the event list and full-width add control below 'sm', while allowing event pills to shrink and wrap. The add form now uses a single-column mobile layout with stacked type choices and actions, restoring its prior horizontal layout at 'sm'.

packages/web/src/components/LifeEventsPanel.tsx

Tests (2) +74 / -1
LifeEventsPanel.stories.tsxAdd a fluid Travel Week mobile reproduction +23/-1

Add a fluid Travel Week mobile reproduction

• Replaces the fixed 760px story frame with a fluid, desktop-capped container and responsive padding. Adds a Travel Week fixture and mobile-viewport story for reproducing and visually validating the overlap scenario.

packages/web/src/components/LifeEventsPanel.stories.tsx

LifeEventsPanel.test.tsxCover responsive event controls and add-form layouts +51/-0

Cover responsive event controls and add-form layouts

• Adds regression tests asserting that event controls, form fields, type choices, and actions stack on narrow screens. The tests also verify the 'sm' breakpoint restores desktop layout and that the event list can shrink.

packages/web/src/components/LifeEventsPanel.test.tsx

Documentation (1) +64 / -0
2026-07-28-life-events-responsive-controls.mdDocument the responsive-controls TDD and verification plan +64/-0

Document the responsive-controls TDD and verification plan

• Defines the overlap root cause, expected breakpoint behavior, regression strategy, responsive audit criteria, and implementation tasks. It explicitly limits the change to web presentation without altering server or native behavior.

docs/superpowers/plans/2026-07-28-life-events-responsive-controls.md

@github-actions

github-actions Bot commented Jul 29, 2026

Copy link
Copy Markdown
Contributor

Storybook previews for b879f5db are ready:

This comment updates automatically on each PR push.

@qodo-code-review

qodo-code-review Bot commented Jul 29, 2026

Copy link
Copy Markdown

Code Review by Qodo

🐞 Bugs (0) 📘 Rule violations (0) 📜 Skill insights (1)

Context used
✅ Compliance rules (platform): 167 rules

Grey Divider


Remediation recommended

1. Loading story remains missing ✓ Resolved 📘 Rule violation ▣ Testability
Description
The updated Storybook file adds a resolved-data TravelWeek scenario but still has no story for the
loading state that LifeEventsPanel renders. Consequently, a required key UI state remains absent
from Storybook coverage.
Code

packages/web/src/components/LifeEventsPanel.stories.tsx[R168-172]

+export const TravelWeek: Story = {
+  parameters: {
+    viewport: { defaultViewport: "mobile1" },
+  },
+  render: () => <LifeEventsStoryFrame scenario={travelWeekScenario} />,
Relevance

⭐⭐⭐ High

Missing loading-state Storybook coverage was repeatedly accepted in comparable component reviews.

PR-#1885
PR-#1197
PR-#2045

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
PR Compliance ID 773538 requires a loading story whenever a changed component displays loading UI.
LifeEventsPanel renders QueryStatePanel while the event query is loading, while the story file
exports only resolved default, imperial, empty, and Travel Week scenarios.

Rule 773538: Colocate Storybook stories with React components and cover key UI states
packages/web/src/components/LifeEventsPanel.tsx[97-101]
packages/web/src/components/LifeEventsPanel.stories.tsx[156-172]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
`LifeEventsPanel` displays a loading state, but its updated Storybook stories do not include a loading scenario.

## Issue Context
Add a deterministic scenario whose TRPC list request remains pending so Storybook renders the component's `QueryStatePanel` loading state.

## Fix Focus Areas
- packages/web/src/components/LifeEventsPanel.stories.tsx[90-172]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools



Informational

2. LifeEventsPanel tests render component 📜 Skill insight ▣ Testability
Description
The added responsive tests call render(<LifeEventsPanel />) and inspect DOM classes instead of
exercising an exported builder or configuration function. This violates the required component-test
strategy and couples the tests to rendered implementation structure.
Code

packages/web/src/components/LifeEventsPanel.test.tsx[130]

+    render(<LifeEventsPanel />);
Relevance

⭐ Low

The same exported-builder requirement for rendered component tests was explicitly rejected.

PR-#2275

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
PR Compliance ID 722152 requires UI component tests to call exported builder functions rather than
render components. Both new responsive tests render LifeEventsPanel and then inspect DOM elements
and their classes.

packages/web/src/components/LifeEventsPanel.test.tsx[123-172]
Skill: write-tests

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
The new responsive tests render `LifeEventsPanel` and inspect its DOM class lists, contrary to the required builder-function testing strategy.

## Issue Context
Move the responsive layout configuration into a production-used builder or configuration API and assert directly on its returned values rather than rendering the full component.

## Fix Focus Areas
- packages/web/src/components/LifeEventsPanel.test.tsx[123-172]
- packages/web/src/components/LifeEventsPanel.tsx[113-138]
- packages/web/src/components/LifeEventsPanel.tsx[233-330]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


Grey Divider

To customize comments, go to the Qodo configuration screen, or learn more in the docs.

Qodo Logo

Comment thread packages/web/src/components/LifeEventsPanel.stories.tsx
@codereviewbot-ai

Copy link
Copy Markdown

🤖 Review skipped: Repository rate limit exceeded. Free accounts are limited to 2 reviews per 4 hours per repository. Upgrade to a paid plan for unlimited reviews.

@codereviewbot-ai

Copy link
Copy Markdown

🤖 Review skipped: Repository rate limit exceeded. Free accounts are limited to 2 reviews per 4 hours per repository. Upgrade to a paid plan for unlimited reviews.

@Asherlc

Asherlc commented Jul 29, 2026

Copy link
Copy Markdown
Owner Author

Review follow-up: added the required deterministic loading Storybook state in d2cad36 and resolved the inline thread. I did not adopt the optional exported-builder suggestion: AGENTS.md explicitly prohibits production exports solely for testability, while these tests exercise the public rendered component behavior. The responsive Storybook measurements provide the browser-level layout proof.

@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

🤖 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 `@docs/superpowers/plans/2026-07-28-life-events-responsive-controls.md`:
- Line 9: Update the Life Events plan to comply with AGENTS.md by including
equivalent implementation and tests for both packages/web and packages/mobile,
while preserving the existing behavior requirements. If the change must remain
web-only, document an explicitly approved exception and its rationale instead of
prohibiting native mobile updates.
🪄 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: ASSERTIVE

Plan: Pro Plus

Run ID: 612de2f2-cbcd-4c47-8f7c-0249264c588c

📥 Commits

Reviewing files that changed from the base of the PR and between 1e66202 and d2cad36.

📒 Files selected for processing (4)
  • docs/superpowers/plans/2026-07-28-life-events-responsive-controls.md
  • packages/web/src/components/LifeEventsPanel.stories.tsx
  • packages/web/src/components/LifeEventsPanel.test.tsx
  • packages/web/src/components/LifeEventsPanel.tsx

Comment thread docs/superpowers/plans/2026-07-28-life-events-responsive-controls.md Outdated
@Asherlc Asherlc changed the title fix(web): prevent life event controls from overlapping [web] Prevent life event controls from overlapping Jul 29, 2026
@codereviewbot-ai

Copy link
Copy Markdown

🤖 Review skipped: Repository rate limit exceeded. Free accounts are limited to 2 reviews per 4 hours per repository. Upgrade to a paid plan for unlimited reviews.

@codereviewbot-ai

Copy link
Copy Markdown

🤖 Review skipped: Repository rate limit exceeded. Free accounts are limited to 2 reviews per 4 hours per repository. Upgrade to a paid plan for unlimited reviews.

@codereviewbot-ai

Copy link
Copy Markdown

🤖 Review skipped: Repository rate limit exceeded. Free accounts are limited to 2 reviews per 4 hours per repository. Upgrade to a paid plan for unlimited reviews.

@Asherlc
Asherlc merged commit fa6dde0 into main Jul 29, 2026
99 checks passed
@Asherlc
Asherlc deleted the codex/issue-2159 branch July 29, 2026 07:54
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.

[TRACK-06] Life Events Add overlaps Travel Week card on mobile

2 participants