feat(asset): replace mediaType/mimeType logic with proxyType

This commit is contained in:
yiling
2026-07-20 10:22:36 +08:00
parent c45a1d9ee9
commit f158d04686
40 changed files with 219 additions and 119 deletions
@@ -1,10 +1,11 @@
import type { PaneKind } from './types'
/** Classify an asset's media type into a compare pane kind. */
export function kindOf(mediaType: string | null | undefined): PaneKind {
if (!mediaType) return 'unsupported'
if (mediaType.startsWith('image/')) return 'image'
if (mediaType.startsWith('video/')) return 'video'
export function kindOf(item: { proxyType?: string | null } | string | null | undefined): PaneKind {
if (!item) return 'unsupported'
const proxyType = typeof item === 'object' ? item.proxyType : item
if (proxyType === 'image') return 'image'
if (proxyType === 'video') return 'video'
return 'unsupported'
}