Spaces:
Running

ayurpulse / index.html
baffon's picture
app.post("/api/login", (req, res) => { const { username, password } = req.body; if (username === "user" && password === "1234") { res.json({ success: true, token: "demo-token" }); } else { res.status(401).json({ success: false, message: "Invalid credentials" }); } }); - Initial Deployment
414a6b5 verified
Raw History Blame Contribute Delete
29.5 kB
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>AyurPulse Dashboard</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 src="https://cdn.jsdelivr.net/npm/chart.js"></script>
<script>
tailwind.config = {
theme: {
extend: {
colors: {
ayurGreen: '#047857',
ayurTeal: '#0f766e',
ayurBlue: '#0369a1',
},
animation: {
'pulse-slow': 'pulse 3s cubic-bezier(0.4, 0, 0.6, 1) infinite',
'floating': 'floating 6s ease-in-out infinite',
},
keyframes: {
floating: {
'0%, 100%': { transform: 'translateY(0)' },
'50%': { transform: 'translateY(-10px)' },
}
}
}
}
}
</script>
<style>
.health-bar {
transition: width 1s ease-in-out;
}
.dosha-card {
transition: all 0.3s ease;
}
.dosha-card:hover {
transform: translateY(-5px);
box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1);
}
.login-card {
animation: floating 6s ease-in-out infinite;
}
@keyframes fadeIn {
from { opacity: 0; }
to { opacity: 1; }
}
.fade-in {
animation: fadeIn 0.5s ease-in;
}
.dashboard-grid {
display: grid;
grid-template-columns: repeat(12, 1fr);
gap: 1rem;
}
</style>
</head>
<body class="bg-gradient-to-br from-ayurGreen/5 to-ayurBlue/5 min-h-screen flex items-center justify-center p-4">
<!-- Login Screen -->
<div id="login-screen" class="login-card w-full max-w-md bg-white rounded-2xl shadow-xl p-8">
<div class="flex justify-center mb-6">
<div class="bg-gradient-to-r from-ayurGreen to-ayurBlue p-3 rounded-full">
<i class="fas fa-heartbeat text-white text-3xl"></i>
</div>
</div>
<h1 class="text-3xl font-bold text-center mb-2 text-ayurGreen">AyurPulse</h1>
<p class="text-sm text-gray-500 text-center mb-6">Ayurvedic Health Monitoring System</p>
<div class="space-y-4">
<div>
<label for="username" class="block text-sm font-medium text-gray-700 mb-1">Username</label>
<div class="relative">
<div class="absolute inset-y-0 left-0 pl-3 flex items-center pointer-events-none">
<i class="fas fa-user text-gray-400"></i>
</div>
<input id="username" type="text" placeholder="Enter Username"
class="w-full pl-10 p-3 border border-gray-300 rounded-lg focus:ring-2 focus:ring-ayurGreen focus:border-transparent transition-colors">
</div>
</div>
<div>
<label for="password" class="block text-sm font-medium text-gray-700 mb-1">Password</label>
<div class="relative">
<div class="absolute inset-y-0 left-0 pl-3 flex items-center pointer-events-none">
<i class="fas fa-lock text-gray-400"></i>
</div>
<input id="password" type="password" placeholder="Enter Password"
class="w-full pl-10 p-3 border border-gray-300 rounded-lg focus:ring-2 focus:ring-ayurGreen focus:border-transparent transition-colors">
</div>
</div>
<button onclick="login()"
class="w-full bg-gradient-to-r from-ayurGreen to-ayurBlue text-white py-3 rounded-lg font-medium shadow-md hover:shadow-lg transition-all duration-300 flex items-center justify-center gap-2">
<i class="fas fa-sign-in-alt"></i> Login
</button>
<div class="bg-yellow-50 border-l-4 border-yellow-400 p-3 rounded-lg mt-4">
<div class="flex items-center gap-2">
<i class="fas fa-info-circle text-yellow-600"></i>
<p class="text-sm text-yellow-800 font-medium">Demo Credentials</p>
</div>
<p class="text-xs text-yellow-700 mt-1">Username: <span class="font-bold">user</span></p>
<p class="text-xs text-yellow-700">Password: <span class="font-bold">1234</span></p>
</div>
</div>
</div>
<!-- Dashboard -->
<div id="dashboard" class="hidden w-full max-w-6xl bg-white rounded-2xl shadow-xl p-6 space-y-6">
<!-- Header -->
<div class="flex flex-col md:flex-row justify-between items-center gap-4">
<div class="flex items-center gap-3">
<div class="bg-gradient-to-r from-ayurGreen to-ayurBlue p-2 rounded-lg">
<i class="fas fa-heartbeat text-white text-2xl"></i>
</div>
<h1 class="text-2xl font-bold text-ayurGreen">AyurPulse Dashboard</h1>
</div>
<div class="flex items-center gap-3 w-full md:w-auto">
<div class="flex-1 md:flex-none bg-gray-100 rounded-full px-4 py-2 flex items-center gap-2">
<div class="w-2 h-2 bg-green-500 rounded-full animate-pulse-slow"></div>
<span class="text-sm text-gray-600">Live Monitoring Active</span>
</div>
<button class="md:hidden text-gray-600 hover:text-ayurGreen" onclick="toggleMenu()">
<i class="fas fa-bars text-xl"></i>
</button>
</div>
</div>
<!-- Mobile Menu -->
<div id="menu" class="hidden md:flex gap-3 bg-gray-50 p-2 rounded-lg">
<button class="text-sm bg-white px-4 py-2 rounded-lg shadow-sm hover:bg-ayurGreen hover:text-white transition-colors flex items-center gap-2">
<i class="fas fa-history"></i> History
</button>
<button class="text-sm bg-white px-4 py-2 rounded-lg shadow-sm hover:bg-ayurGreen hover:text-white transition-colors flex items-center gap-2">
<i class="fas fa-cog"></i> Settings
</button>
<button onclick="logout()" class="text-sm bg-white px-4 py-2 rounded-lg shadow-sm hover:bg-red-500 hover:text-white transition-colors flex items-center gap-2">
<i class="fas fa-sign-out-alt"></i> Logout
</button>
</div>
<div class="grid grid-cols-1 md:grid-cols-3 gap-4">
<!-- Vata Card -->
<div class="dosha-card bg-gradient-to-br from-green-50 to-green-100 p-6 rounded-xl shadow hover:shadow-md border border-green-100">
<div class="flex justify-between items-start">
<div>
<h2 class="font-semibold text-gray-700 flex items-center gap-2">
<div class="w-8 h-8 bg-green-100 rounded-full flex items-center justify-center">
<i class="fas fa-wind text-green-600"></i>
</div>
Vata Dosha
</h2>
<p class="text-xs text-gray-500 mt-1">Air & Space Principle</p>
</div>
<div class="bg-green-100 text-green-800 text-xs px-2 py-1 rounded-full">Dynamic</div>
</div>
<p id="vata" class="text-4xl font-bold text-green-600 my-4">--</p>
<div class="w-full bg-green-100 rounded-full h-2">
<div id="vata-bar" class="health-bar bg-green-500 h-2 rounded-full" style="width: 0%"></div>
</div>
</div>
<!-- Pitta Card -->
<div class="dosha-card bg-gradient-to-br from-yellow-50 to-yellow-100 p-6 rounded-xl shadow hover:shadow-md border border-yellow-100">
<div class="flex justify-between items-start">
<div>
<h2 class="font-semibold text-gray-700 flex items-center gap-2">
<div class="w-8 h-8 bg-yellow-100 rounded-full flex items-center justify-center">
<i class="fas fa-fire text-yellow-600"></i>
</div>
Pitta Dosha
</h2>
<p class="text-xs text-gray-500 mt-1">Fire & Water Principle</p>
</div>
<div class="bg-yellow-100 text-yellow-800 text-xs px-2 py-1 rounded-full">Transformative</div>
</div>
<p id="pitta" class="text-4xl font-bold text-yellow-600 my-4">--</p>
<div class="w-full bg-yellow-100 rounded-full h-2">
<div id="pitta-bar" class="health-bar bg-yellow-500 h-2 rounded-full" style="width: 0%"></div>
</div>
</div>
<!-- Kapha Card -->
<div class="dosha-card bg-gradient-to-br from-blue-50 to-blue-100 p-6 rounded-xl shadow hover:shadow-md border border-blue-100">
<div class="flex justify-between items-start">
<div>
<h2 class="font-semibold text-gray-700 flex items-center gap-2">
<div class="w-8 h-8 bg-blue-100 rounded-full flex items-center justify-center">
<i class="fas fa-tint text-blue-600"></i>
</div>
Kapha Dosha
</h2>
<p class="text-xs text-gray-500 mt-1">Earth & Water Principle</p>
</div>
<div class="bg-blue-100 text-blue-800 text-xs px-2 py-1 rounded-full">Stable</div>
</div>
<p id="kapha" class="text-4xl font-bold text-blue-600 my-4">--</p>
<div class="w-full bg-blue-100 rounded-full h-2">
<div id="kapha-bar" class="health-bar bg-blue-500 h-2 rounded-full" style="width: 0%"></div>
</div>
</div>
</div>
<div class="grid grid-cols-1 md:grid-cols-2 gap-4">
<!-- Temperature Card -->
<div class="bg-gradient-to-br from-red-50 to-red-100 p-6 rounded-xl shadow border border-red-100">
<div class="flex items-center justify-between">
<div>
<h2 class="font-semibold text-gray-700 flex items-center gap-2">
<div class="w-8 h-8 bg-red-100 rounded-full flex items-center justify-center">
<i class="fas fa-thermometer-half text-red-600"></i>
</div>
Body Temperature
</h2>
<p id="temp" class="text-3xl font-bold text-red-600 mt-2">-- °C</p>
</div>
<div class="bg-white p-3 rounded-lg shadow-inner">
<div class="w-12 h-12 relative">
<div class="absolute top-0 left-0 right-0 bottom-0 rounded-full border-8 border-red-200"></div>
<div class="absolute top-0 left-0 right-0 bottom-0 rounded-full border-8 border-red-500 border-t-transparent animate-spin"
style="animation-duration: 3s;"></div>
</div>
</div>
</div>
</div>
<!-- GPS Card -->
<div class="bg-gradient-to-br from-indigo-50 to-indigo-100 p-6 rounded-xl shadow border border-indigo-100">
<div class="flex items-center justify-between">
<div>
<h2 class="font-semibold text-gray-700 flex items-center gap-2">
<div class="w-8 h-8 bg-indigo-100 rounded-full flex items-center justify-center">
<i class="fas fa-map-marker-alt text-indigo-600"></i>
</div>
Current Location
</h2>
<p id="gps" class="text-sm font-medium text-indigo-600 mt-2">--</p>
</div>
<div class="bg-white p-3 rounded-lg shadow-inner">
<i class="fas fa-satellite-dish text-indigo-500 text-2xl animate-pulse-slow"></i>
</div>
</div>
</div>
</div>
<!-- History Graph -->
<div class="bg-white p-6 rounded-xl shadow border border-gray-100">
<div class="flex justify-between items-center mb-4">
<h2 class="font-semibold text-gray-700 flex items-center gap-2">
<i class="fas fa-chart-line text-ayurGreen"></i>
Dosha History - Last 10 Readings
</h2>
<div class="flex gap-2">
<button onclick="refreshData()" class="text-sm bg-gray-100 px-3 py-1 rounded-lg hover:bg-ayurGreen hover:text-white transition-colors flex items-center gap-1">
<i class="fas fa-sync-alt text-xs"></i> Refresh
</button>
</div>
</div>
<canvas id="doshaChart" height="250"></canvas>
</div>
<!-- Health Analysis -->
<div class="bg-gradient-to-r from-green-100 to-blue-100 p-6 rounded-xl shadow border border-green-100">
<h2 class="font-semibold text-gray-700 mb-3 flex items-center gap-2">
<div class="w-8 h-8 bg-white rounded-full flex items-center justify-center">
<i class="fas fa-heartbeat text-ayurGreen"></i>
</div>
Ayurvedic Health Analysis
</h2>
<div class="mb-4">
<div class="flex justify-between mb-1">
<span class="text-sm font-medium text-gray-700">Balance Score</span>
<span id="balance-score" class="text-sm font-medium text-gray-700">--</span>
</div>
<div class="w-full bg-white rounded-full h-3">
<div id="health-bar" class="health-bar h-3 rounded-full" style="width: 50%"></div>
</div>
</div>
<div id="advice-container" class="fade-in bg-white p-4 rounded-lg shadow-sm">
<div class="flex items-start gap-3">
<div class="bg-green-100 p-2 rounded-full">
<i class="fas fa-info-circle text-green-600"></i>
</div>
<div>
<p id="advice" class="text-sm text-gray-700">Initializing health analysis...</p>
<p id="recommendation" class="text-xs text-gray-500 mt-1">Recommendations will appear here</p>
</div>
</div>
</div>
</div>
<!-- SOS Button -->
<div class="text-center">
<button onclick="sendSOS()"
class="relative bg-gradient-to-r from-red-500 to-red-600 text-white px-8 py-4 rounded-full text-lg font-bold shadow-lg hover:shadow-xl transition-all duration-300 flex items-center justify-center gap-3 mx-auto">
<i class="fas fa-phone-alt"></i>
<span>SOS Emergency</span>
<span class="absolute -top-1 -right-1 flex h-5 w-5">
<span class="animate-ping absolute inline-flex h-full w-full rounded-full bg-white opacity-75"></span>
<span class="relative inline-flex rounded-full h-5 w-5 bg-white"></span>
</span>
</button>
<p id="sos-status" class="mt-3 text-sm text-gray-600"></p>
</div>
<!-- Footer -->
<div class="flex flex-wrap justify-center gap-4 text-gray-600 border-t border-gray-200 pt-4">
<button onclick="refreshData()" class="hover:text-ayurGreen transition-colors flex items-center gap-1">
<i class="fas fa-sync-alt"></i> Refresh Data
</button>
<button class="hover:text-ayurGreen transition-colors flex items-center gap-1">
<i class="fas fa-history"></i> Full History
</button>
<button class="hover:text-ayurGreen transition-colors flex items-center gap-1">
<i class="fas fa-book"></i> Ayurvedic Guide
</button>
<button class="hover:text-ayurGreen transition-colors flex items-center gap-1">
<i class="fas fa-cog"></i> Settings
</button>
<button class="hover:text-red-500 transition-colors flex items-center gap-1" onclick="logout()">
<i class="fas fa-sign-out-alt"></i> Logout
</button>
</div>
</div>
<script>
// Login System
async function login() {
const user = document.getElementById("username").value.trim();
const pass = document.getElementById("password").value.trim();
// Clear previous errors
document.getElementById('username').classList.remove('border-red-500');
document.getElementById('password').classList.remove('border-red-500');
if (!user) {
document.getElementById('username').classList.add('border-red-500');
document.getElementById('username').focus();
return;
}
if (!pass) {
document.getElementById('password').classList.add('border-red-500');
document.getElementById('password').focus();
return;
}
// Add loading animation
document.getElementById("login-screen").classList.add("opacity-50", "pointer-events-none");
const loginBtn = document.querySelector("#login-screen button");
loginBtn.innerHTML = '<i class="fas fa-circle-notch fa-spin"></i> Authenticating...';
try {
const response = await fetch('/api/login', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
},
body: JSON.stringify({
username: user,
password: pass
})
});
const data = await response.json();
if (data.success) {
// Store token (in a real app you'd use secure storage)
localStorage.setItem('token', data.token);
document.getElementById("login-screen").classList.add("hidden");
document.getElementById("dashboard").classList.remove("hidden");
document.body.classList.remove("justify-center");
document.body.classList.add("md:p-6", "p-2");
// Initialize data
refreshData();
} else {
throw new Error(data.message || 'Login failed');
}
} catch (error) {
// Shake animation for invalid login
const loginCard = document.getElementById("login-screen");
loginCard.classList.add("animate-shake");
setTimeout(() => {
loginCard.classList.remove("animate-shake");
}, 500);
alert(error.message || "Login failed. Please try again.");
} finally {
// Reset login button state
loginBtn.innerHTML = '<i class="fas fa-sign-in-alt"></i> Login';
document.getElementById("login-screen").classList.remove("opacity-50", "pointer-events-none");
}
}
function logout() {
// Add logout animation
document.getElementById("dashboard").classList.add("opacity-0", "transition-opacity", "duration-500");
setTimeout(() => {
document.getElementById("dashboard").classList.add("hidden");
document.getElementById("login-screen").classList.remove("hidden");
document.body.classList.add("justify-center");
document.body.classList.remove("md:p-6", "p-2");
// Reset form and clear token
document.getElementById("username").value = "";
document.getElementById("password").value = "";
document.getElementById("login-screen").classList.remove("opacity-50", "pointer-events-none");
document.querySelector("#login-screen button").innerHTML =
'<i class="fas fa-sign-in-alt"></i> Login';
localStorage.removeItem('token');
// Reset dashboard opacity
setTimeout(() => {
document.getElementById("dashboard").classList.remove("opacity-0");
}, 100);
}, 500);
}
// Mobile menu toggle
function toggleMenu() {
document.getElementById("menu").classList.toggle("hidden");
document.getElementById("menu").classList.toggle("flex");
}
// Chart.js setup
const ctx = document.getElementById('doshaChart').getContext('2d');
const doshaChart = new Chart(ctx, {
type: 'line',
data: {
labels: [],
datasets: [
{
label: 'Vata',
borderColor: '#16a34a',
backgroundColor: 'rgba(22, 163, 74, 0.05)',
borderWidth: 2,
pointBackgroundColor: '#16a34a',
pointRadius: 4,
pointHoverRadius: 6,
tension: 0.3,
data: [],
fill: true
},
{
label: 'Pitta',
borderColor: '#f59e0b',
backgroundColor: 'rgba(245, 158, 11, 0.05)',
borderWidth: 2,
pointBackgroundColor: '#f59e0b',
pointRadius: 4,
pointHoverRadius: 6,
tension: 0.3,
data: [],
fill: true
},
{
label: 'Kapha',
borderColor: '#3b82f6',
backgroundColor: 'rgba(59, 130, 246, 0.05)',
borderWidth: 2,
pointBackgroundColor: '#3b82f6',
pointRadius: 4,
pointHoverRadius: 6,
tension: 0.3,
data: [],
fill: true
}
]
},
options: {
responsive: true,
maintainAspectRatio: false,
scales: {
y: {
beginAtZero: true,
max: 100,
grid: {
color: 'rgba(0, 0, 0, 0.05)'
}
},
x: {
grid: {
display: false
}
}
},
plugins: {
tooltip: {
mode: 'index',
intersect: false,
},
legend: {
position: 'top',
labels: {
boxWidth: 12,
padding: 20,
usePointStyle: true,
pointStyle: 'circle'
}
}
},
interaction: {
mode: 'nearest',
axis: 'x',
intersect: false
}
}
});
// Update chart
function updateHistory(vata, pitta, kapha) {
const now = new Date().toLocaleTimeString([], {hour: '2-digit', minute:'2-digit'});
doshaChart.data.labels.push(now);
doshaChart.data.datasets[0].data.push(vata);
doshaChart.data.datasets[1].data.push(pitta);
doshaChart.data.datasets[2].data.push(kapha);
if (doshaChart.data.labels.length > 10) {
doshaChart.data.labels.shift();
doshaChart.data.datasets.forEach(ds => ds.data.shift());
}
doshaChart.update();
}
// SOS function
function sendSOS() {
const sosButton = document.querySelector('#dashboard button[onclick="sendSOS()"]');
const statusElement = document.getElementById("sos-status");
// Visual feedback
sosButton.classList.add('animate-pulse');
statusElement.innerText = "Activating emergency protocol...";
statusElement.className = "mt-3 text-sm text-gray-600";
// Simulate SOS process
setTimeout(() => {
statusElement.innerHTML = '<i class="fas fa-circle-notch fa-spin"></i> Connecting to emergency services...';
}, 1000);
setTimeout(() => {
statusElement.innerHTML = '<i class="fas fa-check-circle text-green-500"></i> Emergency alert sent successfully!';
sosButton.classList.remove('animate-pulse');
sosButton.classList.add('bg-gradient-to-r', 'from-green-500', 'to-green-600');
// Reset button after 5 seconds
setTimeout(() => {
sosButton.classList.remove('bg-gradient-to-r', 'from-green-500', 'to-green-600');
sosButton.classList.add('bg-gradient-to-r', 'from-red-500', 'to-red-600');
statusElement.innerHTML = 'Emergency services have been notified of your location';
}, 3000);
}, 3000);
}
// Get health advice based on dosha levels
function getHealthAdvice(vata, pitta, kapha, balanceScore) {
const adviceContainer = document.getElementById("advice-container");
const adviceElement = document.getElementById("advice");
const recommendationElement = document.getElementById("recommendation");
// Reset to default state
adviceContainer.className = "fade-in bg-white p-4 rounded-lg shadow-sm";
if (balanceScore >= 80) {
// Excellent balance
adviceContainer.classList.add("bg-green-50", "border-l-4", "border-green-500");
adviceElement.innerHTML = '<span class="font-semibold text-green-700">Excellent Balance!</span> Your doshas are in harmonious equilibrium.';
recommendationElement.textContent = "Maintain your current routine with occasional seasonal adjustments.";
}
else if (balanceScore >= 60) {
// Good balance
adviceContainer.classList.add("bg-blue-50", "border-l-4", "border-blue-500");
adviceElement.innerHTML = '<span class="font-semibold text-blue-700">Good Balance</span> Your doshas are relatively balanced with minor variations.';
recommendationElement.textContent = "Consider gentle balancing practices like yoga or meditation.";
}
else if (balanceScore >= 40) {
// Moderate imbalance
adviceContainer.classList.add("bg-yellow-50", "border-l-4", "border-yellow-500");
adviceElement.innerHTML = '<span class="font-semibold text-yellow-700">Moderate Imbalance</span> Your doshas show noticeable variations.';
if (vata > 60) {
recommendationElement.textContent = "Grounding practices recommended. Warm foods, routine, and relaxation.";
} else if (pitta > 60) {
recommendationElement.textContent = "Cooling practices recommended. Avoid spicy foods, stay hydrated.";
} else if (kapha > 60) {
recommendationElement.textContent = "Stimulating practices recommended. Exercise, light foods, variety.";
} else {
recommendationElement.textContent = "General balancing practices recommended. Consult an Ayurvedic practitioner.";
}
}
else {
// Severe imbalance
adviceContainer.classList.add("bg-red-50", "border-l-4", "border-red-500");
adviceElement.innerHTML = '<span class="font-semibold text-red-700">Significant Imbalance</span> Your doshas show major variations.';
if (vata > 70) {
recommendationElement.textContent = "Urgent Vata-balancing needed. Warm oil massage, warm foods, strict routine.";
} else if (pitta > 70) {
recommendationElement.textContent = "Urgent Pitta-balancing needed. Cooling foods, moon bathing, avoid heat.";
} else if (kapha > 70) {
recommendationElement.textContent = "Urgent Kapha-balancing needed. Vigorous exercise, dry foods, stimulation.";
} else {
recommendationElement.textContent = "Complex imbalance detected. Consult an Ayurvedic practitioner immediately.";
}
}
// Force reflow to restart animation
adviceContainer.classList.remove("fade-in");
void adviceContainer.offsetWidth;
adviceContainer.classList.add("fade-in");
}
// Refresh Data
function refreshData() {
// Simulate loading
document.querySelectorAll('#dashboard button').forEach(btn => {
btn.classList.add('opacity-50', 'pointer-events-none');
});
// Generate random data
const vata = Math.floor(Math.random() * 100);
const pitta = Math.floor(Math.random() * 100);
const kapha = Math.floor(Math.random() * 100);
const temp = (36 + Math.random() * 2).toFixed(1);
const gps = "16.9891° N, 82.2475° E"; // demo location
// Update UI
document.getElementById("vata").innerText = vata + "%";
document.getElementById("pitta").innerText = pitta + "%";
document.getElementById("kapha").innerText = kapha + "%";
document.getElementById("temp").innerText = temp + " °C";
document.getElementById("gps").innerText = gps;
// Update progress bars
document.getElementById("vata-bar").style.width = vata + "%";
document.getElementById("pitta-bar").style.width = pitta + "%";
document.getElementById("kapha-bar").style.width = kapha + "%";
// Calculate balance score (higher is better)
const balanceScore = 100 - (Math.abs(vata - 33) + Math.abs(pitta - 33) + Math.abs(kapha - 33));
document.getElementById("balance-score").innerText = Math.max(0, Math.min(100, balanceScore)) + "%";
// Update health bar with color coding
const healthBar = document.getElementById("health-bar");
healthBar.style.width = Math.max(0, Math.min(100, balanceScore)) + "%";
if (balanceScore >= 80) {
healthBar.className = "health-bar h-3 rounded-full bg-green-500";
} else if (balanceScore >= 60) {
healthBar.className = "health-bar h-3 rounded-full bg-blue-500";
} else if (balanceScore >= 40) {
healthBar.className = "health-bar h-3 rounded-full bg-yellow-500";
} else {
healthBar.className = "health-bar h-3 rounded-full bg-red-500";
}
// Get health advice
getHealthAdvice(vata, pitta, kapha, balanceScore);
// Update history chart
updateHistory(vata, pitta, kapha);
// Remove loading state
setTimeout(() => {
document.querySelectorAll('#dashboard button').forEach(btn => {
btn.classList.remove('opacity-50', 'pointer-events-none');
});
}, 500);
}
// Initialize with first data
setTimeout(() => {
if (document.getElementById("dashboard").classList.contains("hidden")) return;
refreshData();
setInterval(refreshData, 8000); // Update every 8 seconds
}, 1000);
</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=baffon/ayurpulse" style="color: #fff;text-decoration: underline;" target="_blank" >Remix</a></p></body>
</html>