From 7244433e1235c5bea2c4c3d265398a0ff26a497a Mon Sep 17 00:00:00 2001 From: dwindown Date: Mon, 22 Dec 2025 22:17:51 +0700 Subject: [PATCH] Improve shortcode UI and add payment link shortcodes MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ✨ UI Improvements: - Completely redesigned shortcode display with clean categorization - Added collapsible section for all available shortcodes - Used emoji icons for better visual organization - Improved color coding and typography - Added "Used in this template" section with visual distinction ➕ New Shortcodes: - Added {payment_link} for direct payment links in emails - Added {thank_you_page} for public thank you page access - Updated relevant templates to include new payment shortcodes 🎯 Key Features: - Shortcodes organized by category (User, Order, Product, Access, etc.) - Visual hierarchy with proper spacing and borders - Hover effects and smooth transitions - Better readability with proper contrast 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 4.5 --- src/components/admin/EmailTemplatePreview.tsx | 232 ++++++++++++++---- .../admin/settings/NotifikasiTab.tsx | 6 +- src/lib/email-templates/master-template.ts | 4 +- 3 files changed, 192 insertions(+), 50 deletions(-) diff --git a/src/components/admin/EmailTemplatePreview.tsx b/src/components/admin/EmailTemplatePreview.tsx index 8532cb6..d7849ae 100644 --- a/src/components/admin/EmailTemplatePreview.tsx +++ b/src/components/admin/EmailTemplatePreview.tsx @@ -179,53 +179,193 @@ export function EmailTemplatePreview({ {/* Shortcodes Used */} -
-

Shortcodes Used in This Template:

-
- {[ - // User information - '{nama}', '{email}', - // Order information - '{order_id}', '{tanggal_pesanan}', '{total}', '{metode_pembayaran}', '{status_pesanan}', '{invoice_url}', - // Product information - '{produk}', '{kategori_produk}', '{harga_produk}', '{deskripsi_produk}', - // Access information - '{link_akses}', '{username_akses}', '{password_akses}', '{kadaluarsa_akses}', - // Consulting information - '{tanggal_konsultasi}', '{jam_konsultasi}', '{durasi_konsultasi}', '{link_meet}', - '{jenis_konsultasi}', '{topik_konsultasi}', - // Event information - '{judul_event}', '{tanggal_event}', '{jam_event}', '{link_event}', '{lokasi_event}', '{kapasitas_event}', - // Bootcamp/Course information - '{judul_bootcamp}', '{progres_bootcamp}', '{modul_selesai}', '{modul_selanjutnya}', '{link_progress}', - // Company information - '{nama_perusahaan}', '{website_perusahaan}', '{email_support}', '{telepon_support}', - // Payment information - '{bank_tujuan}', '{nomor_rekening}', '{atas_nama}', '{jumlah_pembayaran}', '{batas_pembayaran}' - ].filter(shortcode => - (template.email_subject && template.email_subject.includes(shortcode)) || - (template.email_body_html && template.email_body_html.includes(shortcode)) - ).map(shortcode => ( - - {shortcode} - - ))} -
- {((template.email_subject && template.email_subject.includes('{')) || - (template.email_body_html && template.email_body_html.includes('{'))) && ( -
-

- All Available Shortcodes: User ({`{nama}`}, {`{email}`}), Orders ({`{order_id}`}, {`{tanggal_pesanan}`}, {`{total}`}, {`{metode_pembayaran}`}, {`{status_pesanan}`}, {`{invoice_url}`}), - Products ({`{produk}`}, {`{kategori_produk}`}, {`{harga_produk}`}), - Access ({`{link_akses}`}, {`{username_akses}`}, {`{password_akses}`}), - Consulting ({`{tanggal_konsultasi}`}, {`{jam_konsultasi}`}, {`{link_meet}`}), - Events ({`{judul_event}`}, {`{tanggal_event}`}, {`{link_event}`}), - Bootcamp ({`{judul_bootcamp}`}, {`{progres_bootcamp}`}, {`{modul_selesai}`}), - Payment ({`{bank_tujuan}`}, {`{nomor_rekening}`}, {`{jumlah_pembayaran}`}), - Company ({`{nama_perusahaan}`}, {`{email_support}`}) -

+
+

+ + Shortcodes Available +

+ + {/* Used in this template */} +
+

Used in this template:

+
+ {[ + // User information + '{nama}', '{email}', + // Order information + '{order_id}', '{tanggal_pesanan}', '{total}', '{metode_pembayaran}', '{status_pesanan}', '{invoice_url}', + // Product information + '{produk}', '{kategori_produk}', '{harga_produk}', '{deskripsi_produk}', + // Access information + '{link_akses}', '{username_akses}', '{password_akses}', '{kadaluarsa_akses}', + // Consulting information + '{tanggal_konsultasi}', '{jam_konsultasi}', '{durasi_konsultasi}', '{link_meet}', + '{jenis_konsultasi}', '{topik_konsultasi}', + // Event information + '{judul_event}', '{tanggal_event}', '{jam_event}', '{link_event}', '{lokasi_event}', '{kapasitas_event}', + // Bootcamp/Course information + '{judul_bootcamp}', '{progres_bootcamp}', '{modul_selesai}', '{modul_selanjutnya}', '{link_progress}', + // Company information + '{nama_perusahaan}', '{website_perusahaan}', '{email_support}', '{telepon_support}', + // Payment information + '{bank_tujuan}', '{nomor_rekening}', '{atas_nama}', '{jumlah_pembayaran}', '{batas_pembayaran}', + '{payment_link}', '{thank_you_page}' + ].filter(shortcode => + (template.email_subject && template.email_subject.includes(shortcode)) || + (template.email_body_html && template.email_body_html.includes(shortcode)) + ).map(shortcode => ( + + {shortcode} + + ))} + {![ + // User information + '{nama}', '{email}', + // Order information + '{order_id}', '{tanggal_pesanan}', '{total}', '{metode_pembayaran}', '{status_pesanan}', '{invoice_url}', + // Product information + '{produk}', '{kategori_produk}', '{harga_produk}', '{deskripsi_produk}', + // Access information + '{link_akses}', '{username_akses}', '{password_akses}', '{kadaluarsa_akses}', + // Consulting information + '{tanggal_konsultasi}', '{jam_konsultasi}', '{durasi_konsultasi}', '{link_meet}', + '{jenis_konsultasi}', '{topik_konsultasi}', + // Event information + '{judul_event}', '{tanggal_event}', '{jam_event}', '{link_event}', '{lokasi_event}', '{kapasitas_event}', + // Bootcamp/Course information + '{judul_bootcamp}', '{progres_bootcamp}', '{modul_selesai}', '{modul_selanjutnya}', '{link_progress}', + // Company information + '{nama_perusahaan}', '{website_perusahaan}', '{email_support}', '{telepon_support}', + // Payment information + '{bank_tujuan}', '{nomor_rekening}', '{atas_nama}', '{jumlah_pembayaran}', '{batas_pembayaran}', + '{payment_link}', '{thank_you_page}' + ].some(shortcode => + (template.email_subject && template.email_subject.includes(shortcode)) || + (template.email_body_html && template.email_body_html.includes(shortcode)) + ) && ( + No shortcodes used yet + )}
- )} +
+ + {/* All available shortcodes */} +
+ + + View all available shortcodes + +
+ + {/* User Information */} +
+

👤 User Information

+
+ {['{nama}', '{email}'].map(shortcode => ( + + {shortcode} + + ))} +
+
+ + {/* Order Information */} +
+

📦 Order Information

+
+ {['{order_id}', '{tanggal_pesanan}', '{total}', '{metode_pembayaran}', '{status_pesanan}', '{invoice_url}'].map(shortcode => ( + + {shortcode} + + ))} +
+
+ + {/* Product Information */} +
+

🛍️ Product Information

+
+ {['{produk}', '{kategori_produk}', '{harga_produk}', '{deskripsi_produk}'].map(shortcode => ( + + {shortcode} + + ))} +
+
+ + {/* Access Information */} +
+

🔐 Access Information

+
+ {['{link_akses}', '{username_akses}', '{password_akses}', '{kadaluarsa_akses}'].map(shortcode => ( + + {shortcode} + + ))} +
+
+ + {/* Payment Information */} +
+

💳 Payment Information

+
+ {['{bank_tujuan}', '{nomor_rekening}', '{atas_nama}', '{jumlah_pembayaran}', '{batas_pembayaran}', '{payment_link}', '{thank_you_page}'].map(shortcode => ( + + {shortcode} + + ))} +
+
+ + {/* Consulting Information */} +
+

📅 Consulting Information

+
+ {['{tanggal_konsultasi}', '{jam_konsultasi}', '{durasi_konsultasi}', '{link_meet}', '{jenis_konsultasi}', '{topik_konsultasi}'].map(shortcode => ( + + {shortcode} + + ))} +
+
+ + {/* Event Information */} +
+

🎪 Event Information

+
+ {['{judul_event}', '{tanggal_event}', '{jam_event}', '{link_event}', '{lokasi_event}', '{kapasitas_event}'].map(shortcode => ( + + {shortcode} + + ))} +
+
+ + {/* Bootcamp Information */} +
+

🎓 Bootcamp Information

+
+ {['{judul_bootcamp}', '{progres_bootcamp}', '{modul_selesai}', '{modul_selanjutnya}', '{link_progress}'].map(shortcode => ( + + {shortcode} + + ))} +
+
+ + {/* Company Information */} +
+

🏢 Company Information

+
+ {['{nama_perusahaan}', '{website_perusahaan}', '{email_support}', '{telepon_support}'].map(shortcode => ( + + {shortcode} + + ))} +
+
+ +
+
{/* Template Actions */} diff --git a/src/components/admin/settings/NotifikasiTab.tsx b/src/components/admin/settings/NotifikasiTab.tsx index e18d923..d9074bd 100644 --- a/src/components/admin/settings/NotifikasiTab.tsx +++ b/src/components/admin/settings/NotifikasiTab.tsx @@ -24,10 +24,10 @@ interface NotificationTemplate { } const RELEVANT_SHORTCODES = { - 'payment_success': ['{nama}', '{email}', '{order_id}', '{tanggal_pesanan}', '{total}', '{metode_pembayaran}', '{produk}', '{link_akses}'], + 'payment_success': ['{nama}', '{email}', '{order_id}', '{tanggal_pesanan}', '{total}', '{metode_pembayaran}', '{produk}', '{link_akses}', '{thank_you_page}'], 'access_granted': ['{nama}', '{email}', '{produk}', '{link_akses}', '{username_akses}', '{password_akses}', '{kadaluarsa_akses}'], - 'order_created': ['{nama}', '{email}', '{order_id}', '{tanggal_pesanan}', '{total}', '{metode_pembayaran}', '{produk}'], - 'payment_reminder': ['{nama}', '{email}', '{order_id}', '{tanggal_pesanan}', '{total}', '{metode_pembayaran}', '{batas_pembayaran}', '{jumlah_pembayaran}', '{bank_tujuan}', '{nomor_rekening}'], + 'order_created': ['{nama}', '{email}', '{order_id}', '{tanggal_pesanan}', '{total}', '{metode_pembayaran}', '{produk}', '{payment_link}'], + 'payment_reminder': ['{nama}', '{email}', '{order_id}', '{tanggal_pesanan}', '{total}', '{metode_pembayaran}', '{batas_pembayaran}', '{jumlah_pembayaran}', '{bank_tujuan}', '{nomor_rekening}', '{payment_link}'], 'consulting_scheduled': ['{nama}', '{email}', '{tanggal_konsultasi}', '{jam_konsultasi}', '{durasi_konsultasi}', '{link_meet}', '{jenis_konsultasi}', '{topik_konsultasi}'], 'event_reminder': ['{nama}', '{email}', '{judul_event}', '{tanggal_event}', '{jam_event}', '{link_event}', '{lokasi_event}', '{kapasitas_event}'], 'bootcamp_progress': ['{nama}', '{email}', '{judul_bootcamp}', '{progres_bootcamp}', '{modul_selesai}', '{modul_selanjutnya}', '{link_progress}'], diff --git a/src/lib/email-templates/master-template.ts b/src/lib/email-templates/master-template.ts index 46366b3..aca05bc 100644 --- a/src/lib/email-templates/master-template.ts +++ b/src/lib/email-templates/master-template.ts @@ -405,7 +405,9 @@ export class ShortcodeProcessor { nomor_rekening: '123-456-7890', atas_nama: 'PT Access Hub Indonesia', jumlah_pembayaran: 'Rp 1.500.000', - batas_pembayaran: '22 Desember 2025 23:59' + batas_pembayaran: '22 Desember 2025 23:59', + payment_link: 'https://accesshub.example.com/payment/ORD-123456', + thank_you_page: 'https://accesshub.example.com/thank-you/ORD-123456' }; static process(content: string, customData: Record = {}): string {