- Add reusable file path linkification utilities and FileBrowser context wiring across dashboard modals and log surfaces - Linkify task detail, review, workflow, chat, activity, agent, dev server, and settings sync outputs so workspace paths open in the file browser - Preserve inline code styling when wrapping detected paths and extend FileBrowserModal handling for linked navigation - Cover the new linking behavior with dashboard tests and add a changeset plus AGENTS guidance for the reusable pattern Fusion-Task-Id: FN-4227
27 lines
698 B
TypeScript
27 lines
698 B
TypeScript
import { createContext, useContext } from "react";
|
|
import type { ReactNode } from "react";
|
|
|
|
export interface FileBrowserContextValue {
|
|
openFile: (path: string, options?: { workspace?: string; line?: number; col?: number }) => void;
|
|
}
|
|
|
|
const FileBrowserContext = createContext<FileBrowserContextValue | null>(null);
|
|
|
|
export function FileBrowserProvider({
|
|
openFile,
|
|
children,
|
|
}: {
|
|
openFile: FileBrowserContextValue["openFile"];
|
|
children: ReactNode;
|
|
}) {
|
|
return (
|
|
<FileBrowserContext.Provider value={{ openFile }}>
|
|
{children}
|
|
</FileBrowserContext.Provider>
|
|
);
|
|
}
|
|
|
|
export function useFileBrowser(): FileBrowserContextValue | null {
|
|
return useContext(FileBrowserContext);
|
|
}
|