app starts

This commit is contained in:
counterweight 2025-10-16 09:50:36 +02:00
commit 36ca0e817a
Signed by: counterweight
GPG key ID: 883EDBAA726BD96C
9 changed files with 463 additions and 0 deletions

72
public/index.html Normal file
View file

@ -0,0 +1,72 @@
<!DOCTYPE html>
<html lang="es">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Mensaje de Emergencia</title>
<link rel="stylesheet" href="style.css">
</head>
<body>
<div class="container">
<h1>Mensaje de Emergencia</h1>
<form id="messageForm">
<div class="form-group">
<label for="name">Tu nombre:</label>
<input type="text" id="name" name="name" required>
</div>
<div class="form-group">
<label for="message">Mensaje:</label>
<textarea id="message" name="message" rows="4" required></textarea>
</div>
<button type="submit">Enviar Mensaje</button>
</form>
<div id="status" class="status hidden"></div>
</div>
<script>
document.getElementById('messageForm').addEventListener('submit', async (e) => {
e.preventDefault();
const name = document.getElementById('name').value.trim();
const message = document.getElementById('message').value.trim();
const statusDiv = document.getElementById('status');
const submitBtn = document.querySelector('button[type="submit"]');
// Disable form during submission
submitBtn.disabled = true;
submitBtn.textContent = 'Enviando...';
statusDiv.className = 'status hidden';
try {
const response = await fetch('/send-message', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
},
body: JSON.stringify({ name, message })
});
const result = await response.json();
if (result.success) {
statusDiv.textContent = result.message;
statusDiv.className = 'status success';
document.getElementById('messageForm').reset();
} else {
statusDiv.textContent = result.error || 'Error al enviar el mensaje';
statusDiv.className = 'status error';
}
} catch (error) {
statusDiv.textContent = 'Error de conexión';
statusDiv.className = 'status error';
} finally {
submitBtn.disabled = false;
submitBtn.textContent = 'Enviar Mensaje';
}
});
</script>
</body>
</html>

118
public/style.css Normal file
View file

@ -0,0 +1,118 @@
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
body {
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
background-color: #f5f5f5;
color: #333;
line-height: 1.6;
}
.container {
max-width: 500px;
margin: 50px auto;
padding: 30px;
background: white;
border-radius: 8px;
box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}
h1 {
text-align: center;
margin-bottom: 30px;
color: #2c3e50;
font-size: 24px;
}
.form-group {
margin-bottom: 20px;
}
label {
display: block;
margin-bottom: 5px;
font-weight: 500;
color: #555;
}
input[type="text"],
textarea {
width: 100%;
padding: 12px;
border: 1px solid #ddd;
border-radius: 4px;
font-size: 16px;
font-family: inherit;
}
input[type="text"]:focus,
textarea:focus {
outline: none;
border-color: #3498db;
box-shadow: 0 0 0 2px rgba(52, 152, 219, 0.2);
}
textarea {
resize: vertical;
min-height: 100px;
}
button {
width: 100%;
padding: 12px;
background-color: #3498db;
color: white;
border: none;
border-radius: 4px;
font-size: 16px;
font-weight: 500;
cursor: pointer;
transition: background-color 0.2s;
}
button:hover:not(:disabled) {
background-color: #2980b9;
}
button:disabled {
background-color: #bdc3c7;
cursor: not-allowed;
}
.status {
margin-top: 20px;
padding: 12px;
border-radius: 4px;
text-align: center;
font-weight: 500;
}
.status.success {
background-color: #d4edda;
color: #155724;
border: 1px solid #c3e6cb;
}
.status.error {
background-color: #f8d7da;
color: #721c24;
border: 1px solid #f5c6cb;
}
.status.hidden {
display: none;
}
@media (max-width: 600px) {
.container {
margin: 20px;
padding: 20px;
}
h1 {
font-size: 20px;
}
}