show file sizes (basic version)

This commit is contained in:
2025-09-06 15:49:51 +02:00
parent cef77e86b7
commit 8c0d80d7fb
6 changed files with 71 additions and 37 deletions

View File

@@ -1,4 +1,5 @@
<script setup lang="ts">
import byteSize from 'byte-size';
import type { DirectoryEntry } from '~/shared/types';
const { entry } = defineProps<{ entry: DirectoryEntry }>();
@@ -28,12 +29,9 @@ const onDrop = onDirectoryEntryDrop(entry, true);
>({{ entry.name }})</span
></span
>
<NuxtTime
v-if="entry.createdAt != null"
:datetime="entry.createdAt * 1000"
class="text-muted-foreground w-full truncate text-sm"
relative
></NuxtTime>
<span class="text-muted-foreground w-full truncate text-sm">{{
byteSize(entry.size)
}}</span>
</div>
</button>
</template>

View File

@@ -7,6 +7,7 @@ import {
ContextMenuSeparator,
} from '@/components/ui/context-menu';
import type { DirectoryEntry } from '#shared/types';
import byteSize from 'byte-size';
const warrenStore = useWarrenStore();
const copyStore = useCopyStore();
@@ -111,12 +112,10 @@ function onClearCopy() {
class="flex w-full flex-col items-start justify-stretch gap-0 overflow-hidden text-left leading-6"
>
<span class="w-full truncate">{{ entry.name }}</span>
<NuxtTime
v-if="entry.createdAt != null"
:datetime="entry.createdAt * 1000"
<span
class="text-muted-foreground w-full truncate text-sm"
relative
></NuxtTime>
>{{ byteSize(entry.size) }}</span
>
</div>
</button>
</ContextMenuTrigger>

View File

@@ -9,6 +9,7 @@ export type DirectoryEntry = {
name: string;
fileType: FileType;
mimeType: string | null;
size: number;
/// Timestamp in seconds
createdAt: number | null;
isParent: boolean;