import type { StudioFileAttachment, StudioRun, StudioSession, StudioTask, StudioWork, StudioWorkResult } from '../protocol/studio-agent-types'
import { translateResultKind, translateRunStatus, translateWorkStatus, translateWorkType } from '../labels'
import { formatStudioTime, studioStatusBadge, truncateStudioText } from '../theme'
import { useI18n } from '../../i18n'
interface StudioWorkListItem {
work: StudioWork
latestTask: StudioTask | null
result: StudioWorkResult | null
}
interface StudioAssetsPanelProps {
session: StudioSession | null
works: StudioWorkListItem[]
selectedWorkId: string | null
work: StudioWork | null
result: StudioWorkResult | null
latestRun: StudioRun | null
onSelectWork: (workId: string) => void
}
export function StudioAssetsPanel({
session,
works,
selectedWorkId,
work,
result,
latestRun,
onSelectWork,
}: StudioAssetsPanelProps) {
const { t } = useI18n()
const previewAttachment = result?.attachments?.find(isPreviewAttachment) ?? result?.attachments?.[0] ?? null
return (
)
}
function PreviewSurface({
attachment,
result,
}: {
attachment: StudioFileAttachment | null | undefined
result: StudioWorkResult | null
}) {
const { t } = useI18n()
if (attachment?.mimeType?.startsWith('video/') || isVideoPath(attachment?.path)) {
return
}
if (attachment?.mimeType?.startsWith('image/') || isImagePath(attachment?.path)) {
return
}
if (result?.kind === 'failure-report') {
return (