Files
sirpremiumv2/resources/views/chat-publico.blade.php
T
LizandroandClaude Sonnet 4.6 a3bd91c204 fix(chat): scroll móvil + input no desaparece al teclear
- Wrapper del chat: flex-1 + min-h-0 (en vez de h-full) para scroll correcto
- Área de mensajes: min-h-0 explícito — crítico para que flex-1 haga scroll en iOS/Android
- Input: flex-shrink:0 inline para reforzar que nunca se comprima
- visualViewport: usa requestAnimationFrame para scroll más suave, elimina listener scroll

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-07-14 02:34:48 +00:00

134 lines
4.4 KiB
PHP

<!DOCTYPE html>
<html lang="{{ str_replace('_', '-', app()->getLocale()) }}">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, viewport-fit=cover">
<meta name="csrf-token" content="{{ csrf_token() }}">
<meta name="color-scheme" content="dark">
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="apple-mobile-web-app-status-bar-style" content="black-translucent">
<meta name="apple-mobile-web-app-title" content="Chat">
<title>Chat en vivo | {{ config('app.name') }}</title>
<link href="https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600&display=swap" rel="stylesheet">
<script src="https://cdn.tailwindcss.com"></script>
<style>
*, *::before, *::after { box-sizing: border-box; }
html, body {
margin: 0; padding: 0;
font-family: 'Inter', sans-serif;
-webkit-tap-highlight-color: transparent;
overscroll-behavior: none;
}
/* Móvil: pantalla completa */
body {
background: #111b21;
height: 100vh;
height: 100dvh;
height: -webkit-fill-available;
overflow: hidden;
}
/* Desktop: fondo con gradiente + chat centrado como frame */
@media (min-width: 640px) {
body {
background: #0d1117;
display: flex;
align-items: center;
justify-content: center;
overflow: hidden;
}
}
/* El contenedor del chat */
#chat-root {
width: 100%;
height: 100vh;
height: 100dvh;
height: -webkit-fill-available;
display: flex;
flex-direction: column;
background: #111b21;
overflow: hidden;
}
@media (min-width: 640px) {
#chat-root {
width: 420px;
height: 90vh;
height: 90dvh;
max-height: 820px;
border-radius: 20px;
box-shadow: 0 24px 64px rgba(0,0,0,.6);
overflow: hidden;
}
}
/* Evita zoom en inputs iOS */
input, textarea, select { font-size: 16px !important; }
/* Scroll suave nativo */
.ios-scroll {
-webkit-overflow-scrolling: touch;
overscroll-behavior-y: contain;
}
/* Elimina appearance por defecto iOS */
input[type="tel"], input[type="text"],
input[type="email"], textarea {
-webkit-appearance: none;
appearance: none;
border-radius: 12px;
}
button {
-webkit-appearance: none;
touch-action: manipulation;
cursor: pointer;
}
/* Safe areas (solo afectan en iOS con viewport-fit=cover) */
.safe-top { padding-top: env(safe-area-inset-top, 0px); }
.safe-bottom { padding-bottom: env(safe-area-inset-bottom, 0px); }
.safe-left { padding-left: env(safe-area-inset-left, 0px); }
.safe-right { padding-right: env(safe-area-inset-right, 0px); }
</style>
@livewireStyles
</head>
<body>
<livewire:chat.public-chat />
<script defer src="https://unpkg.com/alpinejs@3.x.x/dist/cdn.min.js"></script>
@livewireScripts
<script>
/* Ajusta altura del chat cuando aparece el teclado en móvil */
function initViewportFix() {
const root = document.getElementById('chat-root');
if (!root || !window.visualViewport) return;
const update = () => {
const vh = window.visualViewport.height;
// En móvil: ajustamos #chat-root a la altura visual real
if (window.innerWidth < 640) {
root.style.height = vh + 'px';
}
// Scroll al fondo siempre que cambie el viewport
const msgs = document.getElementById('pub-messages');
if (msgs) {
requestAnimationFrame(() => { msgs.scrollTop = msgs.scrollHeight; });
}
};
window.visualViewport.addEventListener('resize', update);
update();
}
document.addEventListener('DOMContentLoaded', initViewportFix);
document.addEventListener('livewire:load', initViewportFix);
</script>
</body>
</html>