Spaces:
Running
Running
undefined - Initial Deployment
Browse files- README.md +7 -5
- index.html +220 -19
README.md
CHANGED
|
@@ -1,10 +1,12 @@
|
|
| 1 |
---
|
| 2 |
-
title:
|
| 3 |
-
emoji:
|
| 4 |
-
colorFrom:
|
| 5 |
-
colorTo:
|
| 6 |
sdk: static
|
| 7 |
pinned: false
|
|
|
|
|
|
|
| 8 |
---
|
| 9 |
|
| 10 |
-
Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
|
|
|
|
| 1 |
---
|
| 2 |
+
title: activities-planner
|
| 3 |
+
emoji: 🐳
|
| 4 |
+
colorFrom: yellow
|
| 5 |
+
colorTo: red
|
| 6 |
sdk: static
|
| 7 |
pinned: false
|
| 8 |
+
tags:
|
| 9 |
+
- deepsite
|
| 10 |
---
|
| 11 |
|
| 12 |
+
Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
|
index.html
CHANGED
|
@@ -1,19 +1,220 @@
|
|
| 1 |
-
<!
|
| 2 |
-
<html>
|
| 3 |
-
|
| 4 |
-
|
| 5 |
-
|
| 6 |
-
|
| 7 |
-
|
| 8 |
-
|
| 9 |
-
|
| 10 |
-
|
| 11 |
-
|
| 12 |
-
|
| 13 |
-
|
| 14 |
-
|
| 15 |
-
|
| 16 |
-
|
| 17 |
-
|
| 18 |
-
|
| 19 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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script src="https://cdn.tailwindcss.com"></script>
|
| 8 |
+
<link rel="stylesheet" href="https://unpkg.com/leaflet@1.9.4/dist/leaflet.css" />
|
| 9 |
+
<script src="https://unpkg.com/leaflet@1.9.4/dist/leaflet.js"></script>
|
| 10 |
+
<style>
|
| 11 |
+
#map {
|
| 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 |
+
}
|
| 18 |
+
.pulse {
|
| 19 |
+
animation: pulse 2s infinite;
|
| 20 |
+
}
|
| 21 |
+
@keyframes pulse {
|
| 22 |
+
0% {
|
| 23 |
+
transform: scale(0.95);
|
| 24 |
+
box-shadow: 0 0 0 0 rgba(74, 222, 128, 0.7);
|
| 25 |
+
}
|
| 26 |
+
70% {
|
| 27 |
+
transform: scale(1);
|
| 28 |
+
box-shadow: 0 0 0 10px rgba(74, 222, 128, 0);
|
| 29 |
+
}
|
| 30 |
+
100% {
|
| 31 |
+
transform: scale(0.95);
|
| 32 |
+
box-shadow: 0 0 0 0 rgba(74, 222, 128, 0);
|
| 33 |
+
}
|
| 34 |
+
}
|
| 35 |
+
</style>
|
| 36 |
+
</head>
|
| 37 |
+
<body class="bg-gray-50 min-h-screen">
|
| 38 |
+
<div class="container mx-auto px-4 py-8">
|
| 39 |
+
<div class="max-w-3xl mx-auto">
|
| 40 |
+
<div class="text-center mb-8">
|
| 41 |
+
<h1 class="text-4xl font-bold text-gray-800 mb-2">📍 Location Finder</h1>
|
| 42 |
+
<p class="text-gray-600">Enter any address or place to see it on the map</p>
|
| 43 |
+
</div>
|
| 44 |
+
|
| 45 |
+
<div class="location-card bg-white rounded-xl p-6 mb-8">
|
| 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>
|
| 49 |
+
<div class="relative">
|
| 50 |
+
<input
|
| 51 |
+
type="text"
|
| 52 |
+
id="locationInput"
|
| 53 |
+
placeholder="e.g. Eiffel Tower, Paris"
|
| 54 |
+
class="w-full px-4 py-3 rounded-lg border border-gray-300 focus:ring-2 focus:ring-green-500 focus:border-green-500 transition"
|
| 55 |
+
>
|
| 56 |
+
<button
|
| 57 |
+
id="searchButton"
|
| 58 |
+
class="absolute right-2 top-1/2 transform -translate-y-1/2 bg-green-500 hover:bg-green-600 text-white p-2 rounded-lg transition duration-200 pulse"
|
| 59 |
+
>
|
| 60 |
+
<svg xmlns="http://www.w3.org/2000/svg" class="h-5 w-5" viewBox="0 0 20 20" fill="currentColor">
|
| 61 |
+
<path fill-rule="evenodd" d="M8 4a4 4 0 100 8 4 4 0 000-8zM2 8a6 6 0 1110.89 3.476l4.817 4.817a1 1 0 01-1.414 1.414l-4.816-4.816A6 6 0 012 8z" clip-rule="evenodd" />
|
| 62 |
+
</svg>
|
| 63 |
+
</button>
|
| 64 |
+
</div>
|
| 65 |
+
</div>
|
| 66 |
+
</div>
|
| 67 |
+
</div>
|
| 68 |
+
|
| 69 |
+
<div class="location-card bg-white rounded-xl overflow-hidden">
|
| 70 |
+
<div id="map" class="w-full"></div>
|
| 71 |
+
<div id="locationInfo" class="p-4 border-t border-gray-200 hidden">
|
| 72 |
+
<h3 class="font-semibold text-lg text-gray-800 mb-1">Location Details</h3>
|
| 73 |
+
<p id="address" class="text-gray-600"></p>
|
| 74 |
+
<p id="coordinates" class="text-sm text-gray-500 mt-1"></p>
|
| 75 |
+
<div id="tideInfo" class="mt-4 hidden">
|
| 76 |
+
<h3 class="font-semibold text-lg text-gray-800 mb-1">Tide Information</h3>
|
| 77 |
+
<div class="grid grid-cols-2 gap-4 mt-2">
|
| 78 |
+
<div class="bg-blue-50 p-3 rounded-lg">
|
| 79 |
+
<p class="text-sm text-blue-500">Next High Tide</p>
|
| 80 |
+
<p id="highTideTime" class="font-medium"></p>
|
| 81 |
+
<p id="highTideHeight" class="text-sm text-gray-500"></p>
|
| 82 |
+
</div>
|
| 83 |
+
<div class="bg-blue-50 p-3 rounded-lg">
|
| 84 |
+
<p class="text-sm text-blue-500">Next Low Tide</p>
|
| 85 |
+
<p id="lowTideTime" class="font-medium"></p>
|
| 86 |
+
<p id="lowTideHeight" class="text-sm text-gray-500"></p>
|
| 87 |
+
</div>
|
| 88 |
+
</div>
|
| 89 |
+
</div>
|
| 90 |
+
</div>
|
| 91 |
+
</div>
|
| 92 |
+
|
| 93 |
+
<div class="mt-6 text-center text-gray-500 text-sm">
|
| 94 |
+
<p>Click the search button or press Enter to find your location</p>
|
| 95 |
+
</div>
|
| 96 |
+
</div>
|
| 97 |
+
</div>
|
| 98 |
+
|
| 99 |
+
<script>
|
| 100 |
+
document.addEventListener('DOMContentLoaded', function() {
|
| 101 |
+
// Initialize map with a default view
|
| 102 |
+
const map = L.map('map').setView([51.505, -0.09], 13);
|
| 103 |
+
|
| 104 |
+
// Add tile layer (OpenStreetMap)
|
| 105 |
+
L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {
|
| 106 |
+
attribution: '© <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors'
|
| 107 |
+
}).addTo(map);
|
| 108 |
+
|
| 109 |
+
// Create a marker but don't add it to the map yet
|
| 110 |
+
let marker = null;
|
| 111 |
+
|
| 112 |
+
// Function to update the map with the searched location
|
| 113 |
+
function updateMap(location) {
|
| 114 |
+
// Use Nominatim API for geocoding
|
| 115 |
+
fetch(`https://nominatim.openstreetmap.org/search?format=json&q=${encodeURIComponent(location)}`)
|
| 116 |
+
.then(response => response.json())
|
| 117 |
+
.then(data => {
|
| 118 |
+
if (data.length > 0) {
|
| 119 |
+
const lat = parseFloat(data[0].lat);
|
| 120 |
+
const lon = parseFloat(data[0].lon);
|
| 121 |
+
const displayName = data[0].display_name;
|
| 122 |
+
|
| 123 |
+
// Update map view
|
| 124 |
+
map.setView([lat, lon], 15);
|
| 125 |
+
|
| 126 |
+
// Remove previous marker if exists
|
| 127 |
+
if (marker) {
|
| 128 |
+
map.removeLayer(marker);
|
| 129 |
+
}
|
| 130 |
+
|
| 131 |
+
// Add new marker with custom icon
|
| 132 |
+
const customIcon = L.icon({
|
| 133 |
+
iconUrl: 'https://cdn0.iconfinder.com/data/icons/small-n-flat/24/678111-map-marker-512.png',
|
| 134 |
+
iconSize: [32, 32],
|
| 135 |
+
iconAnchor: [16, 32],
|
| 136 |
+
popupAnchor: [0, -32]
|
| 137 |
+
});
|
| 138 |
+
|
| 139 |
+
marker = L.marker([lat, lon], {icon: customIcon}).addTo(map)
|
| 140 |
+
.bindPopup(displayName)
|
| 141 |
+
.openPopup();
|
| 142 |
+
|
| 143 |
+
// Show location info
|
| 144 |
+
document.getElementById('locationInfo').classList.remove('hidden');
|
| 145 |
+
document.getElementById('address').textContent = displayName;
|
| 146 |
+
document.getElementById('coordinates').textContent = `Latitude: ${lat.toFixed(6)}, Longitude: ${lon.toFixed(6)}`;
|
| 147 |
+
|
| 148 |
+
// Check if near coast and fetch tide data
|
| 149 |
+
fetchTideData(lat, lon);
|
| 150 |
+
} else {
|
| 151 |
+
alert('Location not found. Please try a different search term.');
|
| 152 |
+
}
|
| 153 |
+
})
|
| 154 |
+
.catch(error => {
|
| 155 |
+
console.error('Error:', error);
|
| 156 |
+
alert('There was an error processing your request. Please try again.');
|
| 157 |
+
});
|
| 158 |
+
}
|
| 159 |
+
|
| 160 |
+
// Search button click event
|
| 161 |
+
document.getElementById('searchButton').addEventListener('click', function() {
|
| 162 |
+
const location = document.getElementById('locationInput').value.trim();
|
| 163 |
+
if (location) {
|
| 164 |
+
updateMap(location);
|
| 165 |
+
} else {
|
| 166 |
+
alert('Please enter a location to search.');
|
| 167 |
+
}
|
| 168 |
+
});
|
| 169 |
+
|
| 170 |
+
// Enter key press event
|
| 171 |
+
document.getElementById('locationInput').addEventListener('keypress', function(e) {
|
| 172 |
+
if (e.key === 'Enter') {
|
| 173 |
+
const location = document.getElementById('locationInput').value.trim();
|
| 174 |
+
if (location) {
|
| 175 |
+
updateMap(location);
|
| 176 |
+
} else {
|
| 177 |
+
alert('Please enter a location to search.');
|
| 178 |
+
}
|
| 179 |
+
}
|
| 180 |
+
});
|
| 181 |
+
// Function to fetch tide data
|
| 182 |
+
async function fetchTideData(lat, lon) {
|
| 183 |
+
try {
|
| 184 |
+
// First check if location is near coast
|
| 185 |
+
const coastlineResponse = await fetch(`https://api.onwater.io/api/v1/results/${lat},${lon}?access_key=demo`);
|
| 186 |
+
const coastlineData = await coastlineResponse.json();
|
| 187 |
+
|
| 188 |
+
if (coastlineData.water) {
|
| 189 |
+
// Get tide data (using WorldTides API - note: you'll need to get your own API key)
|
| 190 |
+
const now = Math.floor(Date.now() / 1000);
|
| 191 |
+
const tideResponse = await fetch(`https://www.worldtides.info/api/v2?heights&lat=${lat}&lon=${lon}&start=${now}&length=86400&key=YOUR_API_KEY`);
|
| 192 |
+
const tideData = await tideResponse.json();
|
| 193 |
+
|
| 194 |
+
if (tideData.heights && tideData.heights.length > 0) {
|
| 195 |
+
// Find next high and low tides
|
| 196 |
+
const nextHigh = tideData.heights.find(h => h.type === 'high');
|
| 197 |
+
const nextLow = tideData.heights.find(h => h.type === 'low');
|
| 198 |
+
|
| 199 |
+
if (nextHigh && nextLow) {
|
| 200 |
+
const formatTime = (timestamp) => {
|
| 201 |
+
return new Date(timestamp * 1000).toLocaleTimeString([], {hour: '2-digit', minute:'2-digit'});
|
| 202 |
+
};
|
| 203 |
+
|
| 204 |
+
document.getElementById('tideInfo').classList.remove('hidden');
|
| 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 |
+
}
|
| 212 |
+
} catch (error) {
|
| 213 |
+
console.error('Error fetching tide data:', error);
|
| 214 |
+
// Silently fail - tide info is optional
|
| 215 |
+
}
|
| 216 |
+
}
|
| 217 |
+
});
|
| 218 |
+
</script>
|
| 219 |
+
<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=mirthbottle/activities-planner" style="color: #fff;text-decoration: underline;" target="_blank" >Remix</a></p></body>
|
| 220 |
+
</html>
|