unsend icon indicating copy to clipboard operation
unsend copied to clipboard

feat: improve domain verification UX with enhanced feedback

Open enemyrr opened this issue 4 months ago โ€ข 2 comments

Summary

  • Enhanced domain verification button with proper loading states and spinner
  • Added comprehensive toast notifications for verification events (start, success, error)
  • Implemented visual progress indicators and status messages during verification
  • Improved button text to reflect current verification state
  • Added better error handling in the startVerification tRPC mutation

Changes Made

  • Enhanced Verify Button: Added loading spinner, dynamic button text based on state
  • Toast Notifications: Success/error/info messages for all verification events
  • Visual Progress Indicators: Status section with spinner and descriptive messages
  • Better Error Handling: Improved startVerification mutation with proper validation
  • Status Tracking: Automatic detection of verification completion with feedback

Test Plan

  • [ ] Test domain verification flow from start to completion
  • [ ] Verify toast notifications appear correctly for all states
  • [ ] Check that button states update properly during verification
  • [ ] Test error scenarios and retry functionality
  • [ ] Ensure visual indicators work correctly

Summary by CodeRabbit

  • New Features

    • Rich domain verification feedback: toasts on status changes, a dedicated status section, and dynamic Verify button text/spinner.
    • Automatic polling during verification for up-to-date status.
  • Improvements

    • Safer domain deletion: Delete disabled until exact domain name is typed; placeholder shows the actual domain.
    • Clearer success/error messaging when starting verification and when sending test emails; automatic refresh after verification actions.

enemyrr avatar Aug 23 '25 11:08 enemyrr

Walkthrough

Stricter delete confirmation (requires exact domain name), richer domain verification UX with toasts/spinners/status section and polling, and server-side hardening of startVerification to validate domain existence, set isVerifying/status, and return a structured { success, message } response.

Changes

Cohort / File(s) Summary
Delete confirmation UX
apps/web/src/app/(dashboard)/domains/[domainId]/delete-domain.tsx
Placeholder now shows domain.name. Delete button disabled while mutation pending and unless input equals domain.name. Existing onSubmit validation remains.
Verification flow UI/UX
apps/web/src/app/(dashboard)/domains/[domainId]/page.tsx
Added useRef/useEffect to track previous status and toast on transitions. handleVerify shows start/success/error toasts and refetches onSettled. Verify button and status section updated for loading, pending, failed, and verified states; polling continues while verifying.
API: startVerification validation & return
apps/web/src/server/api/routers/domain.ts
startVerification now ensures domain exists via findUnique, sets isVerifying=true and status=DomainStatus.PENDING, returns { success: boolean; message: string }, and throws TRPCError NOT_FOUND or INTERNAL_SERVER_ERROR with context on failures. sendTestEmailFromDomain error handling tightened.

Sequence Diagram(s)

sequenceDiagram
  autonumber
  actor U as User
  participant UI as Domains Page (UI)
  participant API as startVerification (trpc)
  participant DB as Database

  U->>UI: Click "Verify domain"
  UI->>UI: Show "Starting verification..." toast
  UI->>API: startVerification(domainId)
  API->>DB: findUnique(domainId)
  alt domain found
    API->>DB: update(isVerifying=true, status=PENDING)
    API-->>UI: { success: true, message }
    UI->>UI: start polling (refetchInterval)
    UI-->>U: Show "Checking DNS records..." / spinner
  else domain not found
    API-->>UI: TRPCError NOT_FOUND
    UI-->>U: Show error toast "Domain not found"
  end

  rect rgba(230,245,255,0.6)
  loop Polling while isVerifying
    UI->>DB: fetch domain status
    DB-->>UI: status
    alt status -> SUCCESS
      UI-->>U: Show success toast "Verified"
      UI->>UI: Button shows "Verified โœ“ - Check again"
    else status -> FAILED
      UI-->>U: Show error toast "Verification failed"
      UI->>UI: Show retry state and guidance
    end
  end
  end

Estimated code review effort

๐ŸŽฏ 4 (Complex) | โฑ๏ธ ~45 minutes

Pre-merge checks (2 passed, 1 warning)

โŒ 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%. You can run @coderabbitai generate docstrings to improve docstring coverage.
โœ… Passed checks (2 passed)
Check name Status Explanation
Title Check โœ… Passed The title succinctly and accurately captures the primary purpose of the changeset by describing the enhancement of the domain verification user experience with improved feedback mechanisms.
Description Check โœ… Passed The description clearly outlines the implemented UX enhancements, toast notifications, visual indicators, and improved error handling, directly aligning with the changes made in the pull request.

Poem

I twitch my whiskers, keen and spry,
I watch the DNS clouds drift by.
A toast, a spin, a name to type,
I hop to guard the delete swipe.
Verified or failed โ€” I cheer, then sigh. ๐Ÿ‡โœจ

โœจ Finishing Touches
  • [ ] ๐Ÿ“ Generate Docstrings
๐Ÿงช Generate unit tests
  • [ ] Create PR with unit tests
  • [ ] Post copyable unit tests in a comment

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

coderabbitai[bot] avatar Aug 23 '25 11:08 coderabbitai[bot]

@enemyrr is attempting to deploy a commit to the kmkoushik's projects Team on Vercel.

A member of the Team first needs to authorize it.

vercel[bot] avatar Sep 09 '25 09:09 vercel[bot]