- {#each node.children as child, i}
-
- {/each}
- {#if node.wpt.length > 0}
-
- Waypoints
-
- {#each node.wpt as wpt, i}
-
- {/each}
-
-
+{#if node instanceof Map}
+
+{:else}
+
+
+ {#if node instanceof GPXFile}
+ {node.metadata.name}
+ {:else if node instanceof Track}
+ {node.name ?? `Track ${index + 1}`}
+ {:else if Array.isArray(node) && node.length > 0 && node[0] instanceof Waypoint}
+ Waypoints
{/if}
+
+
+
-{:else if node instanceof Track}
-
- {node.name ?? `Track ${index + 1}`}
-
- {#each node.children as child, i}
-
- {/each}
-
-
-{:else if node instanceof TrackSegment}
-
{/if}
diff --git a/website/src/lib/components/file-list/FileListNodeContent.svelte b/website/src/lib/components/file-list/FileListNodeContent.svelte
new file mode 100644
index 00000000..e14ceaeb
--- /dev/null
+++ b/website/src/lib/components/file-list/FileListNodeContent.svelte
@@ -0,0 +1,95 @@
+
+
+
+ {#if node instanceof Map}
+ {#each Array.from(node.values()) as file}
+
+ handleClick(e.detail.id)} />
+
+ {/each}
+ {:else if node instanceof GPXFile}
+ {#each node.children as child, i}
+
+ handleClick(e.detail.id)}
+ />
+
+ {/each}
+ {#if node.wpt.length > 0}
+
+ handleClick(e.detail.id)} />
+
+ {/if}
+ {:else if node instanceof Track}
+ {#each node.children as child, i}
+
+
+
+ {/each}
+ {:else if Array.isArray(node) && node.length > 0 && node[0] instanceof Waypoint}
+ {#each node as wpt, i}
+
+
+
+ {/each}
+ {/if}
+
+
+
diff --git a/website/src/lib/components/file-list/FileListItem.svelte b/website/src/lib/components/file-list/FileListNodeStore.svelte
similarity index 64%
rename from website/src/lib/components/file-list/FileListItem.svelte
rename to website/src/lib/components/file-list/FileListNodeStore.svelte
index 85da4c18..9785bc83 100644
--- a/website/src/lib/components/file-list/FileListItem.svelte
+++ b/website/src/lib/components/file-list/FileListNodeStore.svelte
@@ -3,13 +3,20 @@
import FileListNode from '$lib/components/file-list/FileListNode.svelte';
import type { GPXFileWithStatistics } from '$lib/db';
+ import { createEventDispatcher } from 'svelte';
import type { Readable } from 'svelte/store';
export let file: Readable
;
+
+ const dispatch = createEventDispatcher();
+
+ function forwardId() {
+ dispatch('click', { id: $file?.file._data.id });
+ }
{#if $file}
-
+
{/if}