From f75dba0a8f86ede58d6c66181ab9b31c25fc0828 Mon Sep 17 00:00:00 2001 From: VPS 4 Deploy Agent Date: Sun, 28 Jun 2026 05:53:45 +0200 Subject: [PATCH] =?UTF-8?q?feat(settings):=20oculta=20termos=20t=C3=A9cnic?= =?UTF-8?q?os=20(Baileys/Infinity)=20para=20n=C3=A3o-admin?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Os rótulos técnicos das engines só aparecem para admin ou ruibto@gmail.com: - usuário comum vê "API estável" e "API com botões"; - admin/ruibto vê "API estável (Baileys 7)" e "InfinityAPI". (O item 'Baileys' na Sidebar e a página /baileys já são admin-only.) Co-Authored-By: Claude Opus 4.8 --- .../frontend/components/SettingsPanel.tsx | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/newwhats.clube67.com/newwhats.local/frontend/components/SettingsPanel.tsx b/newwhats.clube67.com/newwhats.local/frontend/components/SettingsPanel.tsx index 0c9e87f..aaae429 100644 --- a/newwhats.clube67.com/newwhats.local/frontend/components/SettingsPanel.tsx +++ b/newwhats.clube67.com/newwhats.local/frontend/components/SettingsPanel.tsx @@ -1,5 +1,6 @@ import React, { useEffect, useState, useCallback } from 'react'; import { ShieldCheck, LayoutGrid, Check, Loader2, Tag, AlertTriangle, Briefcase } from 'lucide-react'; +import { useAuthStore } from '../store/authStore'; interface SettingsPanelProps { instanceId: string | null; @@ -8,18 +9,22 @@ interface SettingsPanelProps { // Engines oferecidas no painel. A 'official' (Baileys 6, que dá 401) fica de fora. // baileys7 → Baileys 7 oficial (a que conecta) → rótulo "API estável" // infinite → InfinityAPI (com botões) +// titulo = rótulo genérico (todos os usuários). tituloTec = rótulo técnico +// (Baileys/Infinity), exibido apenas para admin/ruibto@gmail.com. const ENGINES: { - value: string; titulo: string; desc: string; icon: any; + value: string; titulo: string; tituloTec?: string; desc: string; icon: any; iconCls: string; activeBorder: string; activeBg: string; checkCls: string; btnCls: string; }[] = [ { - value: 'baileys7', titulo: 'API estável', desc: 'Conexão recomendada do WhatsApp', + value: 'baileys7', titulo: 'API estável', tituloTec: 'API estável (Baileys 7)', + desc: 'Conexão recomendada do WhatsApp', icon: ShieldCheck, iconCls: 'text-emerald-500', activeBorder: 'border-emerald-400', activeBg: 'bg-emerald-50', checkCls: 'text-emerald-600', btnCls: 'bg-emerald-500 hover:bg-emerald-600', }, { - value: 'infinite', titulo: 'InfinityAPI', desc: 'Com botões interativos (experimental)', + value: 'infinite', titulo: 'API com botões', tituloTec: 'InfinityAPI', + desc: 'Com botões interativos (experimental)', icon: LayoutGrid, iconCls: 'text-amber-500', activeBorder: 'border-amber-400', activeBg: 'bg-amber-50', checkCls: 'text-amber-600', btnCls: 'bg-amber-500 hover:bg-amber-600', @@ -27,6 +32,9 @@ const ENGINES: { ]; export default function SettingsPanel({ instanceId }: SettingsPanelProps) { + const user = useAuthStore((s) => s.user); + // Termos técnicos (Baileys/Infinity) só para admin ou ruibto@gmail.com. + const canSeeTech = user?.role === 'ADMIN' || user?.email === 'ruibto@gmail.com'; const [engine, setEngine] = useState(null); const [isBusiness, setIsBusiness] = useState(null); const [loading, setLoading] = useState(false); @@ -125,7 +133,7 @@ export default function SettingsPanel({ instanceId }: SettingsPanelProps) {
-

{opt.titulo}

+

{canSeeTech && opt.tituloTec ? opt.tituloTec : opt.titulo}

{opt.desc}

{ativa ? (