adds waypoint images

This commit is contained in:
Christian Beutel
2024-03-20 20:55:44 +01:00
parent e5b5e50747
commit c7cc33b3e6
2 changed files with 10 additions and 20 deletions

View File

@@ -15,7 +15,7 @@
(photoFiles ?? []).map(async (f) => {
return await readAsDataURLAsync(f);
}),
).then((v) => {
).then((v) => {
photoPreviews = v;
});
@@ -59,20 +59,7 @@
if (!photoFiles) {
photoFiles = [];
}
photoFiles.push(file);
// (function (file) {
// var reader = new FileReader();
// reader.onload = function (e) {
// if (e.target?.result) {
// photoPreviews = [
// ...photoPreviews,
// e.target.result as string,
// ];
// }
// };
// reader.readAsDataURL(file);
// })(file);
photoFiles = [...photoFiles, file]
}
}

View File

@@ -40,13 +40,16 @@
class="flex gap-4 p-4 border border-input-border rounded-md my-2 hover:bg-menu-item-background-hover"
>
{#if imgSrc.length}
<PhotoGallery
photos={waypoint.photos.map((p) => getFileURL(waypoint, p))}
bind:open={openGallery}
></PhotoGallery>
{#if mode == "show"}
<PhotoGallery
photos={waypoint.photos.map((p) => getFileURL(waypoint, p))}
bind:open={openGallery}
></PhotoGallery>
{/if}
<button
class="relative basis-16 aspect-square ml-2 mb-3 shrink-0"
on:click={() => openGallery()}
type="button"
on:click={mode == "show" ? () => openGallery() : undefined}
>
{#each imgSrc as img, i}
<img