Spaces:
Running
Running
display the tidechart below the map - Follow Up Deployment
Browse files- index.html +37 -2
index.html
CHANGED
|
@@ -12,6 +12,10 @@
|
|
| 12 |
height: 400px;
|
| 13 |
transition: all 0.3s ease;
|
| 14 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
| 15 |
.location-card {
|
| 16 |
box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
|
| 17 |
}
|
|
@@ -42,7 +46,31 @@
|
|
| 42 |
<p class="text-gray-600">Enter any address or place to see it on the map</p>
|
| 43 |
</div>
|
| 44 |
|
| 45 |
-
<div
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 46 |
<div class="flex flex-col md:flex-row gap-4">
|
| 47 |
<div class="flex-grow">
|
| 48 |
<label for="locationInput" class="block text-sm font-medium text-gray-700 mb-1">Search Location</label>
|
|
@@ -201,11 +229,18 @@
|
|
| 201 |
return new Date(timestamp * 1000).toLocaleTimeString([], {hour: '2-digit', minute:'2-digit'});
|
| 202 |
};
|
| 203 |
|
| 204 |
-
document.getElementById('
|
| 205 |
document.getElementById('highTideTime').textContent = formatTime(nextHigh.dt);
|
| 206 |
document.getElementById('highTideHeight').textContent = `${nextHigh.height.toFixed(2)}m`;
|
| 207 |
document.getElementById('lowTideTime').textContent = formatTime(nextLow.dt);
|
| 208 |
document.getElementById('lowTideHeight').textContent = `${nextLow.height.toFixed(2)}m`;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 209 |
}
|
| 210 |
}
|
| 211 |
}
|
|
|
|
| 12 |
height: 400px;
|
| 13 |
transition: all 0.3s ease;
|
| 14 |
}
|
| 15 |
+
#beachTideInfo {
|
| 16 |
+
transition: all 0.3s ease;
|
| 17 |
+
box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
|
| 18 |
+
}
|
| 19 |
.location-card {
|
| 20 |
box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
|
| 21 |
}
|
|
|
|
| 46 |
<p class="text-gray-600">Enter any address or place to see it on the map</p>
|
| 47 |
</div>
|
| 48 |
|
| 49 |
+
<div id="beachTideInfo" class="bg-blue-50 rounded-xl p-6 mb-8 hidden">
|
| 50 |
+
<div class="flex flex-col md:flex-row gap-6">
|
| 51 |
+
<div class="flex-1">
|
| 52 |
+
<h2 class="text-2xl font-bold text-blue-800 mb-2" id="beachName">Nearby Beach</h2>
|
| 53 |
+
<p class="text-blue-600" id="beachDistance">Distance: Calculating...</p>
|
| 54 |
+
</div>
|
| 55 |
+
<div class="flex-1">
|
| 56 |
+
<h3 class="text-lg font-semibold text-blue-700 mb-2">Tide Information</h3>
|
| 57 |
+
<div class="grid grid-cols-2 gap-4">
|
| 58 |
+
<div class="bg-white p-3 rounded-lg shadow">
|
| 59 |
+
<p class="text-sm text-blue-500">Next High Tide</p>
|
| 60 |
+
<p id="highTideTime" class="font-medium text-blue-800">-</p>
|
| 61 |
+
<p id="highTideHeight" class="text-sm text-blue-600">-</p>
|
| 62 |
+
</div>
|
| 63 |
+
<div class="bg-white p-3 rounded-lg shadow">
|
| 64 |
+
<p class="text-sm text-blue-500">Next Low Tide</p>
|
| 65 |
+
<p id="lowTideTime" class="font-medium text-blue-800">-</p>
|
| 66 |
+
<p id="lowTideHeight" class="text-sm text-blue-600">-</p>
|
| 67 |
+
</div>
|
| 68 |
+
</div>
|
| 69 |
+
</div>
|
| 70 |
+
</div>
|
| 71 |
+
</div>
|
| 72 |
+
|
| 73 |
+
<div class="location-card bg-white rounded-xl p-6">
|
| 74 |
<div class="flex flex-col md:flex-row gap-4">
|
| 75 |
<div class="flex-grow">
|
| 76 |
<label for="locationInput" class="block text-sm font-medium text-gray-700 mb-1">Search Location</label>
|
|
|
|
| 229 |
return new Date(timestamp * 1000).toLocaleTimeString([], {hour: '2-digit', minute:'2-digit'});
|
| 230 |
};
|
| 231 |
|
| 232 |
+
document.getElementById('beachTideInfo').classList.remove('hidden');
|
| 233 |
document.getElementById('highTideTime').textContent = formatTime(nextHigh.dt);
|
| 234 |
document.getElementById('highTideHeight').textContent = `${nextHigh.height.toFixed(2)}m`;
|
| 235 |
document.getElementById('lowTideTime').textContent = formatTime(nextLow.dt);
|
| 236 |
document.getElementById('lowTideHeight').textContent = `${nextLow.height.toFixed(2)}m`;
|
| 237 |
+
|
| 238 |
+
// Try to get nearest beach name (simplified example)
|
| 239 |
+
const beachResponse = await fetch(`https://nominatim.openstreetmap.org/reverse?format=json&lat=${lat}&lon=${lon}&zoom=10`);
|
| 240 |
+
const beachData = await beachResponse.json();
|
| 241 |
+
if (beachData.address && beachData.address.tourism === 'beach') {
|
| 242 |
+
document.getElementById('beachName').textContent = beachData.display_name || 'Nearby Beach';
|
| 243 |
+
}
|
| 244 |
}
|
| 245 |
}
|
| 246 |
}
|