full frontend refactor

This commit is contained in:
2026-01-25 10:26:23 +01:00
parent 317ee96ba3
commit 559a4c3e9f
18 changed files with 2803 additions and 1224 deletions

View File

@@ -0,0 +1,42 @@
// ============================================================================
// COORDINATE & DISTANCE FORMATTING UTILITIES
// ============================================================================
/**
* Format coordinate to 6 decimal places (±11cm precision)
*/
export function formatCoordinate(value, type) {
const dir = type === 'lat'
? (value >= 0 ? 'N' : 'S')
: (value >= 0 ? 'E' : 'W');
return `${Math.abs(value).toFixed(6)}°${dir}`;
}
/**
* Format distance in meters or feet based on unit preference
*/
export function formatDistance(meters, useImperial = false) {
if (useImperial) {
const feet = meters * 3.28084;
if (feet < 5280) {
return `${feet.toFixed(1)} ft`;
} else {
const miles = feet / 5280;
return `${miles.toFixed(2)} mi`;
}
} else {
if (meters < 1000) {
return `${meters.toFixed(1)} m`;
} else {
const km = meters / 1000;
return `${km.toFixed(2)} km`;
}
}
}
/**
* Format bearing angle
*/
export function formatBearing(degrees) {
return `${degrees.toFixed(1)}°`;
}