Spaces:
Runtime error
Runtime error
Updated v14.0 to v14.1 with few changes
Browse files- templates/index.html +22 -7
templates/index.html
CHANGED
|
@@ -3,7 +3,7 @@
|
|
| 3 |
<head>
|
| 4 |
<meta charset="UTF-8">
|
| 5 |
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
|
| 6 |
-
<title>CoolRide V14.
|
| 7 |
<link rel="stylesheet" href="https://unpkg.com/leaflet@1.9.4/dist/leaflet.css" />
|
| 8 |
<link href="https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap" rel="stylesheet">
|
| 9 |
<link href="https://fonts.googleapis.com/css2?family=Noto+Sans+SC:wght@500&family=Noto+Sans+Tamil:wght@500&display=swap" rel="stylesheet">
|
|
@@ -68,7 +68,10 @@
|
|
| 68 |
padding: 25px 20px; box-sizing: border-box; display: none;
|
| 69 |
box-shadow: 0 4px 25px rgba(37, 99, 235, 0.4);
|
| 70 |
border-bottom-left-radius: 20px; border-bottom-right-radius: 20px;
|
|
|
|
| 71 |
}
|
|
|
|
|
|
|
| 72 |
.hud-instruction { font-size: 20px; font-weight: 700; margin-bottom: 5px; line-height: 1.3;}
|
| 73 |
.hud-sub { font-size: 13px; opacity: 0.9; font-weight: 500; display:flex; align-items:center; gap:5px;}
|
| 74 |
.hud-close { position: absolute; top: 25px; right: 20px; font-size: 24px; cursor: pointer; opacity: 0.8;}
|
|
@@ -152,7 +155,7 @@
|
|
| 152 |
|
| 153 |
<div id="panel">
|
| 154 |
<div class="header-row">
|
| 155 |
-
<h2 style="margin:0; font-size:18px;">π΄ CoolRide <span style="font-size:12px;color:white;background:#22c55e;padding:2px 6px;border-radius:10px;">V14.
|
| 156 |
<div class="header-controls">
|
| 157 |
<div style="display:flex; flex-direction:column; align-items:flex-end; margin-right:5px;">
|
| 158 |
<div id="userBlock" onclick="checkAuth()" style="display:flex; align-items:center; cursor:pointer;">
|
|
@@ -303,6 +306,7 @@
|
|
| 303 |
function startNavigation() {
|
| 304 |
togglePanel(); // Close panel
|
| 305 |
document.getElementById('nav-hud').style.display = 'block';
|
|
|
|
| 306 |
if(currentNavSteps.length > 0) { updateHud(0); }
|
| 307 |
}
|
| 308 |
|
|
@@ -314,11 +318,11 @@
|
|
| 314 |
}
|
| 315 |
|
| 316 |
function updateHud(index) {
|
| 317 |
-
let txt = currentNavSteps[index] || "
|
| 318 |
let sub = "Keep steady pace π΄";
|
| 319 |
|
| 320 |
// Smart Vibe Check
|
| 321 |
-
if(txt.includes("Park") || txt.includes("Connector")) sub = "π³
|
| 322 |
else if(txt.includes("Road") || txt.includes("Ave")) sub = "π£οΈ Main road. Stay alert & hydrated.";
|
| 323 |
else if(index === 0) sub = "π Let's go! Follow the green line.";
|
| 324 |
|
|
@@ -338,21 +342,32 @@
|
|
| 338 |
icon: L.divIcon({ className: 'user-puck', iconSize: [16, 16] })
|
| 339 |
}).addTo(map);
|
| 340 |
|
| 341 |
-
// SMOOTH SIMULATION (
|
| 342 |
simInterval = setInterval(() => {
|
| 343 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 344 |
|
|
|
|
| 345 |
let lat = currentCoolPath[i][0];
|
| 346 |
let lon = currentCoolPath[i][1];
|
| 347 |
|
| 348 |
simMarker.setLatLng([lat, lon]);
|
| 349 |
map.panTo([lat, lon]);
|
| 350 |
|
|
|
|
| 351 |
let stepIndex = Math.floor((i / currentCoolPath.length) * currentNavSteps.length);
|
| 352 |
updateHud(stepIndex);
|
| 353 |
|
| 354 |
i++;
|
| 355 |
-
},
|
| 356 |
}
|
| 357 |
|
| 358 |
// --- 5. AUTHENTICATION ---
|
|
|
|
| 3 |
<head>
|
| 4 |
<meta charset="UTF-8">
|
| 5 |
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
|
| 6 |
+
<title>CoolRide V14.1 | Presentation Mode</title>
|
| 7 |
<link rel="stylesheet" href="https://unpkg.com/leaflet@1.9.4/dist/leaflet.css" />
|
| 8 |
<link href="https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap" rel="stylesheet">
|
| 9 |
<link href="https://fonts.googleapis.com/css2?family=Noto+Sans+SC:wght@500&family=Noto+Sans+Tamil:wght@500&display=swap" rel="stylesheet">
|
|
|
|
| 68 |
padding: 25px 20px; box-sizing: border-box; display: none;
|
| 69 |
box-shadow: 0 4px 25px rgba(37, 99, 235, 0.4);
|
| 70 |
border-bottom-left-radius: 20px; border-bottom-right-radius: 20px;
|
| 71 |
+
transition: background 0.5s;
|
| 72 |
}
|
| 73 |
+
#nav-hud.arrived { background: linear-gradient(180deg, #10b981 0%, #059669 100%); } /* Green on arrival */
|
| 74 |
+
|
| 75 |
.hud-instruction { font-size: 20px; font-weight: 700; margin-bottom: 5px; line-height: 1.3;}
|
| 76 |
.hud-sub { font-size: 13px; opacity: 0.9; font-weight: 500; display:flex; align-items:center; gap:5px;}
|
| 77 |
.hud-close { position: absolute; top: 25px; right: 20px; font-size: 24px; cursor: pointer; opacity: 0.8;}
|
|
|
|
| 155 |
|
| 156 |
<div id="panel">
|
| 157 |
<div class="header-row">
|
| 158 |
+
<h2 style="margin:0; font-size:18px;">π΄ CoolRide <span style="font-size:12px;color:white;background:#22c55e;padding:2px 6px;border-radius:10px;">V14.1</span></h2>
|
| 159 |
<div class="header-controls">
|
| 160 |
<div style="display:flex; flex-direction:column; align-items:flex-end; margin-right:5px;">
|
| 161 |
<div id="userBlock" onclick="checkAuth()" style="display:flex; align-items:center; cursor:pointer;">
|
|
|
|
| 306 |
function startNavigation() {
|
| 307 |
togglePanel(); // Close panel
|
| 308 |
document.getElementById('nav-hud').style.display = 'block';
|
| 309 |
+
document.getElementById('nav-hud').classList.remove('arrived'); // Reset green state
|
| 310 |
if(currentNavSteps.length > 0) { updateHud(0); }
|
| 311 |
}
|
| 312 |
|
|
|
|
| 318 |
}
|
| 319 |
|
| 320 |
function updateHud(index) {
|
| 321 |
+
let txt = currentNavSteps[index] || "Almost there...";
|
| 322 |
let sub = "Keep steady pace π΄";
|
| 323 |
|
| 324 |
// Smart Vibe Check
|
| 325 |
+
if(txt.includes("Park") || txt.includes("Connector")) sub = "π³ Entering green zone. Enjoy the cool air!";
|
| 326 |
else if(txt.includes("Road") || txt.includes("Ave")) sub = "π£οΈ Main road. Stay alert & hydrated.";
|
| 327 |
else if(index === 0) sub = "π Let's go! Follow the green line.";
|
| 328 |
|
|
|
|
| 342 |
icon: L.divIcon({ className: 'user-puck', iconSize: [16, 16] })
|
| 343 |
}).addTo(map);
|
| 344 |
|
| 345 |
+
// SMOOTH SIMULATION (Constant Pace)
|
| 346 |
simInterval = setInterval(() => {
|
| 347 |
+
// 1. ARRIVAL CHECK
|
| 348 |
+
if(i >= currentCoolPath.length) {
|
| 349 |
+
clearInterval(simInterval);
|
| 350 |
+
|
| 351 |
+
// ARRIVAL UI UPDATE
|
| 352 |
+
document.getElementById('nav-hud').classList.add('arrived');
|
| 353 |
+
document.getElementById('hud-text').innerText = "π You have reached your destination!";
|
| 354 |
+
document.getElementById('hud-sub').innerText = "Hope you enjoyed the cool route.";
|
| 355 |
+
return;
|
| 356 |
+
}
|
| 357 |
|
| 358 |
+
// 2. MOVE MARKER
|
| 359 |
let lat = currentCoolPath[i][0];
|
| 360 |
let lon = currentCoolPath[i][1];
|
| 361 |
|
| 362 |
simMarker.setLatLng([lat, lon]);
|
| 363 |
map.panTo([lat, lon]);
|
| 364 |
|
| 365 |
+
// 3. UPDATE TEXT
|
| 366 |
let stepIndex = Math.floor((i / currentCoolPath.length) * currentNavSteps.length);
|
| 367 |
updateHud(stepIndex);
|
| 368 |
|
| 369 |
i++;
|
| 370 |
+
}, 120); // 120ms = Relaxed, smooth gliding
|
| 371 |
}
|
| 372 |
|
| 373 |
// --- 5. AUTHENTICATION ---
|