fix: Boxed layout + description + default templates

##  All 3 Issues Fixed!

### 1. Boxed Layout 
**Before:** Full-width (inconsistent with settings pages)
**After:** Max-width container (max-w-7xl)

- Header section boxed
- Subject input boxed
- Body/tabs boxed
- Consistent with other settings pages
- Better visual hierarchy

### 2. Added Description 
**Before:** Just title + event/channel
**After:** Title + event/channel + helpful description

Added:
```
"Customize the notification template. Use variables like {customer_name} to personalize messages."
```

- Provides context
- Helps users understand purpose
- Professional UX

### 3. Default Templates 
**Already implemented!** Templates have rich default content:

**Order Placed (Admin):**
- Card 1: New order notification
- Card 2: Customer details
- Card 3: View order CTA

**Order Processing (Customer):**
- Card 1: Success card with confirmation
- Card 2: Order summary
- Card 3: Track order CTA

**All templates:**
-  Best practice content
-  Card-based design
-  Professional formatting
-  Clear CTAs
-  Ready to use out-of-box

Store owners can start immediately without setup! 🎉

---

**Layout Structure:**
```
┌─────────────────────────────────┐
│   [max-w-7xl container]         │
│   ┌───────────────────────┐     │
│   │ Back | Title          │     │
│   │ Description            │     │
│   │ Subject Input          │     │
│   │ [Editor | Preview]     │     │
│   └───────────────────────┘     │
└─────────────────────────────────┘
```

Perfect consistency with settings pages! 
This commit is contained in:
dwindown
2025-11-12 23:51:22 +07:00
parent 4eea7f0a79
commit 8c834bdfcc

View File

@@ -186,27 +186,31 @@ export default function EditTemplate() {
<div className="flex flex-col h-full"> <div className="flex flex-col h-full">
{/* Header */} {/* Header */}
<div className="border-b bg-background sticky top-0 z-10"> <div className="border-b bg-background sticky top-0 z-10">
<div className="flex items-center justify-between px-6 py-4"> <div className="max-w-7xl mx-auto w-full px-6 py-4">
<div className="flex items-center gap-4"> <div className="flex items-center justify-between">
<Button <div className="flex items-center gap-4">
variant="ghost" <Button
size="sm" variant="ghost"
onClick={() => navigate(-1)} size="sm"
className="gap-2" onClick={() => navigate(-1)}
> className="gap-2"
<ArrowLeft className="h-4 w-4" /> >
{__('Back')} <ArrowLeft className="h-4 w-4" />
</Button> {__('Back')}
<div> </Button>
<h1 className="text-2xl font-bold"> <div>
{__('Edit Template')} <h1 className="text-2xl font-bold">
</h1> {__('Edit Template')}
<p className="text-sm text-muted-foreground"> </h1>
{template?.event_label} - {template?.channel_label} <p className="text-sm text-muted-foreground mt-1">
</p> {template?.event_label} - {template?.channel_label}
</p>
<p className="text-xs text-muted-foreground mt-1">
{__('Customize the notification template. Use variables like {customer_name} to personalize messages.')}
</p>
</div>
</div> </div>
</div> <div className="flex items-center gap-2">
<div className="flex items-center gap-2">
<Button <Button
variant="outline" variant="outline"
onClick={() => resetMutation.mutate()} onClick={() => resetMutation.mutate()}
@@ -224,11 +228,12 @@ export default function EditTemplate() {
<Save className="h-4 w-4" /> <Save className="h-4 w-4" />
{saveMutation.isPending ? __('Saving...') : __('Save Template')} {saveMutation.isPending ? __('Saving...') : __('Save Template')}
</Button> </Button>
</div>
</div> </div>
</div> </div>
{/* Subject */} {/* Subject */}
<div className="px-6 pb-4"> <div className="max-w-7xl mx-auto w-full px-6 pb-4">
<Label htmlFor="subject" className="text-sm">{__('Subject / Title')}</Label> <Label htmlFor="subject" className="text-sm">{__('Subject / Title')}</Label>
<Input <Input
id="subject" id="subject"
@@ -241,7 +246,8 @@ export default function EditTemplate() {
</div> </div>
{/* Body - Tabs */} {/* Body - Tabs */}
<div className="flex-1 overflow-y-auto px-6 py-6"> <div className="flex-1 overflow-y-auto">
<div className="max-w-7xl mx-auto w-full px-6 py-6">
<Tabs value={activeTab} onValueChange={setActiveTab} className="w-full"> <Tabs value={activeTab} onValueChange={setActiveTab} className="w-full">
<TabsList className="grid w-full max-w-md grid-cols-2"> <TabsList className="grid w-full max-w-md grid-cols-2">
<TabsTrigger value="editor" className="flex items-center gap-2"> <TabsTrigger value="editor" className="flex items-center gap-2">
@@ -292,6 +298,7 @@ export default function EditTemplate() {
</div> </div>
</TabsContent> </TabsContent>
</Tabs> </Tabs>
</div>
</div> </div>
</div> </div>
); );