썸네일을 메모리와 OPFS에 캐시하도록 개선

This commit is contained in:
static
2025-07-06 05:36:05 +09:00
parent 3a637b14b4
commit 781642fed6
11 changed files with 88 additions and 32 deletions

View File

@@ -10,7 +10,7 @@
name: string;
subtext?: string;
textClass?: ClassValue;
thumbnail?: ArrayBuffer;
thumbnail?: string;
type: "directory" | "file";
}
@@ -22,19 +22,12 @@
thumbnail,
type,
}: Props = $props();
let thumbnailUrl: string | undefined = $state();
$effect(() => {
thumbnailUrl = thumbnail && URL.createObjectURL(new Blob([thumbnail]));
return () => thumbnailUrl && URL.revokeObjectURL(thumbnailUrl);
});
</script>
{#snippet iconSnippet()}
<div class="flex h-10 w-10 items-center justify-center overflow-y-hidden text-xl">
{#if thumbnailUrl}
<img src={thumbnailUrl} alt={name} loading="lazy" />
{#if thumbnail}
<img src={thumbnail} alt={name} loading="lazy" />
{:else if type === "directory"}
<IconFolder />
{:else}