[ui] image loading spinner

feat/vaults
Tomáš Mládek 2022-01-24 18:09:07 +01:00
parent c6ad259851
commit 7134a7db52
1 changed files with 11 additions and 1 deletions

View File

@ -1,5 +1,6 @@
<script lang="ts">
import { useEntity } from "../../lib/entity";
import Spinner from "../utils/Spinner.svelte";
import ModelViewer from "./blobs/ModelViewer.svelte";
import TextViewer from "./blobs/TextViewer.svelte";
export let address: string;
@ -12,6 +13,8 @@
["audio", "video", "image", "model", "text"].some((prefix) =>
mimeType.startsWith(prefix)
);
let imageLoaded = null;
</script>
{#if handled}
@ -35,7 +38,14 @@
{/if}
{#if mimeType?.startsWith("image")}
<a target="_blank" href="/api/raw/{address}">
<img src="/api/thumb/{address}" alt={address} />
{#if imageLoaded != address}
<Spinner />
{/if}
<img
src="/api/thumb/{address}"
alt={address}
on:load={() => (imageLoaded = address)}
/>
</a>
{/if}
{#if mimeType?.startsWith("model")}