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 <noreply@anthropic.com>
This commit is contained in:
Jin Yi
2025-10-20 18:52:56 +09:00
parent 3776c3265c
commit 207fcc3ced
4 changed files with 27 additions and 6 deletions

View File

@@ -54,7 +54,7 @@ const {
}>()
const topStyle = computed(() => {
const baseClasses = 'relative p-0'
const baseClasses = 'relative p-0 overflow-hidden'
const ratioClasses = {
square: 'aspect-square',

View File

@@ -62,13 +62,17 @@
</template>
<!-- Duration/Format chips (bottom-left) - show on hover even when playing -->
<template v-if="showDurationChips" #bottom-left>
<template v-if="showDurationChips || showFileFormatChip" #bottom-left>
<div
class="flex flex-wrap items-center gap-1"
@mouseenter="handleOverlayMouseEnter"
@mouseleave="handleOverlayMouseLeave"
>
<SquareChip variant="light" :label="formattedDuration" />
<SquareChip
v-if="formattedDuration"
variant="light"
:label="formattedDuration"
/>
<SquareChip v-if="fileFormat" variant="light" :label="fileFormat" />
</div>
</template>
@@ -291,6 +295,14 @@ const showDurationChips = computed(
(!isVideoPlaying.value || isCardOrOverlayHovered.value)
)
const showFileFormatChip = computed(
() =>
!loading &&
!!asset &&
!!fileFormat.value &&
(!isVideoPlaying.value || isCardOrOverlayHovered.value)
)
const showOutputCount = computed(
() => false // Remove output count for simplified version
)

View File

@@ -7,7 +7,7 @@
{{ fileName }}
</h3>
<div class="flex items-center text-xs text-zinc-400">
<span>{{ asset.dimensions?.width }}x{{ asset.dimensions?.height }}</span>
<span>{{ formatSize(asset.size) }}</span>
</div>
</div>
</template>
@@ -15,7 +15,7 @@
<script setup lang="ts">
import { computed } from 'vue'
import { getFilenameDetails } from '@/utils/formatUtil'
import { formatSize, getFilenameDetails } from '@/utils/formatUtil'
import type { AssetContext, AssetMeta } from '../schemas/mediaAssetSchema'

View File

@@ -5,6 +5,7 @@ import { assetService } from '@/platform/assets/services/assetService'
import type { HistoryTaskItem } from '@/schemas/apiSchema'
import { api } from '@/scripts/api'
import { TaskItemImpl } from '@/stores/queueStore'
import { truncateFilename } from '@/utils/formatUtil'
import { mapTaskOutputToAssetItem } from './assetMappers'
@@ -31,7 +32,15 @@ export function useAssetsApi() {
// For input directory, just return assets without history
if (directory === 'input') {
const assets = await assetService.getAssetsByTag(directory)
return assets
// Process assets to truncate long filenames for display
return assets.map((asset) => ({
...asset,
name: truncateFilename(asset.name, 20),
user_metadata: {
...asset.user_metadata,
originalFilename: asset.name.length > 20 ? asset.name : undefined
}
}))
}
// For output directory, fetch history data and convert to AssetItem format