2024-07-11 10:10:36 +02:00
|
|
|
import { File, FilePen, View, type Icon, Settings, Pencil, MapPin, Scissors, CalendarClock, Group, Ungroup, Filter, SquareDashedMousePointer } from "lucide-svelte";
|
|
|
|
import type { ComponentType } from "svelte";
|
|
|
|
|
2024-07-09 17:49:18 +02:00
|
|
|
export const guides: Record<string, string[]> = {
|
|
|
|
'getting-started': [],
|
|
|
|
menu: ['file', 'edit', 'view', 'settings'],
|
|
|
|
'files-and-stats': [],
|
2024-07-10 00:11:47 +02:00
|
|
|
toolbar: ['routing', 'poi', 'scissors', 'time', 'merge', 'extract', 'minify', 'clean'],
|
2024-07-09 17:49:18 +02:00
|
|
|
'map-controls': [],
|
|
|
|
'gpx': [],
|
2024-07-11 18:42:49 +02:00
|
|
|
'integration': [],
|
2024-07-09 17:49:18 +02:00
|
|
|
};
|
|
|
|
|
2024-07-11 10:10:36 +02:00
|
|
|
export const guideIcons: Record<string, string | ComponentType<Icon>> = {
|
2024-07-10 19:19:12 +02:00
|
|
|
"getting-started": "🚀",
|
|
|
|
"menu": "📂 ⚙️",
|
2024-07-11 10:10:36 +02:00
|
|
|
"file": File,
|
|
|
|
"edit": FilePen,
|
|
|
|
"view": View,
|
|
|
|
"settings": Settings,
|
2024-07-10 19:19:12 +02:00
|
|
|
"files-and-stats": "🗂 📈",
|
|
|
|
"toolbar": "🧰",
|
2024-07-11 10:10:36 +02:00
|
|
|
"routing": Pencil,
|
|
|
|
"poi": MapPin,
|
|
|
|
"scissors": Scissors,
|
|
|
|
"time": CalendarClock,
|
|
|
|
"merge": Group,
|
|
|
|
"extract": Ungroup,
|
|
|
|
"minify": Filter,
|
|
|
|
"clean": SquareDashedMousePointer,
|
2024-07-10 19:19:12 +02:00
|
|
|
"map-controls": "🗺",
|
|
|
|
"gpx": "💾",
|
2024-07-11 18:42:49 +02:00
|
|
|
"integration": "{ 👩💻 }",
|
2024-07-10 19:19:12 +02:00
|
|
|
};
|
|
|
|
|
2024-07-09 17:49:18 +02:00
|
|
|
export function getPreviousGuide(currentGuide: string): string | undefined {
|
|
|
|
let subguides = currentGuide.split('/');
|
|
|
|
|
|
|
|
if (subguides.length === 1) {
|
|
|
|
let keys = Object.keys(guides);
|
|
|
|
let index = keys.indexOf(currentGuide);
|
|
|
|
if (index === 0) {
|
|
|
|
return undefined;
|
|
|
|
}
|
2024-07-11 18:42:49 +02:00
|
|
|
let previousGuide = keys[index - 1];
|
2024-07-09 17:49:18 +02:00
|
|
|
if (previousGuide === undefined) {
|
|
|
|
return undefined;
|
|
|
|
} else if (guides[previousGuide].length === 0) {
|
|
|
|
return previousGuide;
|
|
|
|
} else {
|
|
|
|
return `${previousGuide}/${guides[previousGuide][guides[previousGuide].length - 1]}`;
|
|
|
|
}
|
|
|
|
} else {
|
2024-07-26 00:03:29 +02:00
|
|
|
if (guides.hasOwnProperty(subguides[0])) {
|
|
|
|
let subguideIndex = guides[subguides[0]].indexOf(subguides[1]);
|
|
|
|
if (subguideIndex > 0) {
|
|
|
|
return `${subguides[0]}/${guides[subguides[0]][subguideIndex - 1]}`;
|
|
|
|
} else {
|
|
|
|
return subguides[0];
|
|
|
|
}
|
2024-07-09 17:49:18 +02:00
|
|
|
} else {
|
2024-07-26 00:03:29 +02:00
|
|
|
return undefined;
|
2024-07-09 17:49:18 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
export function getNextGuide(currentGuide: string): string | undefined {
|
|
|
|
let subguides = currentGuide.split('/');
|
|
|
|
|
|
|
|
if (subguides.length === 1) {
|
2024-07-26 00:03:29 +02:00
|
|
|
if (guides.hasOwnProperty(currentGuide)) {
|
|
|
|
if (guides[currentGuide].length === 0) {
|
|
|
|
let keys = Object.keys(guides);
|
|
|
|
let index = keys.indexOf(currentGuide);
|
|
|
|
return keys[index + 1];
|
|
|
|
} else {
|
|
|
|
return `${currentGuide}/${guides[currentGuide][0]}`;
|
|
|
|
}
|
2024-07-09 17:49:18 +02:00
|
|
|
} else {
|
2024-07-26 00:03:29 +02:00
|
|
|
return undefined;
|
2024-07-09 17:49:18 +02:00
|
|
|
}
|
|
|
|
} else {
|
2024-07-26 00:03:29 +02:00
|
|
|
if (guides.hasOwnProperty(subguides[0])) {
|
|
|
|
let subguideIndex = guides[subguides[0]].indexOf(subguides[1]);
|
|
|
|
if (subguideIndex < guides[subguides[0]].length - 1) {
|
|
|
|
return `${subguides[0]}/${guides[subguides[0]][subguideIndex + 1]}`;
|
|
|
|
} else {
|
|
|
|
let keys = Object.keys(guides);
|
|
|
|
let index = keys.indexOf(subguides[0]);
|
|
|
|
return keys[index + 1];
|
|
|
|
}
|
2024-07-09 17:49:18 +02:00
|
|
|
} else {
|
2024-07-26 00:03:29 +02:00
|
|
|
return undefined;
|
2024-07-09 17:49:18 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|