fix(chat): menú no se repite + responsive corregido

- abrirChat(): mueve cargarMensajes() al final (después de crear mensajes en DB)
- abrirChat(): siempre agrega saludo+menú al autenticarse (no hay duplicación
  porque mount() no llama a abrirChat())
- mount(): solo restaura estado desde sesión, sin agregar mensajes nuevos
- public-chat.blade.php: root div recupera flex flex-col (flex-1 en hijos funciona)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Lizandro
2026-07-14 01:32:29 +00:00
co-authored by Claude Sonnet 4.6
parent d27bd1c0d7
commit a9d8253800
2 changed files with 12 additions and 4 deletions
+11 -3
View File
@@ -267,9 +267,10 @@ class PublicChat extends Component
$this->saldoUsuario = $user->saldo?->valor ?? 0;
}
$conv = $contact->activeConversation();
$conv = $contact->activeConversation();
$esNueva = ! $conv;
if (! $conv) {
if ($esNueva) {
$conv = ChatConversation::create([
'contact_id' => $contact->id,
'canal' => 'web',
@@ -280,6 +281,12 @@ class PublicChat extends Component
? "¡Hola, {$this->nombreUsuario}! Bienvenido."
: "¡Hola! Bienvenido.";
$this->guardarMensajeBot($conv->id, $saludo);
} else {
// Conversación existente: el usuario acaba de verificarse por OTP
$saludo = $this->nombreUsuario
? "Bienvenido de nuevo, {$this->nombreUsuario}!"
: "Bienvenido de nuevo!";
$this->guardarMensajeBot($conv->id, $saludo);
}
$this->convId = $conv->id;
@@ -289,8 +296,9 @@ class PublicChat extends Component
session()->put('chat_user_id', $this->userId);
session()->put('chat_conv_id', $conv->id);
$this->cargarMensajes();
// Siempre muestra el menú al autenticarse (mount no llama a este método)
$this->mostrarMenuPrincipal($conv->id);
$this->cargarMensajes();
}
private function enmascararEmail(string $email): string
@@ -1,4 +1,4 @@
<div id="chat-root">
<div id="chat-root" class="flex flex-col bg-[#111b21] w-full overflow-hidden" style="height:100vh;height:100dvh;height:-webkit-fill-available;">
{{-- ══ PASO 1: Ingreso de correo ══ --}}
@if ($paso === 'email')