Migrates to svelte 5

This commit is contained in:
Christian Beutel
2025-01-24 17:46:13 +01:00
parent 7571f6e9b9
commit 3721b7f537
106 changed files with 5524 additions and 4232 deletions

View File

@@ -1,4 +1,4 @@
import { page } from "$app/stores";
import { page } from "$app/state";
import { get } from "svelte/store";
export function formatTimeHHMM(minutes?: number) {
@@ -17,7 +17,7 @@ export function formatDistance(meters?: number) {
return "-";
}
const unit = get(page).data.settings?.unit ?? "metric";
const unit = page.data.settings?.unit ?? "metric";
if (unit == "metric") {
if (meters >= 1000) {
@@ -38,7 +38,7 @@ export function formatElevation(meters?: number) {
return "-";
}
const unit = get(page).data.settings?.unit ?? "metric";
const unit = page.data.settings?.unit ?? "metric";
if (unit == "metric") {
return `${Math.round(meters)} m`
@@ -54,7 +54,7 @@ export function formatSpeed(speed?: number) {
return "-";
}
const unit = get(page).data.settings?.unit ?? "metric";
const unit = page.data.settings?.unit ?? "metric";
if (unit == "metric") {
return `${(speed * 3.6).toFixed(2)} km/h`

View File

@@ -29,6 +29,7 @@ export class FontawesomeMarker extends M.Marker {
export function createMarkerFromWaypoint(waypoint: Waypoint, onDragEnd?: (marker: M.Marker, wpId?: string) => void): FontawesomeMarker {
const marker = new FontawesomeMarker({
id: waypoint.id,
icon: `fa fa-${waypoint.icon}`,
}, {
draggable: onDragEnd !== undefined,