diff --git a/src/components/AdminDashboard.tsx b/src/components/AdminDashboard.tsx index ef3e2ab..bfebfdd 100644 --- a/src/components/AdminDashboard.tsx +++ b/src/components/AdminDashboard.tsx @@ -3,7 +3,7 @@ import { useModal } from '../contexts/ModalContext'; import { TrendingUp, Users, AlertTriangle, XCircle, Search, Settings, CheckCircle2, RefreshCw, Link as LinkIcon, ShieldCheck, HelpCircle, Eye, DollarSign, - Shield, Layers, LogOut, Menu, X, GraduationCap, Mail, ThumbsUp, ThumbsDown + Shield, Layers, LogOut, Menu, X, GraduationCap, Mail, ThumbsUp, ThumbsDown, UserCog } from 'lucide-react'; import { LineChart, Line, BarChart, Bar, XAxis, YAxis, CartesianGrid, Tooltip as RechartsTooltip, ResponsiveContainer, Legend, Cell, PieChart, Pie } from 'recharts'; import { SubscriptionStatus } from '../types'; @@ -11,6 +11,7 @@ import { AdminPricingManager } from './AdminPricingManager'; import { WhatsappConnectCard } from './WhatsappConnectCard'; import AdminContentManager from './AdminContentManager'; import AdminMessagesView from './AdminMessagesView'; +import AdminProfileModal from './AdminProfileModal'; import ToggleSwitch from './ToggleSwitch'; interface WebhookLog { @@ -92,6 +93,7 @@ export default function AdminDashboard({ token, adminUser, onLogout }: AdminDash const [showSaveSuccessModal, setShowSaveSuccessModal] = useState(false); const [asaasTestResult, setAsaasTestResult] = useState<{ loading: boolean; success: boolean | null; message: string } | null>(null); const [smtpTestResult, setSmtpTestResult] = useState<{ loading: boolean; success: boolean | null; message: string } | null>(null); + const [showProfileModal, setShowProfileModal] = useState(false); useEffect(() => { fetchDashboardData(); @@ -493,15 +495,20 @@ export default function AdminDashboard({ token, adminUser, onLogout }: AdminDash {/* Footer profile card */}
-
-
+
+ + {onLogout && (
+ + {/* Admin Profile Modal */} + setShowProfileModal(false)} + token={token} + /> {/* BACKGROUND SHADOW FOR MOBILE SIDEBAR */} diff --git a/src/components/AdminMessagesView.tsx b/src/components/AdminMessagesView.tsx index 1917bdf..d1d34e4 100644 --- a/src/components/AdminMessagesView.tsx +++ b/src/components/AdminMessagesView.tsx @@ -275,8 +275,8 @@ export default function AdminMessagesView() { const whatsappTemplates = [ { id: 'whatsappTemplatePayment', title: 'Pagamento Confirmado', desc: 'Enviada automaticamente quando o aluno paga um plano ou curso.', icon: '💰', tags: ['{nome}', '{valor}', '{plano}', '{curso}'] }, - { id: 'whatsappTemplateWelcome', title: 'Boas-Vindas (Nova Conta)', desc: 'Enviada automaticamente quando o aluno cria uma conta.', icon: '👋', tags: ['{nome}'] }, - { id: 'whatsappTemplateNewContent', title: 'Novo Conteúdo (Carrossel)', desc: 'Enviada manualmente ao postar curso/módulo/aula.', icon: '🎬', tags: ['{nome}'] }, + { id: 'whatsappTemplateWelcome', title: 'Boas-Vindas (Nova Conta)', desc: 'Enviada automaticamente quando o aluno cria uma conta.', icon: '👋', tags: ['{nome}', '{curso}', '{plano}', '{valor}'] }, + { id: 'whatsappTemplateNewContent', title: 'Novo Conteúdo (Carrossel)', desc: 'Enviada manualmente ao postar curso/módulo/aula.', icon: '🎬', tags: ['{nome}', '{curso}', '{modulo}', '{plano}', '{valor}'] }, ]; return ( @@ -531,27 +531,53 @@ export default function AdminMessagesView() { ref={broadcastRef} value={broadcastText} onChange={(e) => setBroadcastText(e.target.value)} - className="w-full h-40 bg-black/40 border border-white/10 rounded-lg p-3 pr-12 text-white text-sm focus:outline-none focus:border-amber-500/50 resize-none" + className="w-full h-40 bg-black/40 border border-white/10 rounded-lg p-3 text-white text-sm focus:outline-none focus:border-amber-500/50 resize-none" placeholder="Escreva a mensagem de promoção aqui..." /> -
- + {showBroadcastEmojiPicker && ( +
+ {EMOJI_LIST.map(emoji => ( + + ))} +
+ )}
- {showBroadcastEmojiPicker && ( -
- {EMOJI_LIST.map(emoji => ( - - ))} -
- )}
@@ -587,16 +613,34 @@ export default function AdminMessagesView() {
)} - {/* Template Edit Modal */} { setActiveTemplateModal(null); setShowEmojiPicker(false); }} title={whatsappTemplates.find(t => t.id === activeTemplateModal)?.title || 'Editar Template'} isGlass={true}>
-
+

Formatação do WhatsApp: Use *negrito*, _itálico_, ~riscado~.

-

Tags disponíveis:{' '} - {whatsappTemplates.find(t => t.id === activeTemplateModal)?.tags.map(tag => ( - {tag} +

+ Tags: + {['{nome}', '{curso}', '{modulo}', '{plano}', '{valor}'].map(tag => ( + { + if (textareaRef.current) { + const start = textareaRef.current.selectionStart; + const end = textareaRef.current.selectionEnd; + const newText = currentTemplateText.substring(0, start) + tag + currentTemplateText.substring(end); + setCurrentTemplateText(newText); + setTimeout(() => { + textareaRef.current?.focus(); + textareaRef.current?.setSelectionRange(start + tag.length, start + tag.length); + }, 0); + } else { + setCurrentTemplateText(prev => prev + tag); + } + }} + >{tag} ))} -

+
@@ -604,20 +648,23 @@ export default function AdminMessagesView() { ref={textareaRef} value={currentTemplateText} onChange={(e) => setCurrentTemplateText(e.target.value)} - className="w-full h-52 bg-black/40 border border-white/10 rounded-lg p-3 pr-12 text-white text-sm focus:outline-none focus:border-[#E50914] resize-none" + className="w-full h-52 bg-black/40 border border-white/10 rounded-lg p-3 text-white text-sm focus:outline-none focus:border-[#E50914] resize-none" placeholder="Escreva a mensagem aqui..." /> -
- -
+
+ + {/* Emoji picker row - outside textarea, fully visible */} +
+ {showEmojiPicker && ( -
+
{EMOJI_LIST.map(emoji => ( -