diff --git a/susconecta/app/(main-routes)/perfil/page.tsx b/susconecta/app/(main-routes)/perfil/page.tsx
index 0308815..734aa6f 100644
--- a/susconecta/app/(main-routes)/perfil/page.tsx
+++ b/susconecta/app/(main-routes)/perfil/page.tsx
@@ -296,7 +296,7 @@ export default function PerfilPage() {
className="bg-blue-600 hover:bg-blue-700"
onClick={handleEditClick}
>
- ✏️ Editar Perfil
+ Editar Perfil
) : (
diff --git a/susconecta/app/paciente/page.tsx b/susconecta/app/paciente/page.tsx
index c39ee77..6f658f6 100644
--- a/susconecta/app/paciente/page.tsx
+++ b/susconecta/app/paciente/page.tsx
@@ -865,17 +865,33 @@ export default function PacientePage() {
try {
const ok = typeof window !== 'undefined' ? window.confirm('Deseja realmente cancelar esta consulta?') : true
if (!ok) return
- // call API to delete
- await deletarAgendamento(consulta.id)
- // Mark as deleted in cache so it won't appear again
- addDeletedAppointmentId(consulta.id)
- // remove from local list
+
+ // Prefer PATCH to mark appointment as cancelled (safer under RLS)
+ try {
+ await atualizarAgendamento(consulta.id, {
+ cancelled_at: new Date().toISOString(),
+ status: 'cancelled',
+ cancellation_reason: 'Cancelado pelo paciente'
+ })
+ } catch (patchErr) {
+ // Fallback: try hard delete if server allows it
+ try {
+ await deletarAgendamento(consulta.id)
+ } catch (delErr) {
+ // Re-throw original patch error if both fail
+ throw patchErr || delErr
+ }
+ }
+
+ // remove from local list so UI updates immediately
setAppointments((prev) => {
if (!prev) return prev
return prev.filter((a: any) => String(a.id) !== String(consulta.id))
})
// if modal open for this appointment, close it
if (selectedAppointment && String(selectedAppointment.id) === String(consulta.id)) setSelectedAppointment(null)
+ // Optionally persist to deleted cache to help client-side filtering
+ try { addDeletedAppointmentId(consulta.id) } catch(e) {}
setToast({ type: 'success', msg: 'Consulta cancelada.' })
} catch (err: any) {
console.error('[Consultas] falha ao cancelar agendamento', err)
@@ -1560,7 +1576,7 @@ export default function PacientePage() {
className="bg-blue-600 hover:bg-blue-700 w-full sm:w-auto whitespace-nowrap text-xs sm:text-sm"
onClick={() => setIsEditingProfile(true)}
>
- ✏️ Editar Perfil
+ Editar Perfil
) : (
diff --git a/susconecta/app/profissional/page.tsx b/susconecta/app/profissional/page.tsx
index bb715ad..34afd8a 100644
--- a/susconecta/app/profissional/page.tsx
+++ b/susconecta/app/profissional/page.tsx
@@ -2780,7 +2780,7 @@ const ProfissionalPage = () => {
className="bg-blue-600 hover:bg-blue-700 text-xs sm:text-sm w-full sm:w-auto"
onClick={() => setIsEditingProfile(true)}
>
- ✏️ Editar Perfil
+ Editar Perfil
) : (
diff --git a/susconecta/components/features/dashboard/header.tsx b/susconecta/components/features/dashboard/header.tsx
index c9587cf..5b78f26 100644
--- a/susconecta/components/features/dashboard/header.tsx
+++ b/susconecta/components/features/dashboard/header.tsx
@@ -60,9 +60,32 @@ export function PagesHeader({ title = "", subtitle = "" }: { title?: string, sub
className="relative h-8 w-8 rounded-full border-2 border-border hover:border-primary"
onClick={() => setDropdownOpen(!dropdownOpen)}
>
+ {/* Mostrar foto do usuário quando disponível; senão, mostrar fallback com iniciais */}
-
- RA
+ {
+ (() => {
+ const userPhoto = (user as any)?.profile?.foto_url || (user as any)?.profile?.fotoUrl || (user as any)?.profile?.avatar_url
+ const alt = user?.name || user?.email || 'Usuário'
+
+ const getInitials = (name?: string, email?: string) => {
+ if (name) {
+ const parts = name.trim().split(/\s+/)
+ const first = parts[0]?.charAt(0) ?? ''
+ const second = parts[1]?.charAt(0) ?? ''
+ return (first + second).toUpperCase() || (email?.charAt(0) ?? 'U').toUpperCase()
+ }
+ if (email) return email.charAt(0).toUpperCase()
+ return 'U'
+ }
+
+ return (
+ <>
+
+ {getInitials(user?.name, user?.email)}
+ >
+ )
+ })()
+ }
@@ -94,11 +117,9 @@ export function PagesHeader({ title = "", subtitle = "" }: { title?: string, sub
}}
className="w-full text-left px-4 py-2 text-sm hover:bg-accent cursor-pointer"
>
- 👤 Perfil
-
-
+