Spaces:
Running

File size: 12,143 Bytes
f77fe8b
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
<!DOCTYPE html>
<html lang="en" class="dark">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Interactive Map - MapCraft Navigator</title>
    <link rel="icon" type="image/x-icon" href="/static/favicon.ico">
    <script src="https://cdn.tailwindcss.com"></script>
    <script src="https://unpkg.com/feather-icons"></script>
    <script src="https://cdn.jsdelivr.net/npm/feather-icons/dist/feather.min.js"></script>
    <link rel="stylesheet" href="style.css">
    <script>
        tailwind.config = {
            darkMode: 'class',
            theme: {
                extend: {
                    colors: {
                        primary: {
                            50: '#f0f9ff',
                            100: '#e0f2fe',
                            200: '#bae6fd',
                            300: '#7dd3fc',
                            400: '#38bdf8',
                            500: '#0ea5e9',
                            600: '#0284c7',
                            700: '#0369a1',
                            800: '#075985',
                            900: '#0c4a6e',
                        },
                        secondary: {
                            50: '#faf5ff',
                            100: '#f3e8ff',
                            200: '#e9d5ff',
                            300: '#d8b4fe',
                            400: '#c084fc',
                            500: '#a855f7',
                            600: '#9333ea',
                            700: '#7e22ce',
                            800: '#6b21a8',
                            900: '#581c87',
                        }
                    }
                }
            }
        }
    </script>
    <script src="https://unpkg.com/leaflet@1.9.4/dist/leaflet.js"></script>
    <link rel="stylesheet" href="https://unpkg.com/leaflet@1.9.4/dist/leaflet.css" />
