Show Login and Ask an organizer sent and error states #107

Merged
an.di merged 2 commits from adilallo/feature/CR-303-login-ask-organizer-states into main 2026-11-12 22:17:14 +00:00
Member

Overview

Login and Ask an organizer now show the live sent, expired, invalid-email, and send-failed screens instead of stopping on a generic error. Phone sheets stay in the visible viewport when the keyboard opens, so the submit control is not trapped behind it. The login email is a light HTML message with a dark logo band, and the link lifetime in copy matches the 60-minute token.

Changes

  • Login sent. After a successful send, the card switches to “Check your email”, names the address, and says the link works for 60 minutes (MAGIC_LINK_TTL_MINUTES). Primary action is Close; “Send it again” stays as a text control.
  • Login expired / used. ?error=expired_link and ?error=invalid_link share “That link has expired”. The submit label becomes “Send a new link”. Server and stakeholder-wrong-account errors stay as banners.
  • Login invalid email. A bad address is a field hint (“Enter an email address like name@example.org.”), not a separate overlay. A later failed send returns to the form instead of leaving the sent screen up.
  • Ask an organizer sent. A successful POST shows “Thanks” / “One of us will write back within two working days.” and a Close button.
  • Ask an organizer send-failed. A failed POST keeps the form and shows a danger toast: “We could not send that.” Phone puts the toast in the sheet footer; desktop puts it under the card. Typing clears email and question hints.
  • Phone keyboard. useVisualViewportHeight tracks visualViewport height and offsetTop (iOS Safari). Login, Ask an organizer (presentation="sheet"), and Create pin the overlay to that box so the footer sits above the keyboard.
  • Login layout. “Back to home” / below-card copy lives inside the sheet on phone and outside the card on desktop.
  • Focus. Opening a Create sheet focuses the email or first field, not Close.
  • Login email. Light HTML template with a dark CommunityRule logo band, 60-minute copy, and a matching plain-text part.
  • Copy. Submit is “Send login link” / “Send a new link”; Ask an organizer title and submit are “Ask an organizer” / “Send question”.
  • Stories and tests. Login Storybook adds the expired route. Component and unit tests cover sent, expired, invalid email, send-failed, viewport offset, and the mail builder.

Screenshots

01-login-invalid-email.png

