From d50fdf20a7dfaebf76435760047af1f1e25685da Mon Sep 17 00:00:00 2001 From: vcoppe Date: Tue, 21 May 2024 17:47:08 +0200 Subject: [PATCH] vertical and horizontal file list with same component --- website/src/lib/components/App.svelte | 5 +- .../CollapsibleTreeNode.svelte | 1 - .../lib/components/file-list/FileList.svelte | 13 ++- .../components/file-list/FileListNode.svelte | 33 ++++---- .../file-list/FileListNodeContent.svelte | 57 +++++-------- .../file-list/FileListNodeLabel.svelte | 80 +++++++++++++------ .../file-list/FileListNodeStore.svelte | 18 ++--- 7 files changed, 118 insertions(+), 89 deletions(-) diff --git a/website/src/lib/components/App.svelte b/website/src/lib/components/App.svelte index 23c5e40c..de791aaf 100644 --- a/website/src/lib/components/App.svelte +++ b/website/src/lib/components/App.svelte @@ -19,13 +19,16 @@ +
+ +
- + diff --git a/website/src/lib/components/file-list/FileListNodeLabel.svelte b/website/src/lib/components/file-list/FileListNodeLabel.svelte index 2e1d1d3f..02bbad96 100644 --- a/website/src/lib/components/file-list/FileListNodeLabel.svelte +++ b/website/src/lib/components/file-list/FileListNodeLabel.svelte @@ -1,4 +1,12 @@ - { - e.stopPropagation(); // Avoid toggling the collapsible element - }} - on:contextmenu={(e) => { - if (e.ctrlKey) { - // Add to selection instead of opening context menu - e.preventDefault(); - e.stopPropagation(); - selected.update((value) => { - if (value.has(id)) { - value.delete(id); - } else { - value.add(id); - } - return value; - }); - } - }} -> - {label} - + + + + + + + + {$_('menu.duplicate')} + + + + {$_('menu.delete')} + + + diff --git a/website/src/lib/components/file-list/FileListNodeStore.svelte b/website/src/lib/components/file-list/FileListNodeStore.svelte index 9785bc83..a8586393 100644 --- a/website/src/lib/components/file-list/FileListNodeStore.svelte +++ b/website/src/lib/components/file-list/FileListNodeStore.svelte @@ -3,20 +3,20 @@ import FileListNode from '$lib/components/file-list/FileListNode.svelte'; import type { GPXFileWithStatistics } from '$lib/db'; - import { createEventDispatcher } from 'svelte'; + import { getContext } from 'svelte'; import type { Readable } from 'svelte/store'; export let file: Readable; - const dispatch = createEventDispatcher(); - - function forwardId() { - dispatch('click', { id: $file?.file._data.id }); - } + let recursive = getContext('recursive'); {#if $file} - - - + {#if recursive} + + + + {:else} + + {/if} {/if}