</head>
<body class="bg-gray-900 text-gray-100 min-h-screen flex flex-col">
    <!-- Navigation Component -->
    <script src="components/navigation.js"></script>
    <custom-navigation active-page="map"></custom-navigation>

    <!-- Map Container -->
    <main class="flex-1 container mx-auto px-4 py-6">
        <div class="mb-6">
            <h1 class="text-3xl font-bold text-gray-100 mb-2">Interactive Map</h1>
            <p class="text-gray-400">Pan, zoom, and search for locations. Click on any marker for details.</p>
        </div>

        <div class="grid grid-cols-1 lg:grid-cols-4 gap-6">
            <!-- Sidebar -->
            <div class="lg:col-span-1">
                <div class="bg-gray-800 rounded-xl p-6 border border-gray-700 h-full">
                    <h2 class="text-xl font-bold mb-4 text-gray-100 flex items-center">
                        <i data-feather="map" class="mr-2 text-primary-400"></i>
                        Map Controls
                    </h2>
                    
                    <!-- Search Box -->
                    <div class="mb-6">
                        <label class="block text-sm font-medium text-gray-300 mb-2">Search Location</label>
                        <div class="relative">
                            <input type="text" id="searchInput" placeholder="Enter address or place name" class="w-full px-4 py-3 bg-gray-700 border border-gray-600 rounded-lg text-gray-100 placeholder-gray-400 focus:outline-none focus:ring-2 focus:ring-primary-500 focus:border-transparent">
                            <button id="searchButton" class="absolute right-3 top-3 text-gray-400 hover:text-primary-400">
                                <i data-feather="search"></i>
                            </button>
                        </div>
                    </div>

                    <!-- Map Controls -->
                    <div class="mb-6">
                        <h3 class="font-medium text-gray-300 mb-3">Map Tools</h3>
                        <div class="space-y-3">
                            <button id="zoomIn" class="w-full flex items-center justify-between px-4 py-3 bg-gray-700 hover:bg-gray-600 rounded-lg transition-colors">
                                <span class="text-gray-200">Zoom In</span>
                                <i data-feather="zoom-in" class="text-primary-400"></i>
                            </button>
                            <button id="zoomOut" class="w-full flex items-center justify-between px-4 py-3 bg-gray-700 hover:bg-gray-600 rounded-lg transition-colors">
                                <span class="text-gray-200">Zoom Out</span>
                                <i data-feather="zoom-out" class="text-primary-400"></i>
                            </button>
                            <button id="resetView" class="w-full flex items-center justify-between px-4 py-3 bg-gray-700 hover:bg-gray-600 rounded-lg transition-colors">
                                <span class="text-gray-200">Reset View</span>
                                <i data-feather="refresh-cw" class="text-secondary-400"></i>
                            </button>
                        </div>
                    </div>

                    <!-- Sample Locations -->
                    <div>
                        <h3 class="font-medium text-gray-300 mb-3">Quick Locations</h3>
                        <div class="space-y-2">
                            <button class="location-btn w-full text-left px-4 py-3 bg-gray-700 hover:bg-gray-600 rounded-lg transition-colors" data-lat="40.7128" data-lng="-74.0060">
                                <div class="font-medium text-gray-100">New York City</div>
                                <div class="text-sm text-gray-400">United States</div>
                            </button>
                            <button class="location-btn w-full text-left px-4 py-3 bg-gray-700 hover:bg-gray-600 rounded-lg transition-colors" data-lat="51.5074" data-lng="-0.1278">
                                <div class="font-medium text-gray-100">London</div>
                                <div class="text-sm text-gray-400">United Kingdom</div>
                            </button>
                            <button class="location-btn w-full text-left px-4 py-3 bg-gray-700 hover:bg-gray-600 rounded-lg transition-colors" data-lat="35.6762" data-lng="139.6503">
                                <div class="font-medium text-gray-100">Tokyo</div>
                                <div class="text-sm text-gray-400">Japan</div>
                            </button>
                        </div>
                    </div>
                </div>
            </div>

            <!-- Map -->
            <div class="lg:col-span-3">
                <div class="bg-gray-800 rounded-xl border border-gray-700 overflow-hidden h-[600px]">
                    <div id="map" class="w-full h-full rounded-lg"></div>
                </div>
                
                <!-- Map Stats -->
                <div class="mt-4 grid grid-cols-1 md:grid-cols-3 gap-4">
                    <div class="bg-gray-800 rounded-lg p-4 border border-gray-700">
                        <div class="flex items-center">
                            <div class="w-10 h-10 rounded-lg bg-primary-900/30 flex items-center justify-center mr-3">
                                <i data-feather="maximize" class="text-primary-400"></i>
                            </div>
                            <div>
                                <div class="text-sm text-gray-400">Current Zoom</div>
                                <div class="text-lg font-bold text-gray-100" id="zoomLevel">12</div>
                            </div>
                        </div>
                    </div>
                    <div class="bg-gray-800 rounded-lg p-4 border border-gray-700">
                        <div class="flex items-center">
                            <div class="w-10 h-10 rounded-lg bg-secondary-900/30 flex items-center justify-center mr-3">
                                <i data-feather="target" class="text-secondary-400"></i>
                            </div>
                            <div>
                                <div class="text-sm text-gray-400">Center Coordinates</div>
                                <div class="text-lg font-bold text-gray-100" id="coordinates">0, 0</div>
                            </div>
                        </div>
                    </div>
                    <div class="bg-gray-800 rounded-lg p-4 border border-gray-700">
                        <div class="flex items-center">
                            <div class="w-10 h-10 rounded-lg bg-primary-900/30 flex items-center justify-center mr-3">
                                <i data-feather="map-pin" class="text-primary-400"></i>
                            </div>
                            <div>
                                <div class="text-sm text-gray-400">Markers Placed</div>
                                <div class="text-lg font-bold text-gray-100" id="markerCount">3</div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </main>

    <!-- Footer Component -->
    <script src="components/footer.js"></script>
    <custom-footer></custom-footer>

    <script src="script.js"></script>
    <script>
        feather.replace();
        
        // Initialize map
        document.addEventListener('DOMContentLoaded', function() {
            const map = L.map('map').setView([40.7128, -74.0060], 12);
            
            L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {
                attribution: '© OpenStreetMap contributors',
                maxZoom: 19,
            }).addTo(map);

            // Add sample markers
            const markers = [
                { lat: 40.7128, lng: -74.0060, title: 'New York City', description: 'The Big Apple' },
                { lat: 40.7580, lng: -73.9855, title: 'Times Square', description: 'Famous intersection' },
                { lat: 40.7829, lng: -73.9654, title: 'Central Park', description: 'Urban park' }
            ];

            markers.forEach(marker => {
                L.marker([marker.lat, marker.lng])
                    .addTo(map)
                    .bindPopup(`<strong>${marker.title}</strong><br>${marker.description}`)
                    .openPopup();
            });

            // Update zoom level
            map.on('zoomend', function() {
                document.getElementById('zoomLevel').textContent = map.getZoom();
            });

            // Update coordinates
            map.on('moveend', function() {
                const center = map.getCenter();
                document.getElementById('coordinates').textContent = 
                    `${center.lat.toFixed(4)}, ${center.lng.toFixed(4)}`;
            });

            // Search functionality
            document.getElementById('searchButton').addEventListener('click', function() {
                const query = document.getElementById('searchInput').value;
                if (query) {
                    alert(`Searching for: ${query}\n\nIn a real implementation, this would connect to a geocoding API.`);
                }
            });

            // Map controls
            document.getElementById('zoomIn').addEventListener('click', function() {
                map.zoomIn();
            });

            document.getElementById('zoomOut').addEventListener('click', function() {
                map.zoomOut();
            });

            document.getElementById('resetView').addEventListener('click', function() {
                map.setView([40.7128, -74.0060], 12);
            });

            // Quick location buttons
            document.querySelectorAll('.location-btn').forEach(button => {
                button.addEventListener('click', function() {
                    const lat = parseFloat(this.dataset.lat);
                    const lng = parseFloat(this.dataset.lng);
                    map.setView([lat, lng], 12);
                });
            });
        });
    </script>
</body>
</html>