Files
archived-orca/mobile/src/session/native-chat/mobile-native-chat-open-file-context.ts
Brennan Benson 15caa932bc fix(mobile): make file links in phone plan approvals actionable (#38510)
* fix(mobile): make file links in phone plan approvals actionable

The phone chat view now provides its file opener through one per-chat
context. Chat markdown renders through a shared adapter that reads it,
and tool, diff and attachment targets read it directly, replacing the
onOpenFile props threaded by hand through rows and cards. The plan
approval card was the surface that never got it.

Tracked in STA-13722.

* fix(mobile): open attached files while editing a queued message

Composer attachment chips read the chat's file opener from the per-chat
context instead of the structured composer config, which the queued
message editor built without it.

* test(mobile): provide the chat file opener to the attachment preview test
2026-11-05 10:26:43 -08:00

12 lines
523 B
TypeScript

import { createContext, useContext } from 'react'
type OpenFile = (pathText: string) => void
/** The chat's one file opener, provided by its view; undefined where the chat cannot open files. */
export const MobileNativeChatOpenFileContext = createContext<OpenFile | undefined>(undefined)
/** Every chat surface that opens a file reads the opener here, so no card or row needs it passed down. */
export function useMobileNativeChatOpenFile(): OpenFile | undefined {
return useContext(MobileNativeChatOpenFileContext)
}