From a6ba81b50e312a6f1ebdbe195b5ac82dc8d5910b Mon Sep 17 00:00:00 2001 From: Dominic Kempf Date: Mon, 22 Jul 2024 14:39:15 +0200 Subject: [PATCH] Implement rudimentary asset viewer capabilities --- src/App.svelte | 3 +- src/components/EasyDBDetailView.svelte | 2 + src/components/logic/AssetDispatch.svelte | 23 +++++++++ src/components/logic/AssetViewer.svelte | 63 +++++++++++++++++++++++ src/components/viewer/ImageViewer.svelte | 11 ++++ src/components/viewer/VideoViewer.svelte | 7 +++ 6 files changed, 107 insertions(+), 2 deletions(-) create mode 100644 src/components/logic/AssetDispatch.svelte create mode 100644 src/components/logic/AssetViewer.svelte create mode 100644 src/components/viewer/ImageViewer.svelte create mode 100644 src/components/viewer/VideoViewer.svelte diff --git a/src/App.svelte b/src/App.svelte index b5109c9..3503b7a 100644 --- a/src/App.svelte +++ b/src/App.svelte @@ -1,6 +1,6 @@ + +{#if asset.class in componentMapping} + +{:else} + +{/if} diff --git a/src/components/logic/AssetViewer.svelte b/src/components/logic/AssetViewer.svelte new file mode 100644 index 0000000..4748860 --- /dev/null +++ b/src/components/logic/AssetViewer.svelte @@ -0,0 +1,63 @@ + + + +{#if assets.length > 0} + + {#if assets.every((asset) => asset.class === "image") } + + + + {:else} + + {#if assets.length > 1} + Pagination + + {/if} + {#each assets as asset} + + {/each} + {/if} +{/if} diff --git a/src/components/viewer/ImageViewer.svelte b/src/components/viewer/ImageViewer.svelte new file mode 100644 index 0000000..10b5f1c --- /dev/null +++ b/src/components/viewer/ImageViewer.svelte @@ -0,0 +1,11 @@ + + + +{asset.original_filename} diff --git a/src/components/viewer/VideoViewer.svelte b/src/components/viewer/VideoViewer.svelte new file mode 100644 index 0000000..071b779 --- /dev/null +++ b/src/components/viewer/VideoViewer.svelte @@ -0,0 +1,7 @@ + + +