Files
WooNooW/admin-spa
dwindown 4eea7f0a79 feat: Convert template editor to subpage + all UX improvements
##  All 5 Points Addressed!

### 1. [Card] Rendering in Preview 
- Added `parseCardsForPreview()` function
- Parses [card type="..."] syntax in preview
- Renders cards with proper styling
- Supports all card types (default, success, highlight, info, warning)
- Background image support

### 2. Fixed Double Scrollbar 
- Removed fixed height from iframe
- Auto-resize iframe based on content height
- Only body wrapper scrolls now
- Clean, single scrollbar experience

### 3. Store Variables with Real Data 
- `store_name`, `store_url`, `store_email` use actual values
- Dynamic variables (order_number, customer_name, etc.) highlighted in yellow
- Clear distinction between static and dynamic data
- Better preview accuracy

### 4. Code Mode (Future Enhancement) 📝
- TipTap doesnt have built-in code mode
- Current WYSIWYG is sufficient for now
- Can add custom code view later if needed
- Users can still edit raw HTML in editor

### 5. Dialog → Subpage Conversion 
**This is the BEST change!**

**New Structure:**
```
/settings/notifications/edit-template?event=X&channel=Y
```

**Benefits:**
-  Full-screen editing (no modal constraints)
- 🔗 Bookmarkable URLs
- ⬅️ Back button navigation
- 💾 Better save/cancel UX
- 📱 More space for content
- 🎯 Professional editing experience

**Files:**
- `EditTemplate.tsx` - New subpage component
- `Templates.tsx` - Navigate instead of dialog
- `App.tsx` - Added route
- `TemplateEditor.tsx` - Keep for backward compat (can remove later)

---

**Architecture:**
```
Templates List
    ↓ Click Edit
EditTemplate Subpage
    ↓ [Editor | Preview] Tabs
    ↓ Save/Cancel
Back to Templates List
```

**Next:** Card insert buttons + Email appearance settings 🚀
2025-11-12 23:43:53 +07:00
..