fixes multiple issues
This commit is contained in:
@@ -103,22 +103,23 @@
|
|||||||
const baseMaps: Record<string, L.TileLayer> = {
|
const baseMaps: Record<string, L.TileLayer> = {
|
||||||
OpenStreetMaps: baseLayer,
|
OpenStreetMaps: baseLayer,
|
||||||
OpenTopoMaps: topoLayer,
|
OpenTopoMaps: topoLayer,
|
||||||
...($page.data.settings as Settings).tilesets?.reduce<
|
...($page.data.settings as Settings)?.tilesets?.reduce< Record<string, string>>((t, current) => {
|
||||||
Record<string, string>
|
|
||||||
>((t, current) => {
|
|
||||||
t[current.name] = L.tileLayer(current.url);
|
t[current.name] = L.tileLayer(current.url);
|
||||||
return t;
|
return t;
|
||||||
}, {}),
|
}, {}),
|
||||||
};
|
};
|
||||||
|
|
||||||
L.control.layers(baseMaps).addTo(map);
|
L.control.layers(baseMaps).addTo(map);
|
||||||
|
|
||||||
const layerPreference = localStorage.getItem("layer")
|
const layerPreference = localStorage.getItem("layer");
|
||||||
|
|
||||||
if (layerPreference && Object.keys(baseMaps).includes(layerPreference)) {
|
if (
|
||||||
baseMaps[layerPreference].addTo(map!)
|
layerPreference &&
|
||||||
}else {
|
Object.keys(baseMaps).includes(layerPreference)
|
||||||
baseLayer.addTo(map)
|
) {
|
||||||
|
baseMaps[layerPreference].addTo(map!);
|
||||||
|
} else {
|
||||||
|
baseLayer.addTo(map);
|
||||||
}
|
}
|
||||||
|
|
||||||
map!.on("baselayerchange", function (e) {
|
map!.on("baselayerchange", function (e) {
|
||||||
|
|||||||
@@ -54,7 +54,9 @@
|
|||||||
]
|
]
|
||||||
: []),
|
: []),
|
||||||
{ text: $_("print"), value: "print", icon: "print" },
|
{ text: $_("print"), value: "print", icon: "print" },
|
||||||
{ text: $_("add-to-list"), value: "list", icon: "bookmark" },
|
...(trail.author != pb.authStore.model?.id
|
||||||
|
? []
|
||||||
|
: [{ text: $_("add-to-list"), value: "list", icon: "bookmark" }]),
|
||||||
...(trail.author != pb.authStore.model?.id
|
...(trail.author != pb.authStore.model?.id
|
||||||
? []
|
? []
|
||||||
: [{ text: $_("share"), value: "share", icon: "share" }]),
|
: [{ text: $_("share"), value: "share", icon: "share" }]),
|
||||||
|
|||||||
@@ -219,7 +219,7 @@
|
|||||||
</h3>
|
</h3>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
{#if ($currentUser && $currentUser.id == trail.author) || trail.expand.trail_share_via_trail?.length}
|
{#if ($currentUser && $currentUser.id == trail.author) || trail.expand.trail_share_via_trail?.length || trail.public}
|
||||||
<TrailDropdown {trail} {mode}></TrailDropdown>
|
<TrailDropdown {trail} {mode}></TrailDropdown>
|
||||||
{/if}
|
{/if}
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ import Waypoint from './waypoint';
|
|||||||
const defaultAttributes = {
|
const defaultAttributes = {
|
||||||
version: '1.1',
|
version: '1.1',
|
||||||
creator: 'wanderer',
|
creator: 'wanderer',
|
||||||
xmlns: 'http://www.topografix.com/GPX/1/1',
|
'xmlns:prod': 'http://www.topografix.com/GPX/1/1',
|
||||||
'xmlns:xsi': 'http://www.w3.org/2001/XMLSchema-instance',
|
'xmlns:xsi': 'http://www.w3.org/2001/XMLSchema-instance',
|
||||||
'xsi:schemaLocation':
|
'xsi:schemaLocation':
|
||||||
'http://www.topografix.com/GPX/1/1 http://www.topografix.com/GPX/1/1/gpx.xsd'
|
'http://www.topografix.com/GPX/1/1 http://www.topografix.com/GPX/1/1/gpx.xsd'
|
||||||
@@ -18,7 +18,7 @@ export default class GPX {
|
|||||||
$: {
|
$: {
|
||||||
version: string;
|
version: string;
|
||||||
creator: string;
|
creator: string;
|
||||||
xmlns: string;
|
'xmlns:prod': string;
|
||||||
'xmlns:xsi': string;
|
'xmlns:xsi': string;
|
||||||
'xsi:schemaLocation': string;
|
'xsi:schemaLocation': string;
|
||||||
}
|
}
|
||||||
@@ -32,7 +32,7 @@ export default class GPX {
|
|||||||
$?: {
|
$?: {
|
||||||
version: string,
|
version: string,
|
||||||
creator: string,
|
creator: string,
|
||||||
xmlns: string,
|
'xmlns:prod': string,
|
||||||
'xmlns:xsi': string,
|
'xmlns:xsi': string,
|
||||||
'xsi:schemaLocation': string,
|
'xsi:schemaLocation': string,
|
||||||
}
|
}
|
||||||
@@ -144,8 +144,10 @@ export default class GPX {
|
|||||||
options = options || {};
|
options = options || {};
|
||||||
options.rootName = 'gpx';
|
options.rootName = 'gpx';
|
||||||
|
|
||||||
const builder = new xml2js.Builder(options), gpx = new GPX(this);
|
const builder = new xml2js.Builder(options)
|
||||||
|
const gpx = new GPX(this);
|
||||||
allDatesToISOString(gpx);
|
allDatesToISOString(gpx);
|
||||||
return builder.buildObject(gpx);
|
|
||||||
|
return builder.buildObject(gpx).replace('xmlns:prod', 'xmlns');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -51,7 +51,13 @@
|
|||||||
formatElevation,
|
formatElevation,
|
||||||
formatTimeHHMM,
|
formatTimeHHMM,
|
||||||
} from "$lib/util/format_util";
|
} from "$lib/util/format_util";
|
||||||
import { fromFIT, fromKML, fromTCX, gpx2trail, isFITFile } from "$lib/util/gpx_util";
|
import {
|
||||||
|
fromFIT,
|
||||||
|
fromKML,
|
||||||
|
fromTCX,
|
||||||
|
gpx2trail,
|
||||||
|
isFITFile,
|
||||||
|
} from "$lib/util/gpx_util";
|
||||||
import {
|
import {
|
||||||
createAnchorMarker,
|
createAnchorMarker,
|
||||||
createMarkerFromWaypoint,
|
createMarkerFromWaypoint,
|
||||||
@@ -113,7 +119,10 @@
|
|||||||
const { form, errors, handleChange, handleSubmit } = createForm<Trail>({
|
const { form, errors, handleChange, handleSubmit } = createForm<Trail>({
|
||||||
initialValues: {
|
initialValues: {
|
||||||
...data.trail,
|
...data.trail,
|
||||||
category: $page.data.settings?.category || $categories[0].id,
|
category:
|
||||||
|
data.trail.category ||
|
||||||
|
$page.data.settings?.category ||
|
||||||
|
$categories[0].id,
|
||||||
},
|
},
|
||||||
validationSchema: trailSchema,
|
validationSchema: trailSchema,
|
||||||
onError: (errors) => {
|
onError: (errors) => {
|
||||||
@@ -189,7 +198,7 @@
|
|||||||
show_toast({
|
show_toast({
|
||||||
type: "success",
|
type: "success",
|
||||||
icon: "check",
|
icon: "check",
|
||||||
text: $_('trail-saved-successfully'),
|
text: $_("trail-saved-successfully"),
|
||||||
});
|
});
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.error(e);
|
console.error(e);
|
||||||
@@ -197,7 +206,7 @@
|
|||||||
show_toast({
|
show_toast({
|
||||||
type: "error",
|
type: "error",
|
||||||
icon: "close",
|
icon: "close",
|
||||||
text: $_('error-saving-trail'),
|
text: $_("error-saving-trail"),
|
||||||
});
|
});
|
||||||
} finally {
|
} finally {
|
||||||
loading = false;
|
loading = false;
|
||||||
|
|||||||
Reference in New Issue
Block a user