# Plan: Reuse AdCard Preview In Campaign Edit Form

## Goal

Add the same sponsored ad card preview used by the campaign creation form to the ad campaign edit dialog.

The user confirmed "cart previewer" means the existing `AdCard` preview component.

## Key Files

- `src/components/ads/ad-campaign-edit-dialog.tsx`
- `src/components/ads/ad-card.tsx`
- `src/components/ads/advertise-form.tsx`
- `src/components/ads/advertise-form.test.ts`
- New focused test if needed: `src/components/ads/ad-campaign-edit-dialog.test.ts`

## Worktree Handling

- Current checkout is the normal repo checkout on `main`, not a linked worktree.
- Existing worktrees include:
  - `/Users/cuevaio/projects/petdex-ad-campaign-edit` on `feat/ad-campaign-edit`
  - `/Users/cuevaio/projects/petdex/.worktrees/feat-ad-campaign-preview` on `feat/ad-campaign-preview`
- `.worktrees/` exists but is not ignored, so implementation must avoid staging it.
- After approval, use the existing `.worktrees/feat-ad-campaign-preview` worktree if appropriate, or ask before creating/adjusting any worktree because plan mode cannot make that change.

## Implementation Steps

1. In `src/components/ads/ad-campaign-edit-dialog.tsx`, import `AdCard` from `@/components/ads/ad-card`.
2. Remove the unused `next/image` import once the inline image preview is replaced.
3. Derive a `previewAd` object from edit state:
   - `id`: `campaign.id`
   - `title`: `title.trim() || campaign.title`
   - `description`: `description.trim() || campaign.description`
   - `imageUrl`: `previewUrl ?? uploadedImageUrl ?? campaign.imageUrl`
   - `clickUrl`: `destinationUrl.trim() || campaign.destinationUrl`
4. Replace the current `<aside>` preview markup with a section/aside that renders:
   - Existing preview heading/help text if useful from current translations.
   - `<AdCard ad={previewAd} disableNavigation showImagePlaceholder={false} />`
5. Keep the form layout minimal and close to the current `md:grid-cols-[1fr_220px]` structure unless the full card needs a slightly wider preview column.
6. Do not change `AdCard` unless reuse exposes a small required compatibility issue.
7. Do not change API, dashboard wiring, validation, or persistence logic.

## Test Plan

1. Add or update a lightweight source-level test mirroring `advertise-form.test.ts`:
   - Assert `ad-campaign-edit-dialog.tsx` imports/renders `<AdCard`.
   - Assert it passes `disableNavigation`.
   - Assert it no longer contains the old duplicated inline `Sponsored preview` markup.
   - Assert it does not use `FeedAdSlot`.
2. Run focused tests:
   - `bun test src/components/ads/advertise-form.test.ts`
   - `bun test src/components/ads/ad-campaign-edit-dialog.test.ts` if added
3. Run repository check:
   - `bun run check`
4. Skip `bun run i18n:check` unless translation messages are edited.

## Expected Outcome

The edit campaign dialog shows the same analytics-free sponsored card preview as the create campaign form, driven by the draft edit fields and current/new image preview, without changing campaign update behavior.
