@@ -132,7 +132,6 @@ import {
132132
133133import { AppText as Text } from "../../components/ui/AppText" ;
134134import { VideoPreviewModal , type VideoPreviewSource } from "../../components/VideoPreviewModal" ;
135- import { VideoAttachmentTile } from "../../components/VideoAttachmentTile" ;
136135import { MediaVideoPlayer } from "../../components/MediaVideoPlayer" ;
137136import { resolveMarkdownMediaPreview } from "../../lib/markdownMedia" ;
138137import {
@@ -520,7 +519,6 @@ function MessageAttachmentFile(props: {
520519 readonly environmentId : EnvironmentId ;
521520 readonly attachment : ChatFileAttachment ;
522521 readonly onPressPreview : ( source : FilePreviewSource ) => void ;
523- readonly onPressVideo : ( attachment : ChatFileAttachment , sourceIdentifier : string ) => void ;
524522} ) {
525523 const sourceIdentifier = useId ( ) ;
526524 const navigation = useNavigation ( ) ;
@@ -537,17 +535,6 @@ function MessageAttachmentFile(props: {
537535 ? "PDF"
538536 : ( attachment . name . match ( / \. ( [ a - z 0 - 9 ] { 1 , 8 } ) $ / i) ?. [ 1 ] ?. toUpperCase ( ) ?? "File" ) ;
539537 const sizeLabel = formatAttachmentSize ( attachment . sizeBytes ) ;
540- const thumbnailUrl = useAssetUrl (
541- props . environmentId ,
542- videoType === null
543- ? null
544- : {
545- _tag : "attachment" ,
546- attachmentId : attachment . id ,
547- fileName : attachment . name ,
548- mimeType : videoType ,
549- } ,
550- ) ;
551538 const httpBaseUrl = Option . isSome ( preparedConnection )
552539 ? preparedConnection . value . httpBaseUrl
553540 : null ;
@@ -641,9 +628,8 @@ function MessageAttachmentFile(props: {
641628 < PresentationSource identifier = { sourceIdentifier } >
642629 < ThreadInlineFilePreview
643630 key = { attachment . id }
644- kind = { inlineKind }
645631 source = { {
646- kind : inlineKind === "pdf" ? "pdf" : "document" ,
632+ kind : "document" ,
647633 name : attachment . name ,
648634 mimeType : attachment . mimeType ,
649635 environmentId : props . environmentId ,
@@ -652,6 +638,7 @@ function MessageAttachmentFile(props: {
652638 attachmentId : attachment . id ,
653639 fileName : attachment . name ,
654640 mimeType : attachment . mimeType ,
641+ disposition : "inline" ,
655642 } ,
656643 } }
657644 sizeBytes = { attachment . sizeBytes }
@@ -663,21 +650,12 @@ function MessageAttachmentFile(props: {
663650 }
664651
665652 if ( videoType !== null ) {
666- const sourceIdentifier = `attachment:${ props . environmentId } :${ attachment . id } ` ;
667653 return (
668- < VideoAttachmentTile
669- name = { attachment . name }
670- sourceIdentifier = { sourceIdentifier }
671- thumbnailSource = { thumbnailUrl }
672- actionsSource = {
673- attachmentVideoPreviewSource ( props . environmentId , attachment , sourceIdentifier )
674- . actionsSource
675- }
676- disabled = { opening || httpBaseUrl === null }
677- onPress = { ( sourceIdentifier ) => props . onPressVideo ( attachment , sourceIdentifier ) }
678- className = "my-1 rounded-2xl"
679- style = { { width : 224 , maxWidth : "100%" , aspectRatio : 16 / 9 } }
680- />
654+ < View className = "my-1" style = { { width : 224 , maxWidth : "100%" } } >
655+ < ThreadMarkdownVideo
656+ source = { attachmentVideoPreviewSource ( props . environmentId , attachment , sourceIdentifier ) }
657+ />
658+ </ View >
681659 ) ;
682660 }
683661
@@ -1019,7 +997,6 @@ function renderFeedEntry(
1019997 readonly onToggleWorkRow : ( rowId : string , anchorKey ?: string , groupId ?: string ) => void ;
1020998 readonly onToggleTurnFold : ( runId : RunId ) => void ;
1021999 readonly onPressPreview : ( source : FilePreviewSource ) => void ;
1022- readonly onPressVideo : ( attachment : ChatFileAttachment , sourceIdentifier : string ) => void ;
10231000 readonly markdownLinkHandlers : MarkdownLinkHandlers ;
10241001 readonly renderMarkdownImage : MarkdownImageRenderer ;
10251002 readonly renderViewedImage : MarkdownImageRenderer ;
@@ -1298,7 +1275,6 @@ function renderFeedEntry(
12981275 environmentId = { props . environmentId }
12991276 attachment = { attachment }
13001277 onPressPreview = { props . onPressPreview }
1301- onPressVideo = { props . onPressVideo }
13021278 />
13031279 ) : (
13041280 < MessageAttachmentUnknown key = { attachment . id } name = { attachment . name } />
@@ -1438,7 +1414,6 @@ function renderFeedEntry(
14381414 environmentId = { props . environmentId }
14391415 attachment = { attachment }
14401416 onPressPreview = { props . onPressPreview }
1441- onPressVideo = { props . onPressVideo }
14421417 />
14431418 ) : (
14441419 < MessageAttachmentUnknown key = { attachment . id } name = { attachment . name } />
@@ -1836,17 +1811,6 @@ export const ThreadFeed = memo(function ThreadFeed(props: ThreadFeedProps) {
18361811 void Haptics . selectionAsync ( ) ;
18371812 if ( media . kind === "video" ) {
18381813 setExpandedVideo ( ( current ) => current ?? media . source ) ;
1839- } else if (
1840- ( media . kind === "audio" || media . kind === "table" ) &&
1841- "resource" in media . source &&
1842- "path" in media . source . resource &&
1843- typeof media . source . resource . path === "string"
1844- ) {
1845- navigation . navigate ( "ThreadFile" , {
1846- environmentId : String ( props . environmentId ) ,
1847- threadId : String ( props . threadId ) ,
1848- path : fileRoutePathSegments ( media . source . resource . path ) ,
1849- } ) ;
18501814 } else {
18511815 setExpandedFile ( ( current ) => current ?? media . source ) ;
18521816 }
@@ -1936,16 +1900,31 @@ export const ThreadFeed = memo(function ThreadFeed(props: ThreadFeedProps) {
19361900 />
19371901 ) ;
19381902 }
1939- if ( media && ( media . kind === "audio" || media . kind === "pdf" || media . kind === "table" ) ) {
1903+ if ( media ? .kind === "audio" ) {
19401904 return (
19411905 < ThreadInlineFilePreview
19421906 key = { image . href }
1943- kind = { media . kind }
19441907 source = { media . source }
19451908 onOpen = { ( ) => onMarkdownLinkPress ( image . href , true ) }
19461909 />
19471910 ) ;
19481911 }
1912+ if ( media && ( media . kind === "pdf" || media . kind === "document" ) ) {
1913+ return (
1914+ < Text
1915+ accessibilityRole = "link"
1916+ accessibilityLabel = { `Open ${ media . source . name ?? "file" } ` }
1917+ onPress = { ( ) => onMarkdownLinkPress ( image . href , true ) }
1918+ style = { {
1919+ color : markdownStyles . assistant . nativeTextStyle . linkColor ,
1920+ fontSize : markdownStyles . assistant . nativeTextStyle . fontSize ,
1921+ lineHeight : markdownStyles . assistant . nativeTextStyle . lineHeight ,
1922+ } }
1923+ >
1924+ { image . alt || media . source . name || "Open file" }
1925+ </ Text >
1926+ ) ;
1927+ }
19491928 const imageSource = classifyMarkdownImageSource ( image . href , props . workspaceRoot ?? null ) ;
19501929 if ( imageSource . _tag === "Direct" ) {
19511930 return (
@@ -2342,12 +2321,6 @@ export const ThreadFeed = memo(function ThreadFeed(props: ThreadFeedProps) {
23422321 const onPressPreview = ( source : FilePreviewSource ) => {
23432322 setExpandedFile ( ( current ) => current ?? source ) ;
23442323 } ;
2345- const onPressVideo = ( attachment : ChatFileAttachment , sourceIdentifier : string ) => {
2346- setExpandedVideo (
2347- ( current ) =>
2348- current ?? attachmentVideoPreviewSource ( props . environmentId , attachment , sourceIdentifier ) ,
2349- ) ;
2350- } ;
23512324
23522325 // Without this, every row above the viewport is assumed to be
23532326 // estimatedItemSize tall, and scrolling up through unmeasured content
@@ -2426,7 +2399,6 @@ export const ThreadFeed = memo(function ThreadFeed(props: ThreadFeedProps) {
24262399 onToggleWorkRow,
24272400 onToggleTurnFold,
24282401 onPressPreview,
2429- onPressVideo,
24302402 markdownLinkHandlers,
24312403 renderMarkdownImage,
24322404 renderViewedImage,
0 commit comments