ax / index.html
axbraper's picture
ponle un boton. si no se aprieta la opcion de division de gasto aparecer con menos opacidad. pero si se usa el boton se mostrara con total opacidad - Follow Up Deployment
bd7d69e verified
Raw History Blame Contribute Delete
42.5 kB
<!DOCTYPE html>
<html lang="es">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
<title>LoveSplit - Gestión de gastos para parejas</title>
<script src="https://cdn.tailwindcss.com"></script>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
<script>
tailwind.config = {
theme: {
extend: {
colors: {
primary: {
light: '#FEF08A',
DEFAULT: '#FACC15',
dark: '#EAB308',
},
secondary: '#F5F5F5',
dark: '#1E293B',
}
}
}
}
</script>
<style>
@supports (padding: max(0px)) {
.safe-area-inset-bottom {
padding-bottom: max(12px, env(safe-area-inset-bottom));
}
}
.tab-active {
border-bottom: 3px solid #FACC15;
color: #1E293B;
font-weight: 600;
}
.chat-bubble {
max-width: 85%;
border-radius: 1rem;
padding: 0.75rem;
font-size: 0.9rem;
box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}
.user-bubble {
background-color: #FACC15;
align-self: flex-end;
border-radius: 1rem 1rem 0.25rem 1rem;
color: #1E293B;
}
.bot-bubble {
background-color: #F5F5F5;
align-self: flex-start;
border-radius: 1rem 1rem 1rem 0.25rem;
color: #1E293B;
}
.expense-card:hover {
transform: translateY(-2px);
box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
}
.animate-pulse {
animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}
@keyframes pulse {
0%, 100% {
opacity: 1;
}
50% {
opacity: 0.5;
}
}
</style>
</head>
<body class="bg-gray-50 font-sans">
<div class="max-w-md mx-auto bg-white min-h-screen shadow-lg flex flex-col">
<!-- Header -->
<header class="bg-primary p-4 text-white flex justify-between items-center">
<div class="flex items-center space-x-2">
<i class="fas fa-heart text-xl"></i>
<h1 class="text-xl font-bold">LoveSplit</h1>
</div>
<div class="flex items-center space-x-3">
<button class="p-1 rounded-full bg-primary-dark">
<i class="fas fa-bell text-white"></i>
</button>
<div class="w-8 h-8 rounded-full bg-white flex items-center justify-center">
<i class="fas fa-user text-primary"></i>
</div>
</div>
</header>
<!-- Main Content -->
<main class="flex-1 overflow-y-auto pb-20">
<!-- Tab Contents -->
<div id="tab-contents">
<!-- Dashboard Tab -->
<div id="dashboard" class="tab-content active p-4">
<div class="bg-primary-light rounded-lg p-4 mb-4">
<h2 class="text-lg font-semibold mb-2">Resumen del mes</h2>
<div class="grid grid-cols-2 gap-4">
<div class="bg-white rounded-lg p-3 shadow">
<p class="text-sm text-gray-500">Gastos totales</p>
<p class="text-xl font-bold">$1,250</p>
</div>
<div class="bg-white rounded-lg p-3 shadow">
<p class="text-sm text-gray-500">Tu parte</p>
<p class="text-xl font-bold">$625</p>
</div>
</div>
</div>
<div class="mb-6">
<h2 class="text-lg font-semibold mb-3">Gastos recientes</h2>
<div class="space-y-3">
<div class="expense-card bg-white rounded-lg p-3 shadow transition duration-200">
<div class="flex justify-between">
<div>
<p class="font-medium">Supermercado</p>
<p class="text-sm text-gray-500">Hoy - 50% compartido</p>
</div>
<p class="font-bold text-primary">$120</p>
</div>
</div>
<div class="expense-card bg-white rounded-lg p-3 shadow transition duration-200">
<div class="flex justify-between">
<div>
<p class="font-medium">Cena romántica</p>
<p class="text-sm text-gray-500">Ayer - 100% tú</p>
</div>
<p class="font-bold text-primary">$85</p>
</div>
</div>
</div>
</div>
<div>
<div class="bg-gradient-to-br from-primary-light to-white rounded-xl p-4 shadow-lg">
<div class="flex items-center mb-3">
<div class="w-8 h-8 rounded-full bg-primary flex items-center justify-center mr-2">
<i class="fas fa-robot text-white"></i>
</div>
<h3 class="font-semibold">Gestor Financiero</h3>
</div>
<div id="chat-container" class="h-48 overflow-y-auto mb-3 flex flex-col space-y-3 p-2 bg-white rounded-lg">
<div class="chat-bubble bot-bubble">
<p class="text-sm">¿En qué puedo ayudarte hoy con tus gastos?</p>
</div>
</div>
<div class="flex items-center bg-white rounded-full p-1 shadow-sm">
<input type="text" placeholder="Escribe tu mensaje..." class="flex-1 rounded-full px-4 py-2 focus:outline-none">
<button class="bg-primary text-white p-2 rounded-full w-10 h-10 flex items-center justify-center">
<i class="fas fa-paper-plane"></i>
</button>
</div>
</div>
</div>
</div>
<!-- Add Expense Tab -->
<div id="add-expense" class="tab-content hidden p-4">
<h2 class="text-lg font-semibold mb-4">Agregar nuevo gasto</h2>
<form>
<div class="mb-4">
<label class="block text-gray-700 mb-2">Descripción</label>
<input type="text" class="w-full p-2 border rounded-lg" placeholder="Ej: Cena romántica">
</div>
<div class="mb-4">
<label class="block text-gray-700 mb-2">Monto</label>
<div class="relative">
<span class="absolute left-3 top-2">$</span>
<input type="number" class="w-full p-2 pl-8 border rounded-lg" placeholder="0.00" inputmode="decimal">
</div>
</div>
<div class="mb-4">
<label class="block text-gray-700 mb-2">Fecha</label>
<input type="date" class="w-full p-2 border rounded-lg">
</div>
<div class="mb-4">
<label class="block text-gray-700 mb-2">Categoría</label>
<select class="w-full p-2 border rounded-lg">
<option>Comida</option>
<option>Transporte</option>
<option>Entretenimiento</option>
<option>Hogar</option>
<option>Gasto fijo</option>
<option>Otros</option>
</select>
</div>
<div class="mb-4">
<label class="block text-gray-700 mb-2">¿Quién pagó?</label>
<div class="grid grid-cols-2 gap-3">
<label class="flex flex-col items-center p-3 border rounded-lg cursor-pointer hover:bg-gray-50">
<input type="radio" name="payer" class="hidden peer" value="user" checked>
<div class="w-12 h-12 rounded-full bg-blue-100 flex items-center justify-center mb-2 overflow-hidden">
<img src="https://randomuser.me/api/portraits/women/44.jpg" alt="Profile" class="w-full h-full object-cover">
</div>
<span class="text-sm">Yo</span>
<div class="w-5 h-5 rounded-full border-2 border-gray-300 peer-checked:border-primary mt-1 flex items-center justify-center">
<div class="w-3 h-3 rounded-full bg-primary hidden peer-checked:block"></div>
</div>
</label>
<label class="flex flex-col items-center p-3 border rounded-lg cursor-pointer hover:bg-gray-50">
<input type="radio" name="payer" class="hidden peer" value="partner">
<div class="w-12 h-12 rounded-full bg-pink-100 flex items-center justify-center mb-2 overflow-hidden">
<img src="https://randomuser.me/api/portraits/men/32.jpg" alt="Profile" class="w-full h-full object-cover">
</div>
<span class="text-sm">Carlos</span>
<div class="w-5 h-5 rounded-full border-2 border-gray-300 peer-checked:border-primary mt-1 flex items-center justify-center">
<div class="w-3 h-3 rounded-full bg-primary hidden peer-checked:block"></div>
</div>
</label>
</div>
</div>
<div class="mb-4">
<label class="block text-gray-700 mb-1 text-sm">División del gasto</label>
<div class="space-y-2">
<div class="flex items-center bg-white p-2 rounded-lg shadow text-sm">
<div class="w-8 h-8 rounded-full bg-blue-100 flex-shrink-0 flex items-center justify-center overflow-hidden mr-2">
<img src="https://randomuser.me/api/portraits/women/44.jpg" alt="Profile" class="w-full h-full object-cover">
</div>
<div class="flex-1">
<p class="font-medium">Tu parte</p>
<div class="relative mt-1">
<span class="absolute left-2 top-1 text-xs">$</span>
<input type="number" id="user-amount" class="w-full p-1 pl-6 border rounded text-sm" placeholder="0.00" inputmode="decimal">
</div>
</div>
</div>
<div class="flex items-center bg-white p-2 rounded-lg shadow text-sm">
<div class="w-8 h-8 rounded-full bg-pink-100 flex-shrink-0 flex items-center justify-center overflow-hidden mr-2">
<img src="https://randomuser.me/api/portraits/men/32.jpg" alt="Profile" class="w-full h-full object-cover">
</div>
<div class="flex-1">
<p class="font-medium">Parte de Carlos</p>
<div class="relative mt-1">
<span class="absolute left-2 top-1 text-xs">$</span>
<input type="number" id="partner-amount" class="w-full p-1 pl-6 border rounded text-sm" placeholder="0.00" inputmode="decimal">
</div>
</div>
</div>
<button type="button" class="w-full py-2 bg-gray-100 hover:bg-gray-200 text-gray-700 rounded-lg text-sm font-medium transition duration-200">
<i class="fas fa-divide mr-1"></i> Dividir monto exacto
</button>
</div>
<p id="split-error" class="text-red-500 text-xs mt-1 hidden">La suma debe coincidir con el monto total</p>
</div>
<button type="submit" class="w-full bg-primary text-white py-2 rounded-lg font-medium mt-4">
Guardar gasto
</button>
</form>
</div>
<!-- History Tab -->
<div id="history" class="tab-content hidden p-4">
<h2 class="text-lg font-semibold mb-4">Historial de gastos</h2>
<div class="mb-4">
<h3 class="text-center font-medium mb-2">Junio 2023</h3>
<div class="grid grid-cols-7 gap-1 text-center text-sm">
<div class="font-medium">L</div>
<div class="font-medium">M</div>
<div class="font-medium">X</div>
<div class="font-medium">J</div>
<div class="font-medium">V</div>
<div class="font-medium">S</div>
<div class="font-medium">D</div>
<!-- Empty days for start of month -->
<div class="py-2"></div>
<div class="py-2"></div>
<div class="py-2"></div>
<div class="py-2"></div>
<!-- Calendar days -->
<div class="py-2">1</div>
<div class="py-2">2</div>
<div class="py-2">3</div>
<div class="py-2">4</div>
<div class="py-2 rounded-full bg-blue-100">5</div>
<div class="py-2">6</div>
<div class="py-2">7</div>
<div class="py-2">8</div>
<div class="py-2">9</div>
<div class="py-2">10</div>
<div class="py-2">11</div>
<div class="py-2 rounded-full bg-pink-100">12</div>
<div class="py-2">13</div>
<div class="py-2 rounded-full bg-blue-100">14</div>
<div class="py-2 rounded-full bg-blue-100">15</div>
<div class="py-2">16</div>
<div class="py-2">17</div>
<div class="py-2">18</div>
<div class="py-2">19</div>
<div class="py-2">20</div>
<div class="py-2">21</div>
<div class="py-2">22</div>
<div class="py-2">23</div>
<div class="py-2">24</div>
<div class="py-2">25</div>
<div class="py-2">26</div>
<div class="py-2">27</div>
<div class="py-2">28</div>
<div class="py-2">29</div>
<div class="py-2">30</div>
</div>
<div class="flex justify-center mt-3 space-x-4">
<div class="flex items-center">
<div class="w-3 h-3 rounded-full bg-blue-100 mr-1 border border-blue-500"></div>
<span class="text-xs">Tus gastos</span>
</div>
<div class="flex items-center">
<div class="w-3 h-3 rounded-full bg-pink-100 mr-1 border border-pink-500"></div>
<span class="text-xs">Gastos pareja</span>
</div>
</div>
</div>
<div class="space-y-3">
<div class="expense-card bg-white rounded-lg p-3 shadow">
<div class="flex justify-between items-center">
<div>
<p class="font-medium">Supermercado</p>
<p class="text-sm text-gray-500">15 Jun - Comida</p>
</div>
<div class="text-right">
<p class="font-bold text-primary">$120</p>
<p class="text-xs text-gray-500">Tú: $60</p>
</div>
</div>
</div>
<div class="expense-card bg-white rounded-lg p-3 shadow">
<div class="flex justify-between items-center">
<div>
<p class="font-medium">Cena romántica</p>
<p class="text-sm text-gray-500">14 Jun - Comida</p>
</div>
<div class="text-right">
<p class="font-bold text-primary">$85</p>
<p class="text-xs text-gray-500">Tú: $85</p>
</div>
</div>
</div>
<div class="expense-card bg-white rounded-lg p-3 shadow">
<div class="flex justify-between items-center">
<div>
<p class="font-medium">Gasolina</p>
<p class="text-sm text-gray-500">12 Jun - Transporte</p>
</div>
<div class="text-right">
<p class="font-bold text-primary">$45</p>
<p class="text-xs text-gray-500">Tú: $22.5</p>
</div>
</div>
</div>
</div>
</div>
<!-- Balance Tab -->
<div id="balance" class="tab-content hidden p-4">
<h2 class="text-lg font-semibold mb-4">Balance</h2>
<div class="bg-white rounded-lg p-4 shadow mb-4">
<h3 class="font-medium mb-4">Balance Comparativo</h3>
<div class="flex items-end space-x-4 h-32">
<div class="flex-1 flex flex-col items-center">
<div class="w-full bg-blue-500 rounded-t-lg" style="height: 70%">
<div class="relative h-full flex items-end justify-center">
<div class="absolute -top-10 w-8 h-8 rounded-full bg-blue-100 flex items-center justify-center overflow-hidden">
<img id="user-balance-avatar" src="https://randomuser.me/api/portraits/women/44.jpg" alt="Profile" class="w-full h-full object-cover">
</div>
<span class="text-white font-bold mb-1">$625</span>
</div>
</div>
</div>
<div class="flex-1 flex flex-col items-center">
<div class="w-full bg-pink-500 rounded-t-lg" style="height: 85%">
<div class="relative h-full flex items-end justify-center">
<div class="absolute -top-10 w-8 h-8 rounded-full bg-pink-100 flex items-center justify-center overflow-hidden">
<img id="partner-balance-avatar" src="https://randomuser.me/api/portraits/men/32.jpg" alt="Profile" class="w-full h-full object-cover">
</div>
<div class="relative">
<span class="text-white font-bold">$540 <i class="fas fa-trophy text-yellow-400 ml-1"></i></span>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="grid grid-cols-2 gap-4 mb-4">
<div class="bg-blue-100 rounded-lg p-3 border-l-4 border-blue-500">
<p class="text-sm text-gray-700">Tú debes</p>
<p class="text-xl font-bold text-blue-600">$540</p>
</div>
<div class="bg-pink-100 rounded-lg p-3 border-l-4 border-pink-500">
<p class="text-sm text-gray-700">Tu pareja debe</p>
<p class="text-xl font-bold text-pink-600">$625</p>
</div>
</div>
<div class="bg-white rounded-lg p-4 shadow">
<h3 class="font-medium mb-2">Sugerencias de pago</h3>
<div class="space-y-2">
<div class="flex justify-between items-center p-2 bg-secondary rounded">
<div>
<p class="font-medium">Pagar ahora</p>
<p class="text-xs text-gray-500">Liquida parte de la deuda</p>
</div>
<button class="bg-primary text-white px-2 py-1 rounded text-xs" onclick="showPaymentDetails('now')">Pagar $85</button>
</div>
<div class="flex justify-between items-center p-2 bg-secondary rounded">
<div>
<p class="font-medium">Dividir en fechas especiales</p>
<p class="text-xs text-gray-500">Aniversario, cumpleaños, etc.</p>
</div>
<button class="bg-primary text-white px-2 py-1 rounded text-xs" onclick="showPaymentDetails('schedule')">Programar</button>
</div>
<div id="payment-details" class="hidden bg-white p-3 rounded-lg shadow mt-2">
<h4 class="font-medium mb-2 text-sm">Detalles de pago</h4>
<div class="flex justify-between text-sm mb-1">
<span>Ana ha pagado:</span>
<span>$540</span>
</div>
<div class="flex justify-between text-sm mb-1">
<span>Carlos ha pagado:</span>
<span>$625</span>
</div>
<div class="flex justify-between text-sm font-medium mt-2">
<span>Diferencia:</span>
<span>$85</span>
</div>
<button class="w-full bg-primary text-white py-1 rounded text-sm mt-3" onclick="document.getElementById('payment-details').classList.add('hidden')">Cerrar</button>
</div>
</div>
</div>
</div>
<!-- Settings Tab -->
<div id="settings" class="tab-content hidden p-4">
<h2 class="text-lg font-semibold mb-4">Ajustes</h2>
<div class="bg-white rounded-lg shadow overflow-hidden mb-4">
<div class="p-4 border-b">
<div class="flex items-center mb-3">
<div class="w-12 h-12 rounded-full bg-blue-100 flex items-center justify-center mr-3 overflow-hidden">
<img id="user-avatar" src="https://randomuser.me/api/portraits/women/44.jpg" alt="Profile" class="w-full h-full object-cover">
</div>
<div>
<p class="font-medium">Ana López</p>
<p class="text-sm text-gray-500">Tu perfil</p>
</div>
</div>
<div class="flex space-x-2">
<button class="px-3 py-1 bg-gray-100 rounded-lg text-sm">Cambiar nombre</button>
<button class="px-3 py-1 bg-gray-100 rounded-lg text-sm">Cambiar foto</button>
</div>
</div>
<div class="p-4 border-b">
<div class="flex items-center mb-3">
<div class="w-12 h-12 rounded-full bg-pink-100 flex items-center justify-center mr-3 overflow-hidden">
<img id="partner-avatar" src="https://randomuser.me/api/portraits/men/32.jpg" alt="Profile" class="w-full h-full object-cover">
</div>
<div>
<p class="font-medium">Carlos Martínez</p>
<p class="text-sm text-gray-500">Tu pareja</p>
</div>
</div>
<div class="text-sm text-gray-500">
<p>carlos@ejemplo.com</p>
</div>
</div>
<div class="p-4 border-b">
<p class="font-medium mb-2">Notificaciones</p>
<div class="flex justify-between items-center">
<span>Recordatorios de pago</span>
<label class="relative inline-flex items-center cursor-pointer">
<input type="checkbox" class="sr-only peer" checked>
<div class="w-11 h-6 bg-gray-200 peer-focus:outline-none peer-focus:ring-4 peer-focus:ring-primary-light rounded-full peer peer-checked:after:translate-x-full peer-checked:after:border-white after:content-[''] after:absolute after:top-[2px] after:left-[2px] after:bg-white after:border-gray-300 after:border after:rounded-full after:h-5 after:w-5 after:transition-all peer-checked:bg-primary"></div>
</label>
</div>
</div>
<div class="p-4 border-b">
<p class="font-medium mb-2">Moneda</p>
<select class="w-full p-2 border rounded-lg">
<option>USD ($)</option>
<option>EUR (€)</option>
<option>GBP (£)</option>
<option>MXN ($)</option>
</select>
</div>
<div class="p-4">
<p class="font-medium mb-2">Color de usuario</p>
<div class="grid grid-cols-5 gap-2">
<button class="w-8 h-8 rounded-full bg-red-500 border-2 border-transparent" data-color="red"></button>
<button class="w-8 h-8 rounded-full bg-blue-500 border-2 border-transparent" data-color="blue"></button>
<button class="w-8 h-8 rounded-full bg-green-500 border-2 border-transparent" data-color="green"></button>
<button class="w-8 h-8 rounded-full bg-purple-500 border-2 border-transparent" data-color="purple"></button>
<button class="w-8 h-8 rounded-full bg-pink-500 border-2 border-transparent" data-color="pink"></button>
<button class="w-8 h-8 rounded-full bg-yellow-500 border-2 border-transparent" data-color="yellow"></button>
<button class="w-8 h-8 rounded-full bg-indigo-500 border-2 border-transparent" data-color="indigo"></button>
<button class="w-8 h-8 rounded-full bg-teal-500 border-2 border-transparent" data-color="teal"></button>
<button class="w-8 h-8 rounded-full bg-orange-500 border-2 border-transparent" data-color="orange"></button>
<button class="w-8 h-8 rounded-full bg-gray-500 border-2 border-transparent" data-color="gray"></button>
</div>
</div>
</div>
<div class="space-y-2">
<button class="w-full py-2 border rounded-lg font-medium flex items-center justify-center">
<i class="fas fa-question-circle mr-2"></i> Ayuda y soporte
</button>
<button class="w-full py-2 border rounded-lg font-medium flex items-center justify-center text-red-500">
<i class="fas fa-sign-out-alt mr-2"></i> Cerrar sesión
</button>
</div>
</div>
</div>
</main>
<!-- Bottom Navigation (for mobile) -->
<nav class="fixed bottom-0 w-full max-w-md bg-white border-t flex justify-around py-3 safe-area-inset-bottom">
<button class="p-2 text-primary tab-mobile active" data-tab="dashboard">
<i class="fas fa-home text-lg"></i>
<span class="text-xs block mt-1">Inicio</span>
</button>
<button class="p-2 text-gray-500 tab-mobile" data-tab="add-expense">
<i class="fas fa-plus-circle text-lg"></i>
<span class="text-xs block mt-1">Agregar</span>
</button>
<button class="p-2 text-gray-500 tab-mobile" data-tab="history">
<i class="fas fa-history text-lg"></i>
<span class="text-xs block mt-1">Historial</span>
</button>
<button class="p-2 text-gray-500 tab-mobile" data-tab="balance">
<i class="fas fa-chart-pie text-lg"></i>
<span class="text-xs block mt-1">Balance</span>
</button>
<button class="p-2 text-gray-500 tab-mobile" data-tab="settings">
<i class="fas fa-cog text-lg"></i>
<span class="text-xs block mt-1">Ajustes</span>
</button>
</nav>
</div>
<script>
// Tab switching functionality
document.querySelectorAll('[data-tab]').forEach(tab => {
tab.addEventListener('click', function() {
const tabId = this.getAttribute('data-tab');
// Update tab navigation
document.querySelectorAll('[data-tab]').forEach(t => {
t.classList.remove('tab-active', 'text-primary', 'active');
t.classList.add('text-gray-500');
});
this.classList.add('tab-active', 'text-primary', 'active');
this.classList.remove('text-gray-500');
// Update tab content
document.querySelectorAll('.tab-content').forEach(content => {
content.classList.remove('active');
content.classList.add('hidden');
});
document.getElementById(tabId).classList.add('active');
document.getElementById(tabId).classList.remove('hidden');
});
});
// Chat functionality
const chatInput = document.querySelector('#dashboard .bg-gray-50 input');
const chatContainer = document.getElementById('chat-container');
chatInput.addEventListener('keypress', function(e) {
if (e.key === 'Enter') {
sendMessage();
}
});
document.querySelector('#dashboard .bg-primary').addEventListener('click', sendMessage);
function sendMessage() {
const message = chatInput.value.trim();
if (message) {
// Add user message
const userBubble = document.createElement('div');
userBubble.className = 'chat-bubble user-bubble';
userBubble.innerHTML = `<p>${message}</p>`;
chatContainer.appendChild(userBubble);
// Clear input
chatInput.value = '';
// Add loading indicator
const loadingBubble = document.createElement('div');
loadingBubble.className = 'chat-bubble bot-bubble animate-pulse';
loadingBubble.innerHTML = '<p>...</p>';
chatContainer.appendChild(loadingBubble);
// Scroll to bottom
chatContainer.scrollTop = chatContainer.scrollHeight;
// Simulate bot response after delay
setTimeout(() => {
// Remove loading
chatContainer.removeChild(loadingBubble);
// Add bot response
const responses = [
"Ese gasto parece razonable para una cena romántica. ¿Quieres que lo agregue al historial?",
"Recuerda que puedes programar pagos recurrentes para gastos fijos como el alquiler.",
"Según tus patrones de gasto, podrías ahorrar alrededor de $100 este mes si reduces los gastos en entretenimiento.",
"¡Buena elección! Es importante invertir en experiencias juntos.",
"¿Quieres que te muestre un desglose de tus gastos en comida este mes?"
];
const randomResponse = responses[Math.floor(Math.random() * responses.length)];
const botBubble = document.createElement('div');
botBubble.className = 'chat-bubble bot-bubble';
botBubble.innerHTML = `<p>${randomResponse}</p>`;
chatContainer.appendChild(botBubble);
// Scroll to bottom
chatContainer.scrollTop = chatContainer.scrollHeight;
}, 1000);
}
}
// Calendar functionality
const calendarDays = document.querySelectorAll('#history .grid.grid-cols-7 > div:not(.font-medium)');
// Sample data - in a real app this would come from your backend
const expensesData = {
'5': { user: 'you', amount: 120 },
'12': { user: 'partner', amount: 45 },
'14': { user: 'you', amount: 85 },
'15': { user: 'you', amount: 120 }
};
calendarDays.forEach(day => {
const dayNumber = day.textContent.trim();
if (expensesData[dayNumber]) {
const expense = expensesData[dayNumber];
day.classList.add(expense.user === 'you' ? 'bg-blue-100' : 'bg-pink-100');
day.addEventListener('click', () => {
// Show expenses for this day
alert(`${expense.user === 'you' ? 'Tú' : 'Tu pareja'} gastó ${expense.amount} el día ${dayNumber}`);
});
}
});
// Show payment details
function showPaymentDetails(type) {
const details = document.getElementById('payment-details');
details.classList.remove('hidden');
// Scroll to details
details.scrollIntoView({behavior: 'smooth'});
}
// Color selection
document.querySelectorAll('[data-color]').forEach(button => {
button.addEventListener('click', function() {
const color = this.getAttribute('data-color');
// Update user profile color
const userProfile = document.querySelector('.p-4.border-b .bg-blue-100');
userProfile.classList.replace('bg-blue-100', `bg-${color}-100`);
// Update UI elements with user color
document.querySelectorAll('.user-bubble').forEach(el => {
el.classList.forEach(cls => {
if (cls.startsWith('bg-') && !cls.includes('primary')) {
el.classList.remove(cls);
}
});
el.classList.add(`bg-${color}-500`);
});
// Update balance chart
document.querySelector('.bg-blue-500').classList.replace('bg-blue-500', `bg-${color}-500`);
document.querySelector('.bg-blue-100').classList.replace('bg-blue-100', `bg-${color}-100`);
document.querySelector('.border-blue-500').classList.replace('border-blue-500', `border-${color}-500`);
document.querySelector('.text-blue-600').classList.replace('text-blue-600', `text-${color}-600`);
});
});
// Name change functionality
document.querySelectorAll('button:contains("Cambiar nombre")').forEach(button => {
button.addEventListener('click', function() {
const profileDiv = this.closest('.p-4.border-b');
const nameElement = profileDiv.querySelector('.font-medium');
const newName = prompt('Ingresa el nuevo nombre:', nameElement.textContent);
if (newName && newName.trim() !== '') {
nameElement.textContent = newName.trim();
}
});
});
// Profile picture change
document.querySelectorAll('button:contains("Cambiar foto")').forEach(button => {
button.addEventListener('click', function() {
// In a real app, this would open a file picker
const profileDiv = this.closest('.p-4.border-b');
const imgElement = profileDiv.querySelector('img');
const newPhoto = prompt('Ingresa URL de nueva foto:', imgElement.src);
if (newPhoto && newPhoto.trim() !== '') {
imgElement.src = newPhoto.trim();
// Also update balance avatar
const balanceAvatar = document.getElementById(imgElement.id === 'user-avatar' ? 'user-balance-avatar' : 'partner-balance-avatar');
if (balanceAvatar) {
balanceAvatar.src = newPhoto.trim();
}
}
});
});
</script>
<p style="border-radius: 8px; text-align: center; font-size: 12px; color: #fff; margin-top: 16px;position: fixed; left: 8px; bottom: 8px; z-index: 10; background: rgba(0, 0, 0, 0.8); padding: 4px 8px;">Made with <img src="https://enzostvs-deepsite.hf.space/logo.svg" alt="DeepSite Logo" style="width: 16px; height: 16px; vertical-align: middle;display:inline-block;margin-right:3px;filter:brightness(0) invert(1);"><a href="https://enzostvs-deepsite.hf.space" style="color: #fff;text-decoration: underline;" target="_blank" >DeepSite</a> - 🧬 <a href="https://enzostvs-deepsite.hf.space?remix=axbraper/ax" style="color: #fff;text-decoration: underline;" target="_blank" >Remix</a></p></body>
</html>