diff --git a/ui/src/components/SampleImageCard.tsx b/ui/src/components/SampleImageCard.tsx index 0973e382e..6ed9d06af 100644 --- a/ui/src/components/SampleImageCard.tsx +++ b/ui/src/components/SampleImageCard.tsx @@ -1,5 +1,12 @@ import React, { useRef, useEffect, useState, ReactNode } from 'react'; -import { isVideo, isAudio } from '@/utils/basic'; +import { getFilename, isVideo, isAudio } from '@/utils/basic'; + +function sampleLabel(filename: string) { + const match = filename.match(/^.+__(\d+)_(\d+)\.[^.]+$/); + if (!match) return filename; + + return `Step ${Number(match[1]).toLocaleString()} · Sample ${Number(match[2])}`; +} interface SampleImageCardProps { imageUrl: string; @@ -36,6 +43,8 @@ const SampleImageCard: React.FC = ({ const isItAudio = isAudio(imageUrl); const isItVideo = isVideo(imageUrl); const isImageType = !isItAudio && !isItVideo; + const filename = getFilename(imageUrl); + const label = sampleLabel(filename); // Observe both enter and exit useEffect(() => { @@ -119,6 +128,13 @@ const SampleImageCard: React.FC = ({ (e.target as HTMLImageElement).style.display = 'none'; }} /> + ) : isItVideo ? (