diff --git a/api/chat.php b/api/chat.php index 182fbfb..e9e014e 100644 --- a/api/chat.php +++ b/api/chat.php @@ -18,7 +18,7 @@ if ($method === 'GET') { unlink($path); } } - db()->query("DELETE FROM messages WHERE (type = 'image' OR type = 'reaction') AND created_at < DATE_SUB(NOW(), INTERVAL 5 SECOND)"); + db()->query("DELETE FROM messages WHERE (type = 'image' OR type = 'reaction' OR type = 'flash_poll') AND created_at < DATE_SUB(NOW(), INTERVAL 5 SECOND)"); // Limpiar otros mensajes y archivos de más de 7 días $oldImages = db()->prepare("SELECT message FROM messages WHERE type = 'image' AND created_at < DATE_SUB(NOW(), INTERVAL 7 DAY)"); @@ -117,7 +117,14 @@ if ($method === 'GET') { // Award points to the fan based on chat activity require_once __DIR__ . '/../includes/points_helper.php'; - $pts = ($type === 'reaction') ? 1 : 5; + + if ($type === 'flash_poll_response') { + awardLoyaltyPoints($username, 10); + $pts = 10; // Also add to general ranking + } else { + $pts = ($type === 'reaction') ? 1 : 5; + } + $newPoints = awardPoints($username, $pts); // Auto-update Fan of the Month if this user has the highest points diff --git a/includes/points_helper.php b/includes/points_helper.php index a3f6543..08a9553 100644 --- a/includes/points_helper.php +++ b/includes/points_helper.php @@ -36,6 +36,29 @@ function awardPoints($username, $pointsToAdd) { return $newPoints; } +function awardLoyaltyPoints($username, $pointsToAdd) { + if (empty($username) || $username === 'Anónimo') { + return false; + } + + $db = db(); + + // Get current loyalty points + $stmt = $db->prepare("SELECT id, loyalty_points FROM fans WHERE name = ?"); + $stmt->execute([$username]); + $fan = $stmt->fetch(); + + if ($fan) { + $newPoints = $fan['loyalty_points'] + $pointsToAdd; + $db->prepare("UPDATE fans SET loyalty_points = ? WHERE id = ?")->execute([$newPoints, $fan['id']]); + } else { + $newPoints = $pointsToAdd; + $db->prepare("INSERT INTO fans (name, loyalty_points) VALUES (?, ?)")->execute([$username, $newPoints]); + } + + return $newPoints; +} + function getNextLevelInfo($username) { $db = db(); $stmt = $db->prepare("SELECT points FROM fans WHERE name = ?"); diff --git a/index.php b/index.php index 4eb95d3..ffbd096 100644 --- a/index.php +++ b/index.php @@ -1652,18 +1652,15 @@ $twitter_link = "https://twitter.com/"; } @keyframes flyUp { - 0% { - transform: translateY(0) translateX(0) scale(0.5) rotate(0deg); - opacity: 0; - } - 10% { - opacity: 1; - transform: translateY(-20px) translateX(var(--drift)) scale(1.2) rotate(var(--rot)); - } - 100% { - transform: translateY(-100vh) translateX(calc(var(--drift) * 2)) scale(1) rotate(calc(var(--rot) * 2)); - opacity: 0; - } + 0% { transform: translateY(0) translateX(0) rotate(0deg); opacity: 0; } + 10% { opacity: 1; } + 100% { transform: translateY(-80vh) translateX(var(--drift)) rotate(var(--rot)); opacity: 0; } + } + + @keyframes floatUpFade { + 0% { transform: translate(-50%, -50%) scale(0.5); opacity: 0; } + 20% { opacity: 1; transform: translate(-50%, -80%) scale(1.2); } + 100% { transform: translate(-50%, -150%) scale(1); opacity: 0; } } /* Reaction Buttons Container */ @@ -1680,6 +1677,73 @@ $twitter_link = "https://twitter.com/"; animation: slideUpFade 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275); } + /* Flash Poll Styles */ + #flash-poll-container { + position: fixed; + top: 20%; + left: 50%; + transform: translate(-50%, -50%) scale(0.8); + z-index: 9995; + width: 90%; + max-width: 400px; + background: linear-gradient(145deg, rgba(30, 41, 59, 0.95), rgba(15, 23, 42, 0.98)); + border: 2px solid #facc15; + border-radius: 24px; + padding: 20px; + box-shadow: 0 0 50px rgba(250, 204, 21, 0.4), 0 20px 40px rgba(0,0,0,0.5); + display: none; + opacity: 0; + transition: all 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275); + text-align: center; + } + #flash-poll-container.show { + display: block; + opacity: 1; + transform: translate(-50%, -50%) scale(1); + } + .poll-question { + font-size: 1.2rem; + font-weight: 800; + color: #fff; + margin-bottom: 15px; + line-height: 1.3; + } + .poll-options { + display: flex; + gap: 10px; + justify-content: center; + } + .poll-btn { + background: rgba(255,255,255,0.1); + border: 1px solid rgba(255,255,255,0.2); + color: white; + padding: 10px 20px; + border-radius: 12px; + font-weight: 700; + cursor: pointer; + transition: all 0.2s; + flex: 1; + } + .poll-btn:hover { + background: var(--primary-color); + border-color: #fff; + transform: translateY(-3px); + } + .poll-timer-bar { + width: 100%; + height: 4px; + background: rgba(255,255,255,0.1); + border-radius: 2px; + margin-top: 15px; + overflow: hidden; + } + .poll-timer-fill { + height: 100%; + background: #facc15; + width: 100%; + transition: width linear; + } + /* Energy Thermometer for DJ */ .energy-thermometer-container { display: none; @@ -1893,6 +1957,11 @@ $twitter_link = "https://twitter.com/";
LILI
+
Cargando hype...
@@ -2043,7 +2112,7 @@ $twitter_link = "https://twitter.com/";
-