Skip to content

fix(audit-sprint-8a): modal Phase 3 — invite-button → Dialog primitive - #183

Closed
ejay-dev wants to merge 1 commit into
fix/audit-sprint-4c-modal-primitivesfrom
fix/audit-sprint-8a-more-form-modals
Closed

fix(audit-sprint-8a): modal Phase 3 — invite-button → Dialog primitive#183
ejay-dev wants to merge 1 commit into
fix/audit-sprint-4c-modal-primitivesfrom
fix/audit-sprint-8a-more-form-modals

Conversation

@ejay-dev

Copy link
Copy Markdown
Owner

Summary

Continues Modal Phase 3 from Sprint 7c. Migrates components/team/invite-button.tsx to the shared Dialog primitive. The other 4 deferred modals each need a per-modal design decision (not mechanical migration) — flagged in the body below.

Base branch: fix/audit-sprint-4c-modal-primitives (PR #167).

Migrated

File What changed
components/team/invite-button.tsx Ad-hoc fixed inset-0 wrapper → Dialog/DialogContent. Cyan→indigo gradients stripped from trigger + submit. New resetState() so cancel / ESC / outside-click all converge.

Deferred (each needs a design pass, not mechanical migration)

  • components/vault/credential-inspector-modal.tsx — wide side-by-side layout (iframe preview left + metadata/approval right). Centered Dialog or Sheet destroys the side-by-side review pattern.
  • components/team/invite-modal.tsx — light-themed white-bg modal needs a light/dark decision before swap.
  • components/vault/upload-artifact-modal.tsx — file-upload complexity + a duplicated overlay block the audit flagged as a pre-existing bug.
  • components/compliance-system/plan-activation-flow.tsx — multi-step state-machine flow, different primitive concern.

Visual change is intentional

Trigger button and submit go from a bg-gradient-to-r from-blue-600 via-indigo-600 to-cyan-500 to neutral bg-slate-100. Matches the new primitive style + the audit's "enterprise aesthetic over AI feel" preference. Screenshot review recommended for /app/team after merge.

Validation

  • npm run type-check clean
  • npm run lint 0 errors, 18 warnings (baseline)
  • npx jest 5319/5334 pass (no test changes)

Test plan

  • /app/team → click Invite member → Dialog centered, ESC dismisses, focus on email field
  • Submit invite → success state; auto-close after 1.5s on email path; sticky with copy-link on manual-share path

🤖 Generated with Claude Code

Continues the modal Phase 3 migration from Sprint 7c. This PR migrates
components/team/invite-button.tsx — one of the 5 form modals left over
from that pass.

What this PR migrates
  - components/team/invite-button.tsx: rewrap the ad-hoc fixed-inset-0
    modal as a Dialog/DialogContent. Strip the cyan→indigo→blue
    gradient on the trigger button + submit button per the stored
    enterprise-aesthetic preference. Add a clean resetState() helper
    so close-paths (cancel / esc / outside-click via Dialog) all
    converge on the same teardown.

What this PR does NOT migrate (and why)
  - components/vault/credential-inspector-modal.tsx — wide
    side-by-side layout (iframe preview left + metadata/approval
    sidebar right) that's actively used as a workflow surface, not a
    typical form modal. A centered Dialog or right-side Sheet would
    destroy the side-by-side review pattern. Needs design pass, not
    mechanical migration.
  - components/team/invite-modal.tsx — light-themed white-bg modal
    that would need a deeper light/dark decision before mechanical
    swap (Dialog primitive defaults dark).
  - components/vault/upload-artifact-modal.tsx — file-upload
    complexity + the agent flagged a duplicated overlay block as a
    pre-existing bug. Needs investigation before migration.
  - components/compliance-system/plan-activation-flow.tsx — multi-
    step state-machine flow, not a single-screen form. Different
    primitive concern entirely.

Visual change
  - Trigger button + submit go from `bg-gradient-to-r from-blue-600
    via-indigo-600 to-cyan-500` to neutral `bg-slate-100 text-slate-900`.
    Intentional — matches the new primitive style and the audit's
    "enterprise aesthetic over AI feel" finding. After-merge
    screenshot review recommended for /app/team.

Built on top of fix/audit-sprint-4c-modal-primitives (PR #167) for
the Dialog primitive.

Validation
  - tsc -p tsconfig.typecheck.json: clean
  - eslint: 0 errors, 18 warnings (baseline)
  - jest: 5319/5334 pass (no test changes)

Test plan
  - /app/team → click Invite member → Dialog opens centered, ESC
    dismisses, focus on email field, role picker tab order works
  - Submit invite → success state shows; auto-close after 1.5s on
    the email-sent path, sticky with copy-link on manual-share path

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings May 23, 2026 16:39
@vercel

vercel Bot commented May 23, 2026

Copy link
Copy Markdown

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

Project Deployment Actions Updated (UTC)
forma-os Ready Ready Preview, Comment May 23, 2026 4:43pm

Request Review

@coderabbitai

coderabbitai Bot commented May 23, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 3fc4ae13-d0b9-4b13-bc70-82b305339b80

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/audit-sprint-8a-more-form-modals

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

@chatgpt-codex-connector chatgpt-codex-connector 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: cc8f18d417

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +119 to +121
onOpenChange={(o) => {
if (!o) resetState()
else setOpen(true)

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Prevent losing manual-share URL on dialog dismiss

In the manual-share flow (delivery === "manual_share_required"), closing the dialog via the built-in Dialog close affordances (ESC/X/outside click) now routes through onOpenChange and calls resetState(), which clears manualShareUrl. That means a user can accidentally dismiss before copying the fallback invite link and the UI provides no way to recover it from the current invite result, which can block invite delivery when email sending is unavailable.

Useful? React with 👍 / 👎.

Comment on lines 99 to 102
setTimeout(() => {
setOpen(false)
setEmail("")
setRole("member")
setSuccess(false)
setDelivery("sent")
setManualShareUrl("")
setCopied(false)
resetState()
router.refresh()
}, 1500)

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Clear pending auto-close timer before reopening dialog

The success path schedules an unconditional setTimeout that calls resetState() and router.refresh() after 1.5s, but the timer handle is never stored or cleared. If the user dismisses the success state early (now possible with Dialog close controls) and reopens quickly to start another invite, the old timer will still fire and unexpectedly close/reset the new session and refresh the page mid-interaction.

Useful? React with 👍 / 👎.

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

Pull request overview

Migrates the Team “Invite member” modal in InviteButton from a hand-rolled overlay to the shared Radix-based Dialog primitive introduced in the modal-primitives audit work, aiming to standardize accessibility (focus trap, ESC handling, semantics) and visual styling.

Changes:

  • Replaces the ad-hoc fixed inset-0 modal implementation with Dialog/DialogContent.
  • Introduces a resetState() helper to consolidate close/cancel/reset behavior and updates styling to the neutral “enterprise” look.
  • Adjusts success/manual-share UI to fit the dialog layout and adds auto-close behavior for the “sent” path.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +42 to +46
const resetState = () => {
setOpen(false)
setEmail("")
setRole("member")
setSuccess(false)
Comment on lines 63 to 69
setLoading(true)

const response = await fetch("/app/api/invitations/create", {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({
organizationId: orgId,
email,
role,
}),
body: JSON.stringify({ organizationId: orgId, email, role }),
})
Comment on lines 98 to 102
if (result?.delivery !== "manual_share_required") {
setTimeout(() => {
setOpen(false)
setEmail("")
setRole("member")
setSuccess(false)
setDelivery("sent")
setManualShareUrl("")
setCopied(false)
resetState()
router.refresh()
}, 1500)
Comment on lines +117 to +121
<Dialog
open={open}
onOpenChange={(o) => {
if (!o) resetState()
else setOpen(true)
Comment on lines +124 to 128
<button
onClick={() => setOpen(true)}
disabled={disabled}
className="group flex items-center gap-2 bg-gradient-to-r from-blue-600 via-indigo-600 to-cyan-500 text-white px-4 py-2 rounded-xl text-sm font-bold hover:brightness-110 transition-all shadow-[0_10px_30px_rgba(59,130,246,0.35)] disabled:opacity-60 disabled:cursor-not-allowed motion-safe:active:scale-[0.98]"
className="group flex items-center gap-2 rounded-md bg-slate-100 px-3 py-1.5 text-sm font-semibold text-slate-900 transition-colors hover:bg-white disabled:opacity-60 disabled:cursor-not-allowed"
>
@ejay-dev
ejay-dev deleted the branch fix/audit-sprint-4c-modal-primitives May 23, 2026 16:55
@ejay-dev ejay-dev closed this May 23, 2026
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