Trail Table: Allow multi select (#264)
* trail table: multi select * trail cards: multi select * multiselect for list view, several multiselect fixes, code beautify * remove unnecessary imports, move code to simplify diff of trail_dropdown * translations * fix horizontal scrollbar in table view * direct export from list, multiselect export * fix refreshing share icon after sharing from trail list * fix adding multiple trails to a trail-list * fix retrieving mail notification template * migrates to v0.17.0 --------- Co-authored-by: Christian Beutel <>
This commit is contained in:
@@ -14,6 +14,8 @@ import JSZip from "jszip";
|
||||
import type { AuthRecord } from "pocketbase";
|
||||
import * as xmldom from 'xmldom';
|
||||
import { bbox, splitMultiLineStringToLineStrings } from "./geojson_util";
|
||||
import { trails_show } from "$lib/stores/trail_store";
|
||||
import { handleFromRecordWithIRI } from "./activitypub_util";
|
||||
|
||||
|
||||
export async function gpx2trail(gpxString: string, fallbackName?: string, f: (url: RequestInfo | URL, config?: RequestInit) => Promise<Response> = fetch) {
|
||||
@@ -71,10 +73,21 @@ export async function gpx2trail(gpxString: string, fallbackName?: string, f: (ur
|
||||
}
|
||||
|
||||
export async function trail2gpx(trail: Trail, user?: AuthRecord) {
|
||||
let gpxTrail = trail;
|
||||
|
||||
if (!trail.expand?.gpx_data) {
|
||||
throw Error("Trail has no GPX data")
|
||||
// no gpx_data -> empty trail?
|
||||
// or just not expanded? -> expand now
|
||||
const response = await trails_show(trail.id!, handleFromRecordWithIRI(trail), true);
|
||||
|
||||
if (!response.expand?.gpx_data) {
|
||||
throw Error("Trail has no GPX data")
|
||||
} else {
|
||||
gpxTrail = response;
|
||||
}
|
||||
}
|
||||
const gpx = await GPX.parse(trail.expand.gpx_data) as GPX;
|
||||
|
||||
const gpx = await GPX.parse(gpxTrail.expand!.gpx_data!) as GPX;
|
||||
|
||||
if (gpx instanceof Error) {
|
||||
throw gpx;
|
||||
@@ -92,7 +105,7 @@ export async function trail2gpx(trail: Trail, user?: AuthRecord) {
|
||||
gpx.wpt = [];
|
||||
}
|
||||
|
||||
for (const wp of trail.expand.waypoints ?? []) {
|
||||
for (const wp of gpxTrail.expand!.waypoints ?? []) {
|
||||
const gpxWpt = gpx.wpt.find((w) => w.$.lat == wp.lat && w.$.lon == wp.lon)
|
||||
if (!gpxWpt) {
|
||||
gpx.wpt.push({
|
||||
|
||||
Reference in New Issue
Block a user