# Custom Domain Settings Improvements

**Issue:** #162 - Clean up custom domain settings
**Date:** 2025-12-15
**Status:** Approved

## Problem

Dealers with custom domain access (Growth+ or grandfathered) have poor visibility to this feature. The only entry point is small text in the editor form. Additionally, many dealers are not technically advanced, so DNS setup needs clear UX with simple instructions.

## Solution

### 1. Dashboard Settings Section

Add a new "Settings" section to the dashboard below the "Edit Your Site" grid.

**Structure:**

- Section title: "Settings"
- Contains "Domain Settings" button
- Button enabled for dealers with custom domain access (Growth+ tier OR `hasGrandfatheredCustomDomain: true`)
- For dealers without access: button disabled with upgrade prompt
- Navigates to `/dashboard/settings/domains`
- Styled to match existing dashboard card pattern (dashed inner border)

### 2. Domain Settings Page Improvements

**Subdomain display (all tiers):**

- Show subdomain URL with "Copy" button
- Copy button shows "Copied!" feedback on click

**Custom domain section (Growth+ or grandfathered):**

_When no domain configured:_

- Domain input field
- DNS management options appear only after entering a domain
- "Managed DNS" pre-selected as default (dealers prefer hands-off)
- Simple instructions for each option:
  - Managed: "We'll handle your DNS. Just update your nameservers at your registrar."
  - Self-managed: "Point your domain's A record to our server IP."
- "Configure Domain" button
- Support CTA: "Need help? Contact support and we'll walk you through it."

_When domain configured:_

- Status badge with color coding:
  - Pending (yellow)
  - Verified (blue)
  - Active (green)
- Clear next-step messaging based on current status
- "Check my DNS" button for pending status - verifies configuration and shows result
- "Verify DNS" and "Activate Domain" buttons as appropriate
- "Remove Custom Domain" option

### 3. Registration Onboarding Form

**Changes to `/registration/onboarding`:**

- Custom domain input field (existing)
- DNS management options appear when dealer enters a domain
- Options: "Managed DNS (Recommended)" and "Self-managed DNS"
- Selection is optional - dealer can skip and configure later
- Helper text: "You can configure DNS settings later in your dashboard."

**Data handling:**

- Domain entered, no method selected: save `customDomain`, leave `customDomainMethod` null, status "none"
- Domain entered with method selected: save both, set status to "pending"

## Files to Modify

1. `app/dashboard/page.tsx` - Add Settings section
2. `app/dashboard/dashboard.module.css` - Styles for Settings section
3. `app/dashboard/settings/domains/page.tsx` - Improve UX, add copy button, DNS checker
4. `app/registration/onboarding/OnboardingForm.tsx` - Conditional DNS options
5. `app/api/dealer/route.ts` - Include `hasGrandfatheredCustomDomain` in response

## Design Decisions

- **Default to managed DNS:** Most dealers want hands-off setup
- **Optional DNS method during registration:** Reduces friction, configure later
- **Copy button on subdomain:** Quality-of-life improvement for all tiers
- **Status visibility:** Clear feedback on where they are in the process
- **DNS checker:** Helps non-technical dealers verify setup before contacting support
