bigpappic commited on
Commit
1385e9f
·
verified ·
1 Parent(s): a2050be

Let's deploy this also please include GPS tracking for the Target devices we need to be able to do that as well

Browse files
Files changed (5) hide show
  1. components/navbar.js +7 -5
  2. index.html +3 -6
  3. script.js +45 -12
  4. style.css +9 -6
  5. tracking.html +74 -0
components/navbar.js CHANGED
@@ -68,14 +68,16 @@ ul {
68
  <nav>
69
  <a href="/" class="logo">
70
  <i data-feather="pen-tool" class="logo-icon"></i>
71
- <span>Simple Canvas</span>
72
  </a>
73
  <ul>
74
  <li><a href="/" class="active"><i data-feather="home"></i> Dashboard</a></li>
75
- <li><a href="/create.html"><i data-feather="plus-square"></i> Create</a></li>
76
- <li><a href="/projects.html"><i data-feather="folder"></i> Projects</a></li>
77
- <li><a href="/help.html"><i data-feather="help-circle"></i> Help</a></li>
78
- </ul>
 
 
79
  </nav>
80
  `;
81
  }
 
68
  <nav>
69
  <a href="/" class="logo">
70
  <i data-feather="pen-tool" class="logo-icon"></i>
71
+ <span>Staff Portal</span>
72
  </a>
73
  <ul>
74
  <li><a href="/" class="active"><i data-feather="home"></i> Dashboard</a></li>
75
+ <li><a href="/tasks"><i data-feather="check-square"></i> Tasks</a></li>
76
+ <li><a href="/tracking.html"><i data-feather="map-pin"></i> Tracking</a></li>
77
+ <li><a href="/messages"><i data-feather="mail"></i> Messages</a></li>
78
+ <li><a href="/team"><i data-feather="users"></i> Team</a></li>
79
+ <li><a href="/calendar"><i data-feather="calendar"></i> Calendar</a></li>
80
+ </ul>
81
  </nav>
82
  `;
83
  }
index.html CHANGED
@@ -3,8 +3,8 @@
3
  <head>
4
  <meta charset="UTF-8">
5
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
- <title>Simple Canvas</title>
7
- <link rel="stylesheet" href="style.css">
8
  <script src="https://cdn.tailwindcss.com"></script>
9
  <script src="https://cdn.jsdelivr.net/npm/feather-icons/dist/feather.min.js"></script>
10
  <script src="https://unpkg.com/feather-icons"></script>
@@ -49,9 +49,6 @@
49
  color: 0x0
50
  })
51
  </script>
52
- <script src="https://cdn.jsdelivr.net/npm/feather-icons/dist/feather.min.js"></script>
53
- <script>
54
- feather.replace();
55
- </script>
56
  </body>
57
  </html>
 
3
  <head>
4
  <meta charset="UTF-8">
5
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
+ <title>The Ultimate Blank Canvas</title>
7
+ <link rel="stylesheet" href="style.css">
8
  <script src="https://cdn.tailwindcss.com"></script>
9
  <script src="https://cdn.jsdelivr.net/npm/feather-icons/dist/feather.min.js"></script>
10
  <script src="https://unpkg.com/feather-icons"></script>
 
49
  color: 0x0
50
  })
51
  </script>
52
+ <script src="https://huggingface.co/deepsite/deepsite-badge.js"></script>
 
 
 
53
  </body>
54
  </html>
script.js CHANGED
@@ -1,21 +1,54 @@
1
 
 
2
  document.addEventListener('DOMContentLoaded', function() {
3
- // Initialize all pages with common functionality
4
- feather.replace();
5
 
6
- // Smooth transitions
7
  document.body.style.opacity = '0';
8
  setTimeout(() => {
9
- document.body.style.transition = 'opacity 0.3s ease-in';
10
  document.body.style.opacity = '1';
11
  }, 100);
12
 
13
- // Handle active nav links
14
- const currentPath = window.location.pathname;
15
- const navLinks = document.querySelectorAll('custom-navbar a');
16
- navLinks.forEach(link => {
17
- if (link.getAttribute('href') === currentPath) {
18
- link.classList.add('active');
19
- }
20
- });
21
  });
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
 
2
+ // Initialize tooltips and GPS tracking
3
  document.addEventListener('DOMContentLoaded', function() {
4
+ console.log('The Ultimate Blank Canvas App is ready!');
 
5
 
6
+ // Fade-in animation
7
  document.body.style.opacity = '0';
8
  setTimeout(() => {
9
+ document.body.style.transition = 'opacity 0.5s ease-in';
10
  document.body.style.opacity = '1';
11
  }, 100);
12
 
13
+ // Initialize GPS tracking if on tracking page
14
+ if (window.location.pathname === '/tracking.html') {
15
+ initGPSTracking();
16
+ }
 
 
 
 
17
  });
