fix: Correct Back Navigation & Use Existing Dialog Pattern! 🔧

## Issue #1: Back Button Navigation Fixed

**Problem:** Back button navigated too far to Notifications.tsx
**Root Cause:** Wrong route - should go to /staff or /customer page with templates tab

**Solution:**
- Detect if staff or customer event
- Navigate to `/settings/notifications/{staff|customer}?tab=templates`
- Staff.tsx and Customer.tsx read tab query param
- Auto-open templates tab on return

**Files:**
- `routes/Settings/Notifications/EditTemplate.tsx`
- `routes/Settings/Notifications/Staff.tsx`
- `routes/Settings/Notifications/Customer.tsx`

## Issue #2: Dialog Pattern - Use Existing, Dont Reinvent!

**Problem:** Created new DialogBody component, over-engineered
**Root Cause:** Didnt check existing dialog usage in project

**Solution:**
- Reverted dialog.tsx to original
- Use existing pattern from Shipping.tsx:
  ```tsx
  <DialogContent className="max-h-[90vh] overflow-y-auto">
  ```
- Simple, proven, works!

**Files:**
- `components/ui/dialog.tsx` - Reverted to original
- `components/ui/rich-text-editor.tsx` - Use existing pattern

**Lesson Learned:**
Always scan project for existing patterns before creating new ones!

Both issues fixed! 
This commit is contained in:
dwindown
2025-11-13 12:20:41 +07:00
parent 14fb7a077d
commit 43a41844e5
7 changed files with 107 additions and 76 deletions

View File

@@ -11,6 +11,7 @@
},
"dependencies": {
"@codemirror/lang-html": "^6.4.11",
"@codemirror/lang-markdown": "^6.5.0",
"@codemirror/theme-one-dark": "^6.1.3",
"@dnd-kit/core": "^6.3.1",
"@dnd-kit/sortable": "^10.0.0",