Line data Source code
1 : <script setup lang="ts">
2 : import { computed } from 'vue'
3 :
4 : import {
5 : getMediaType,
6 : mediaTypes
7 : } from '@/renderer/extensions/linearMode/mediaTypes'
8 : import type { AugmentedResultItem } from '@/utils/resultItem'
9 : import { resultItemUrl } from '@/utils/resultItemUrl'
10 : import { cn } from '@comfyorg/tailwind-utils'
11 :
12 : import VideoPlayOverlay from '@comfyorg/design-system/media/VideoPlayOverlay'
13 :
14 : const { output } = defineProps<{
15 : output: AugmentedResultItem
16 : }>()
17 :
18 2412 : const src = computed(() => resultItemUrl(output))
19 217 : </script>
20 : <template>
21 : <img
22 217 : v-if="getMediaType(output) === 'images'"
23 : data-testid="linear-image-output"
24 : class="block size-10 rounded-sm bg-secondary object-cover"
25 : loading="lazy"
26 : width="40"
27 : height="40"
28 : :src
29 : />
30 : <template v-else-if="getMediaType(output) === 'video'">
31 : <video
32 : data-testid="linear-video-output"
33 : class="pointer-events-none block size-10 rounded-sm bg-secondary object-cover"
34 : preload="metadata"
35 : width="40"
36 : height="40"
37 : :src
38 : />
39 : <VideoPlayOverlay size="sm" />
40 : </template>
41 : <i
42 : v-else
43 : :class="cn(mediaTypes[getMediaType(output)]?.iconClass, 'block size-10')"
44 : />
45 : </template>
|