Files
comaps/webapp/public/viewer.html
2025-10-25 15:38:41 -07:00

253 lines
5.2 KiB
HTML

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Live Location Sharing - CoMaps</title>
<link rel="stylesheet" href="https://unpkg.com/leaflet@1.9.4/dist/leaflet.css" />
<style>
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
body {
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
background: #f5f5f5;
}
#map {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
}
.info-panel {
position: absolute;
top: 20px;
right: 20px;
background: white;
border-radius: 12px;
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
padding: 20px;
min-width: 300px;
max-width: 400px;
z-index: 1000;
}
.info-panel h2 {
font-size: 18px;
margin-bottom: 12px;
color: #333;
}
.info-item {
display: flex;
justify-content: space-between;
padding: 8px 0;
border-bottom: 1px solid #eee;
font-size: 14px;
}
.info-item:last-child {
border-bottom: none;
}
.info-label {
color: #666;
font-weight: 500;
}
.info-value {
color: #333;
font-weight: 600;
}
.status {
display: inline-block;
padding: 4px 12px;
border-radius: 12px;
font-size: 12px;
font-weight: 600;
}
.status.active {
background: #e8f5e9;
color: #2e7d32;
}
.status.inactive {
background: #ffebee;
color: #c62828;
}
.status.loading {
background: #fff3e0;
color: #ef6c00;
}
.error-message {
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
background: white;
padding: 32px;
border-radius: 12px;
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
text-align: center;
z-index: 2000;
max-width: 400px;
}
.error-message h2 {
color: #d32f2f;
margin-bottom: 12px;
}
.error-message p {
color: #666;
}
.loading-spinner {
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
z-index: 2000;
}
.spinner {
width: 50px;
height: 50px;
border: 4px solid #f3f3f3;
border-top: 4px solid #3498db;
border-radius: 50%;
animation: spin 1s linear infinite;
}
@keyframes spin {
0% { transform: rotate(0deg); }
100% { transform: rotate(360deg); }
}
.nav-info {
background: #e3f2fd;
border-left: 4px solid #2196f3;
padding: 12px;
margin: 12px 0;
border-radius: 4px;
}
.nav-info-label {
font-size: 12px;
color: #1565c0;
font-weight: 600;
margin-bottom: 4px;
}
.nav-info-value {
font-size: 14px;
color: #333;
}
.battery-warning {
background: #fff3cd;
border-left: 4px solid #ff9800;
padding: 12px;
margin: 12px 0;
border-radius: 4px;
font-size: 13px;
color: #856404;
}
.update-time {
text-align: center;
padding: 8px;
background: #f5f5f5;
border-radius: 4px;
font-size: 12px;
color: #666;
margin-top: 12px;
}
.follow-button {
position: absolute;
top: 20px;
right: 20px;
background: white;
border: none;
border-radius: 8px;
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
padding: 12px;
cursor: pointer;
z-index: 1000;
transition: all 0.2s;
display: none;
}
.follow-button:hover {
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
transform: translateY(-2px);
}
.follow-button.visible {
display: block;
}
.follow-button svg {
width: 24px;
height: 24px;
fill: #2196f3;
}
@media (max-width: 768px) {
.info-panel {
top: auto;
bottom: 20px;
right: 20px;
left: 20px;
max-width: none;
}
.follow-button {
top: 20px;
right: 20px;
}
}
</style>
</head>
<body>
<div id="map"></div>
<div class="info-panel" id="infoPanel" style="display: none;">
<div id="statusInfo"></div>
<div id="navInfo"></div>
<div id="batteryWarning"></div>
<div class="update-time" id="updateTime"></div>
</div>
<button class="follow-button" id="followButton" title="Follow location">
<svg viewBox="0 0 24 24">
<path d="M12 8c-2.21 0-4 1.79-4 4s1.79 4 4 4 4-1.79 4-4-1.79-4-4-4zm8.94 3c-.46-4.17-3.77-7.48-7.94-7.94V1h-2v2.06C6.83 3.52 3.52 6.83 3.06 11H1v2h2.06c.46 4.17 3.77 7.48 7.94 7.94V23h2v-2.06c4.17-.46 7.48-3.77 7.94-7.94H23v-2h-2.06zM12 19c-3.87 0-7-3.13-7-7s3.13-7 7-7 7 3.13 7 7-3.13 7-7 7z"/>
</svg>
</button>
<div class="loading-spinner" id="loadingSpinner">
<div class="spinner"></div>
</div>
<div class="error-message" id="errorMessage" style="display: none;">
<h2>Unable to Load Location</h2>
<p id="errorText"></p>
</div>
<script src="https://unpkg.com/leaflet@1.9.4/dist/leaflet.js"></script>
<script src="/crypto.js"></script>
<script src="/app.js"></script>
</body>
</html>