diff --git a/api/get_latest_tips.php b/api/get_latest_tips.php index d13a56a..8d1bdb1 100644 --- a/api/get_latest_tips.php +++ b/api/get_latest_tips.php @@ -9,6 +9,11 @@ try { $stmt->execute(); $tips = $stmt->fetchAll(); + // Fetch recent thanks from the last 15 seconds + $stmt = $pdo->prepare("SELECT * FROM dj_tips WHERE thanked_at > (NOW() - INTERVAL 15 SECOND) ORDER BY thanked_at DESC LIMIT 5"); + $stmt->execute(); + $thanks = $stmt->fetchAll(); + // Also get current DJ $stmt = $pdo->query("SELECT setting_value FROM settings WHERE setting_key = 'current_dj'"); $dj = $stmt->fetchColumn() ?: "Lili"; @@ -16,6 +21,7 @@ try { echo json_encode([ "success" => true, "tips" => $tips, + "thanks" => $thanks, "current_dj" => $dj ]); } catch (Exception $e) { diff --git a/api/send_tip.php b/api/send_tip.php index 777399a..3441b0e 100644 --- a/api/send_tip.php +++ b/api/send_tip.php @@ -5,6 +5,7 @@ header("Content-Type: application/json"); $pdo = db(); $username = $_POST["username"] ?? ""; $amount = intval($_POST["amount"] ?? 100); +$message = $_POST["message"] ?? ""; if (!$username) { echo json_encode(["success" => false, "error" => "Inicia sesión para enviar flores"]); @@ -34,8 +35,8 @@ try { $stmt->execute([$amount, $username]); // Log tip - $stmt = $pdo->prepare("INSERT INTO dj_tips (sender_name, dj_name, amount) VALUES (?, ?, ?)"); - $stmt->execute([$username, $dj, $amount]); + $stmt = $pdo->prepare("INSERT INTO dj_tips (sender_name, dj_name, amount, message) VALUES (?, ?, ?, ?)"); + $stmt->execute([$username, $dj, $amount, $message]); $pdo->commit(); diff --git a/api/thank_tip.php b/api/thank_tip.php new file mode 100644 index 0000000..69620f7 --- /dev/null +++ b/api/thank_tip.php @@ -0,0 +1,24 @@ + false, "error" => "ID de propina no válido"]); + exit; +} + +try { + $stmt = $pdo->prepare("UPDATE dj_tips SET thanked_at = NOW() WHERE id = ?"); + $stmt->execute([$tipId]); + + echo json_encode([ + "success" => true, + "message" => "¡Has agradecido la donación!" + ]); +} catch (Exception $e) { + echo json_encode(["success" => false, "error" => $e->getMessage()]); +} diff --git a/index.php b/index.php index 0febe15..8f209a4 100644 --- a/index.php +++ b/index.php @@ -1418,6 +1418,63 @@ $twitter_link = "https://twitter.com/"; opacity: 0; } + .donor-message { + position: absolute; + top: 40%; + left: 50%; + transform: translate(-50%, -50%); + background: rgba(15, 23, 42, 0.8); + backdrop-filter: blur(12px); + padding: 25px 50px; + border-radius: 24px; + border: 2px solid #f472b6; + color: white; + text-align: center; + z-index: 2000; + animation: toast-celebration 5s cubic-bezier(0.34, 1.56, 0.64, 1) forwards; + box-shadow: 0 20px 40px rgba(236, 72, 153, 0.4), 0 0 20px rgba(236, 72, 153, 0.2); + pointer-events: auto; + min-width: 300px; + } + + .donor-message h4 { + margin: 0; + font-size: 1rem; + text-transform: uppercase; + letter-spacing: 2px; + color: #f472b6; + font-weight: 800; + } + + .donor-message h2 { + margin: 10px 0 0; + font-size: 2.2rem; + font-weight: 900; + background: linear-gradient(to right, #ffffff, #f472b6); + -webkit-background-clip: text; + -webkit-text-fill-color: transparent; + text-shadow: 0 0 20px rgba(244, 114, 182, 0.3); + } + + .donor-message p { + margin: 15px 0 0; + font-size: 1.1rem; + font-style: italic; + color: rgba(255, 255, 255, 0.9); + border-top: 1px solid rgba(244, 114, 182, 0.3); + padding-top: 15px; + max-width: 400px; + line-height: 1.4; + } + + @keyframes toast-celebration { + 0% { opacity: 0; transform: translate(-50%, -30%) scale(0.8); } + 10% { opacity: 1; transform: translate(-50%, -50%) scale(1.05); } + 15% { transform: translate(-50%, -50%) scale(1); } + 85% { opacity: 1; transform: translate(-50%, -50%) scale(1); } + 100% { opacity: 0; transform: translate(-50%, -70%) scale(0.9); } + } + @keyframes fall-and-sway { 0% { transform: translateY(-10vh) translateX(0) rotate(0deg); opacity: 0; } 10% { opacity: 1; } @@ -2112,6 +2169,26 @@ $twitter_link = "https://twitter.com/"; + +