+ {loading ? (
+
+
+
+ ) : templates.length === 0 ? (
+
+
No approved templates
+
+ Approve a template in Meta WhatsApp Manager, then sync it
+ from Settings → Templates.
+
+
+ ) : (
+ templates.map((t) => (
+
+ ))
+ )}
+
+ ) : (
+
+
+
Preview
+
+ {renderBodyPreview(selected.body_text, params)}
+
+ {selected.footer_text && (
+
+ {selected.footer_text}
+
+ )}
+
+ {variables.map((v, i) => (
+
+
+ {
+ const next = [...params];
+ next[i] = e.target.value;
+ setParams(next);
+ }}
+ placeholder={`Value for {{${v}}}`}
+ className="border-slate-700 bg-slate-800 text-white placeholder:text-slate-500"
+ />
+
+ ))}
+
+ )}
+
+