Files
fusion/packages/dashboard/app/context/FileBrowserContext.tsx
Fusion bbd92a1ae1 feat(FN-4227): add clickable file path links across dashboard
- 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
2026-05-12 21:55:43 -07:00

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);
}