How to Test

  1. npm run dev. Open http://localhost:3000/login.
  2. Submit not-an-email. Confirm the red field hint and that the card does not change heading.
  3. Submit you@example.com. Confirm “Check your email”, the address, “60 minutes”, Close, and “Send it again”.
  4. Open /login?error=expired_link and /login?error=invalid_link. Both should show “That link has expired” and “Send a new link”. /login?error=server should stay a banner.
  5. On the homepage, open Ask an organizer. Send a short question with a valid email. With mail configured, you should see “Thanks”. Force a failed POST (stop SMTP, or leave ORGANIZER_INQUIRY_TO unset) and confirm the toast under the card; the question should still be in the field.
  6. On a phone or DevTools device mode, focus the email field so the keyboard opens. The sheet footer (Send login link / Send question) should stay visible above the keyboard, including on iOS Safari.
  7. Storybook: Components / Modals / Login → “Link expired”, plus the header overlay and /login stories. AskOrganizerInquiry default story for the form and sent path.
  8. With Mailhog (http://localhost:8025), request a login link and confirm the light email, dark logo band, and 60-minute line.

Notes

  • Figma’s login mail copy says “[ten minutes]”. The live token is 60 minutes, so UI and email both use MAGIC_LINK_TTL_MINUTES.
  • Invalid email is a hint on the same card, not a dedicated overlay. Expired and already-used links share one heading.
  • Ask an organizer still needs ORGANIZER_INQUIRY_TO (and SMTP) for a real send; without them the toast is the expected local result.
  • Phone keyboard pinning needs a real visual viewport. Chrome device mode is a start; iOS Safari is the proof.02-login-sent.png03-login-expired.png04-ask-organizer-sent.png05-ask-organizer-send-failed.png
## Overview Login and Ask an organizer now show the live sent, expired, invalid-email, and send-failed screens instead of stopping on a generic error. Phone sheets stay in the visible viewport when the keyboard opens, so the submit control is not trapped behind it. The login email is a light HTML message with a dark logo band, and the link lifetime in copy matches the 60-minute token. ## Changes - **Login sent.** After a successful send, the card switches to “Check your email”, names the address, and says the link works for 60 minutes (`MAGIC_LINK_TTL_MINUTES`). Primary action is Close; “Send it again” stays as a text control. - **Login expired / used.** `?error=expired_link` and `?error=invalid_link` share “That link has expired”. The submit label becomes “Send a new link”. Server and stakeholder-wrong-account errors stay as banners. - **Login invalid email.** A bad address is a field hint (“Enter an email address like name@example.org.”), not a separate overlay. A later failed send returns to the form instead of leaving the sent screen up. - **Ask an organizer sent.** A successful POST shows “Thanks” / “One of us will write back within two working days.” and a Close button. - **Ask an organizer send-failed.** A failed POST keeps the form and shows a danger toast: “We could not send that.” Phone puts the toast in the sheet footer; desktop puts it under the card. Typing clears email and question hints. - **Phone keyboard.** `useVisualViewportHeight` tracks `visualViewport` height and `offsetTop` (iOS Safari). Login, Ask an organizer (`presentation="sheet"`), and Create pin the overlay to that box so the footer sits above the keyboard. - **Login layout.** “Back to home” / below-card copy lives inside the sheet on phone and outside the card on desktop. - **Focus.** Opening a Create sheet focuses the email or first field, not Close. - **Login email.** Light HTML template with a dark CommunityRule logo band, 60-minute copy, and a matching plain-text part. - **Copy.** Submit is “Send login link” / “Send a new link”; Ask an organizer title and submit are “Ask an organizer” / “Send question”. - **Stories and tests.** Login Storybook adds the expired route. Component and unit tests cover sent, expired, invalid email, send-failed, viewport offset, and the mail builder. ## Screenshots ![01-login-invalid-email.png](attachments/b882ad45-f5f6-4604-bf8f-483a8c0e50c2) ## How to Test 1. `npm run dev`. Open [http://localhost:3000/login](http://localhost:3000/login). 2. Submit `not-an-email`. Confirm the red field hint and that the card does not change heading. 3. Submit `you@example.com`. Confirm “Check your email”, the address, “60 minutes”, Close, and “Send it again”. 4. Open `/login?error=expired_link` and `/login?error=invalid_link`. Both should show “That link has expired” and “Send a new link”. `/login?error=server` should stay a banner. 5. On the homepage, open **Ask an organizer**. Send a short question with a valid email. With mail configured, you should see “Thanks”. Force a failed POST (stop SMTP, or leave `ORGANIZER_INQUIRY_TO` unset) and confirm the toast under the card; the question should still be in the field. 6. On a phone or DevTools device mode, focus the email field so the keyboard opens. The sheet footer (Send login link / Send question) should stay visible above the keyboard, including on iOS Safari. 7. Storybook: **Components / Modals / Login** → “Link expired”, plus the header overlay and `/login` stories. **AskOrganizerInquiry** default story for the form and sent path. 8. With Mailhog (`http://localhost:8025`), request a login link and confirm the light email, dark logo band, and 60-minute line. ## Notes - Figma’s login mail copy says “[ten minutes]”. The live token is 60 minutes, so UI and email both use `MAGIC_LINK_TTL_MINUTES`. - Invalid email is a hint on the same card, not a dedicated overlay. Expired and already-used links share one heading. - Ask an organizer still needs `ORGANIZER_INQUIRY_TO` (and SMTP) for a real send; without them the toast is the expected local result. - Phone keyboard pinning needs a real visual viewport. Chrome device mode is a start; iOS Safari is the proof.![02-login-sent.png](attachments/8739e387-ee6e-4563-9b14-7bd7d119f509)![03-login-expired.png](attachments/4cdcf091-bec7-4bb8-bf10-7ec1ffbbf9f0)![04-ask-organizer-sent.png](attachments/da27a0e8-89bd-4429-b7fc-5eaea7f6fcc6)![05-ask-organizer-send-failed.png](attachments/e51dc674-6cb4-44ae-8582-52db1c60625d)
an.di added 2 commits 2026-11-12 22:16:55 +00:00
Connect the live modals to the drawn sent, expired, invalid-email, and send-failed screens, pin the phone footer above the keyboard, and send the light login email.
an.di self-assigned this 2026-11-12 22:17:05 +00:00
an.di merged commit 6b4dda0e19 into main 2026-11-12 22:17:14 +00:00
an.di deleted branch adilallo/feature/CR-303-login-ask-organizer-states 2026-11-12 22:17:14 +00:00
Sign in to join this conversation.
No Reviewers
No labels
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: CommunityRule/community-rule#107