Skip to content

Commit 919a7c4

Browse files
viva-jinyiclaude
andcommitted
feat: Improve media asset display with file format tags and filename truncation
- Add file format tags (PNG, JPG, etc.) for input directory assets - Truncate long filenames in input assets with originalFilename preservation - Show file format chip independently from duration chip - Fix conditional display logic for chips in MediaAssetCard - Apply consistent filename truncation (20 chars) across cloud assets 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <[email protected]>
1 parent e5f8aac commit 919a7c4

File tree

4 files changed

+27
-6
lines changed

4 files changed

+27
-6
lines changed

src/components/card/CardTop.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ const {
5454
}>()
5555
5656
const topStyle = computed(() => {
57-
const baseClasses = 'relative p-0'
57+
const baseClasses = 'relative p-0 overflow-hidden'
5858
5959
const ratioClasses = {
6060
square: 'aspect-square',

src/platform/assets/components/MediaAssetCard.vue

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,13 +62,17 @@
6262
</template>
6363

6464
<!-- Duration/Format chips (bottom-left) - show on hover even when playing -->
65-
<template v-if="showDurationChips" #bottom-left>
65+
<template v-if="showDurationChips || showFileFormatChip" #bottom-left>
6666
<div
6767
class="flex flex-wrap items-center gap-1"
6868
@mouseenter="handleOverlayMouseEnter"
6969
@mouseleave="handleOverlayMouseLeave"
7070
>
71-
<SquareChip variant="light" :label="formattedDuration" />
71+
<SquareChip
72+
v-if="formattedDuration"
73+
variant="light"
74+
:label="formattedDuration"
75+
/>
7276
<SquareChip v-if="fileFormat" variant="light" :label="fileFormat" />
7377
</div>
7478
</template>
@@ -291,6 +295,14 @@ const showDurationChips = computed(
291295
(!isVideoPlaying.value || isCardOrOverlayHovered.value)
292296
)
293297
298+
const showFileFormatChip = computed(
299+
() =>
300+
!loading &&
301+
!!asset &&
302+
!!fileFormat.value &&
303+
(!isVideoPlaying.value || isCardOrOverlayHovered.value)
304+
)
305+
294306
const showOutputCount = computed(
295307
() => false // Remove output count for simplified version
296308
)

src/platform/assets/components/MediaVideoBottom.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,15 @@
77
{{ fileName }}
88
</h3>
99
<div class="flex items-center text-xs text-zinc-400">
10-
<span>{{ asset.dimensions?.width }}x{{ asset.dimensions?.height }}</span>
10+
<span>{{ formatSize(asset.size) }}</span>
1111
</div>
1212
</div>
1313
</template>
1414

1515
<script setup lang="ts">
1616
import { computed } from 'vue'
1717
18-
import { getFilenameDetails } from '@/utils/formatUtil'
18+
import { formatSize, getFilenameDetails } from '@/utils/formatUtil'
1919
2020
import type { AssetContext, AssetMeta } from '../schemas/mediaAssetSchema'
2121

src/platform/assets/composables/useMediaAssets/useAssetsApi.ts

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import { assetService } from '@/platform/assets/services/assetService'
55
import type { HistoryTaskItem } from '@/schemas/apiSchema'
66
import { api } from '@/scripts/api'
77
import { TaskItemImpl } from '@/stores/queueStore'
8+
import { truncateFilename } from '@/utils/formatUtil'
89

910
import { mapTaskOutputToAssetItem } from './assetMappers'
1011

@@ -31,7 +32,15 @@ export function useAssetsApi() {
3132
// For input directory, just return assets without history
3233
if (directory === 'input') {
3334
const assets = await assetService.getAssetsByTag(directory)
34-
return assets
35+
// Process assets to truncate long filenames for display
36+
return assets.map((asset) => ({
37+
...asset,
38+
name: truncateFilename(asset.name, 20),
39+
user_metadata: {
40+
...asset.user_metadata,
41+
originalFilename: asset.name.length > 20 ? asset.name : undefined
42+
}
43+
}))
3544
}
3645

3746
// For output directory, fetch history data and convert to AssetItem format

0 commit comments

Comments
 (0)