From 6f2bc80b0cf074faefbc321140e878b25b427792 Mon Sep 17 00:00:00 2001 From: Sidney Date: Sun, 7 Jun 2026 20:48:52 -0300 Subject: [PATCH] fix: correcoes no logout, edicao de perfil, favicons e botao de limpar notificacoes --- admin/src/app/layout.tsx | 3 ++ admin/src/app/page.tsx | 17 +++++++--- src/app/layout.tsx | 3 ++ src/app/page.tsx | 1 + src/components/Settings.tsx | 67 +++++++++++-------------------------- src/components/Topbar.tsx | 29 +++++++++++----- 6 files changed, 58 insertions(+), 62 deletions(-) diff --git a/admin/src/app/layout.tsx b/admin/src/app/layout.tsx index ce87198..7d895d5 100644 --- a/admin/src/app/layout.tsx +++ b/admin/src/app/layout.tsx @@ -4,6 +4,9 @@ import "./globals.css"; export const metadata: Metadata = { title: "AgendaPRO Admin — Gerenciador de Assinaturas", description: "Painel administrativo para gerenciamento de assinaturas, tenants e planos do AgendaPRO SaaS.", + icons: { + icon: 'data:image/svg+xml,🛡️' + } }; export default function RootLayout({ children }: { children: React.ReactNode }) { diff --git a/admin/src/app/page.tsx b/admin/src/app/page.tsx index 0b6adf7..46f9910 100644 --- a/admin/src/app/page.tsx +++ b/admin/src/app/page.tsx @@ -196,11 +196,18 @@ export default function AdminPage() { }}>

Notificações

- {unreadCount > 0 && ( - - )} +
+ {unreadCount > 0 && ( + + )} + {notifications.length > 0 && ( + + )} +
{notifications.map(n => ( diff --git a/src/app/layout.tsx b/src/app/layout.tsx index 1201bb7..6870f4d 100644 --- a/src/app/layout.tsx +++ b/src/app/layout.tsx @@ -4,6 +4,9 @@ import "./globals.css"; export const metadata: Metadata = { title: "AgendaPRO — Sistema de Agendamento SaaS", description: "Plataforma completa de agendamento para barbearias, manicures, massagens e estética. Gerencie sua agenda, clientes e pagamentos.", + icons: { + icon: 'data:image/svg+xml,📅' + } }; export default function RootLayout({ children }: { children: React.ReactNode }) { diff --git a/src/app/page.tsx b/src/app/page.tsx index bfee4a2..f12bc72 100644 --- a/src/app/page.tsx +++ b/src/app/page.tsx @@ -143,6 +143,7 @@ export default function Home() { title={pages[currentPage]?.title || 'Dashboard'} subtitle={pages[currentPage]?.subtitle || ''} onMenuClick={() => setSidebarOpen(true)} + onNavigate={setCurrentPage} />
{renderPage()} diff --git a/src/components/Settings.tsx b/src/components/Settings.tsx index a70535b..769494b 100644 --- a/src/components/Settings.tsx +++ b/src/components/Settings.tsx @@ -1,5 +1,5 @@ import { useState, useEffect } from 'react'; -import { Store, Clock, Globe, Bell, Palette, Shield, Save, Copy, ExternalLink, Check, Link, Eye, EyeOff } from 'lucide-react'; +import { Store, Clock, Globe, Bell, Palette, Shield, Save, Copy, ExternalLink, Check, Link } from 'lucide-react'; const tabs = [ { id: 'general', label: 'Geral', icon: Store }, @@ -397,54 +397,25 @@ export default function Settings() { )} {activeTab === 'security' && ( - +
+

Segurança

+
+ + +
+
+
+ + +
+
+ + +
+
+ +
)}
); } - -function SecurityTab({ handleSave, saved }: { handleSave: () => void; saved: boolean }) { - const [showCurrent, setShowCurrent] = useState(false); - const [showNew, setShowNew] = useState(false); - const [showConfirm, setShowConfirm] = useState(false); - - // Re-importing specific lucide icons dynamically if possible, or we can use a generic button. - // Actually, we can use Eye and EyeOff if we import them at the top. Let's assume they are imported. - // Wait, I need to add the import at the top of the file! - // For now, I'll just use a button that says "Mostrar" or "Ocultar", or try to use Eye/EyeOff. - return ( -
-

Segurança

-
- -
- - -
-
-
-
- -
- - -
-
-
- -
- - -
-
-
- -
- ); -} diff --git a/src/components/Topbar.tsx b/src/components/Topbar.tsx index b16a29e..36de9e0 100644 --- a/src/components/Topbar.tsx +++ b/src/components/Topbar.tsx @@ -5,6 +5,7 @@ interface TopbarProps { title: string; subtitle: string; onMenuClick: () => void; + onNavigate?: (page: string) => void; } const mockNotifications = [ @@ -13,10 +14,10 @@ const mockNotifications = [ { id: 3, title: 'Estoque Baixo', message: 'Pomada modeladora abaixo de 5 unidades', type: 'warning', time: '1 dia atrás', read: true }, ]; -export default function Topbar({ title, subtitle, onMenuClick }: TopbarProps) { +export default function Topbar({ title, subtitle, onMenuClick, onNavigate }: TopbarProps) { const [avatarInitials, setAvatarInitials] = useState('AD'); const [tenantName, setTenantName] = useState('Administrador'); - const [email, setEmail] = useState(''); + const [email, setEmail] = useState('admin@agendapro.com'); const [showNotifications, setShowNotifications] = useState(false); const [showProfile, setShowProfile] = useState(false); @@ -88,9 +89,12 @@ export default function Topbar({ title, subtitle, onMenuClick }: TopbarProps) { }; const logout = () => { + localStorage.removeItem('agendapro_token'); localStorage.removeItem('agendapro_tenant_slug'); localStorage.removeItem('agendapro_tenant_name'); - window.location.href = '/'; + localStorage.removeItem('agendapro_email'); + localStorage.removeItem('agendapro_role'); + window.location.href = '/login'; }; const unreadCount = notifications.filter(n => !n.read).length; @@ -133,11 +137,18 @@ export default function Topbar({ title, subtitle, onMenuClick }: TopbarProps) { }}>

Notificações

- {unreadCount > 0 && ( - - )} +
+ {unreadCount > 0 && ( + + )} + {notifications.length > 0 && ( + + )} +
{notifications.map(n => ( @@ -181,7 +192,7 @@ export default function Topbar({ title, subtitle, onMenuClick }: TopbarProps) {
{email}
-