feat: improve domain verification UX with enhanced feedback
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.
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 UXapps/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/UXapps/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 & returnapps/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.
@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.