18
+
19
+ let watchId = null;
20
+ let trackedDevices = [];
21
+
22
+ function initGPSTracking() {
23
+ if (navigator.geolocation) {
24
+ watchId = navigator.geolocation.watchPosition(
25
+ position => {
26
+ const { latitude, longitude } = position.coords;
27
+ updateDevicePosition(latitude, longitude);
28
+ updateMap(latitude, longitude);
29
+ },
30
+ error => console.error('GPS Error:', error),
31
+ { enableHighAccuracy: true, maximumAge: 10000, timeout: 5000 }
32
+ );
33
+ } else {
34
+ console.error('Geolocation is not supported by this browser.');
35
+ }
36
+ }
37
+
38
+ function updateDevicePosition(lat, lng) {
39
+ const deviceId = 'target-device-001'; // Replace with actual device ID
40
+ const timestamp = new Date().toISOString();
41
+
42
+ trackedDevices.push({ deviceId, lat, lng, timestamp });
43
+ localStorage.setItem('trackedDevices', JSON.stringify(trackedDevices));
44
+
45
+ // Update UI
46
+ document.getElementById('current-location').textContent =
47
+ `Lat: ${lat.toFixed(6)}, Lng: ${lng.toFixed(6)}`;
48
+ }
49
+
50
+ function updateMap(lat, lng) {
51
+ // This would integrate with your mapping library (Leaflet, Google Maps, etc.)
52
+ console.log('Updating map to:', lat, lng);
53
+ // Implementation would depend on your chosen mapping library
54
+ }
style.css CHANGED
@@ -1,15 +1,18 @@
1
  @import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');
 
2
  body {
3
  font-family: 'Inter', sans-serif;
4
- margin: 0;
5
- padding: 0;
6
- min-height: 100vh;
7
- display: flex;
8
- flex-direction: column;
 
9
  }
 
10
  /* Animation for the hero section */
11
  @keyframes float {
12
- 0% { transform: translateY(0px); }
13
  50% { transform: translateY(-15px); }
14
  100% { transform: translateY(0px); }
15
  }
 
1
  @import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');
2
+
3
  body {
4
  font-family: 'Inter', sans-serif;
5
+ background-color: #f8fafc;
6
+ }
7
+ #map {
8
+ width: 100%;
9
+ height: 100%;
10
+ z-index: 1;
11
  }
12
+
13
  /* Animation for the hero section */
14
  @keyframes float {
15
+ 0% { transform: translateY(0px); }
16
  50% { transform: translateY(-15px); }
17
  100% { transform: translateY(0px); }
18
  }
tracking.html ADDED
@@ -0,0 +1,74 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <!DOCTYPE html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="UTF-8">
5
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
+ <title>Device Tracking | Simple Canvas</title>
7
+ <link rel="stylesheet" href="style.css">
8
+ <script src="https://cdn.tailwindcss.com"></script>
9
+ <link rel="stylesheet" href="https://unpkg.com/leaflet@1.7.1/dist/leaflet.css" />
10
+ </head>
11
+ <body class="min-h-screen flex flex-col">
12
+ <custom-navbar></custom-navbar>
13
+
14
+ <main class="flex-grow p-6">
15
+ <div class="max-w-6xl mx-auto">
16
+ <h1 class="text-2xl font-bold mb-6">Device Tracking</h1>
17
+
18
+ <div class="grid grid-cols-1 lg:grid-cols-3 gap-6">
19
+ <div class="bg-white p-4 rounded-lg shadow">
20
+ <h2 class="text-xl font-semibold mb-4">Tracking Info</h2>
21
+ <div class="space-y-4">
22
+ <div>
23
+ <h3 class="font-medium">Current Location</h3>
24
+ <p id="current-location" class="text-gray-600">Acquiring location...</p>
25
+ </div>
26
+ <div>
27
+ <h3 class="font-medium">Tracked Devices</h3>
28
+ <ul id="device-list" class="space-y-2">
29
+ <!-- Devices will be populated here -->
30
+ </ul>
31
+ </div>
32
+ <button id="refresh-location" class="bg-blue-600 text-white px-4 py-2 rounded hover:bg-blue-700">
33
+ Refresh Location
34
+ </button>
35
+ </div>
36
+ </div>
37
+
38
+ <div class="lg:col-span-2">
39
+ <div id="map" class="h-96 bg-gray-200 rounded-lg"></div>
40
+ </div>
41
+ </div>
42
+ </div>
43
+ </main>
44
+
45
+ <custom-footer></custom-footer>
46
+
47
+ <script src="components/navbar.js"></script>
48
+ <script src="components/footer.js"></script>
49
+ <script src="https://unpkg.com/leaflet@1.7.1/dist/leaflet.js"></script>
50
+ <script src="script.js"></script>
51
+ <script>
52
+ // Initialize map
53
+ let map;
54
+ document.addEventListener('DOMContentLoaded', () => {
55
+ map = L.map('map').setView([51.505, -0.09], 13);
56
+ L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {
57
+ attribution: '&copy; <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors'
58
+ }).addTo(map);
59
+
60
+ document.getElementById('refresh-location').addEventListener('click', () => {
61
+ if (navigator.geolocation) {
62
+ navigator.geolocation.getCurrentPosition(position => {
63
+ const { latitude, longitude } = position.coords;
64
+ updateDevicePosition(latitude, longitude);
65
+ map.setView([latitude, longitude], 13);
66
+ L.marker([latitude, longitude]).addTo(map)
67
+ .bindPopup('Current Location').openPopup();
68
+ });
69
+ }
70
+ });
71
+ });
72
+ </script>
73
+ </body>
74
+ </html>