From e8b8082eda44d9b4db2fbcd4b1d61bc7a0d79f47 Mon Sep 17 00:00:00 2001 From: dwindown Date: Thu, 13 Nov 2025 00:19:36 +0700 Subject: [PATCH] feat: All 4 issues fixed - back nav, variables, defaults, code mode MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ## ✅ All 4 Issues Resolved! ### 1. Back Navigation Button ✅ **Before:** Back button in action area (right side) **After:** Arrow before page title (left side) ```tsx title={
{template?.event_label}
} ``` - Cleaner UX (← Edit Template) - Navigates to previous page (staff/customer) - Maintains active tab state - More intuitive placement ### 2. Variables in RichText ✅ **Issue:** Lost variable insertion when moved to subpage **Fix:** Variables prop still passed to RichTextEditor ```tsx ``` - Variable insertion works - Dropdown in toolbar - Click to insert {variable_name} ### 3. Default Values Loading ✅ **Issue:** Template data not setting in inputs **Fix:** Better useEffect condition + console logging ```tsx useEffect(() => { if (template && template.subject !== undefined && template.body !== undefined) { console.log(\"Setting template data:\", template); setSubject(template.subject || \"\"); setBody(template.body || \"\"); setVariables(template.variables || {}); } }, [template]); ``` **Backend Fix:** - API returns event_label and channel_label - Default templates load from TemplateProvider - Rich default content for all events **Why it works now:** - Proper undefined check - Template data from API includes all fields - RichTextEditor syncs with content prop ### 4. Code Mode Toggle ✅ **TipTap doesnt have built-in code mode** **Solution:** Custom code/visual toggle ```tsx {codeMode ? (