Files
t3code/apps/web/src/components/files/FileMarkdownPreview.tsx
T
12069eefd7 feat(web): find messages and plans in the current thread (#10439)
Co-authored-by: Yash Singh <[email protected]>
Co-authored-by: Julius Marminge <[email protected]>
Co-authored-by: Claude Opus 5.5 (1M context) <[email protected]>
2026-10-08 08:24:50 -05:00

35 lines
1010 B
TypeScript

import type { ScopedThreadRef } from "@t3tools/contracts";
import ChatMarkdown from "~/components/ChatMarkdown";
import { resolvePathLinkTarget } from "@t3tools/shared/fileLinks";
export function FileMarkdownPreview(props: {
readonly cwd: string;
readonly relativePath: string;
readonly text: string;
readonly threadRef: ScopedThreadRef;
readonly onTaskListChange?:
| ((input: { readonly markerOffset: number; readonly checked: boolean }) => void)
| undefined;
}) {
const lastSeparator = Math.max(
props.relativePath.lastIndexOf("/"),
props.relativePath.lastIndexOf("\\"),
);
const imageBaseDir =
lastSeparator >= 0
? resolvePathLinkTarget(props.relativePath.slice(0, lastSeparator), props.cwd)
: props.cwd;
return (
<ChatMarkdown
text={props.text}
cwd={props.cwd}
imageBaseDir={imageBaseDir}
threadRef={props.threadRef}
className="mx-auto max-w-4xl px-6 py-5"
onTaskListChange={props.onTaskListChange}
/>
);
}