The best way to control Claude Code, Codex and more from any computer or phone
Mirrored from https://github.com/Camo67/t3code.git
Synced Nov 21, 04:45 UTC
| 1 | import type { EnvironmentId } from "@t3tools/contracts"; |
| 2 | import { createContext, useContext } from "react"; |
| 3 | |
| 4 | import { cn } from "~/lib/utils"; |
| 5 | |
| 6 | import { PullRequestMarkdown } from "../PullRequestMarkdown"; |
| 7 | |
| 8 | export const GuideProseContext = createContext<{ |
| 9 | readonly environmentId: EnvironmentId; |
| 10 | readonly cwd: string; |
| 11 | } | null>(null); |
| 12 | |
| 13 | export function GuideProse({ |
| 14 | text, |
| 15 | plain = false, |
| 16 | className, |
| 17 | }: { |
| 18 | text: string; |
| 19 | plain?: boolean; |
| 20 | className?: string; |
| 21 | }) { |
| 22 | const context = useContext(GuideProseContext); |
| 23 | if (plain || context === null) return text; |
| 24 | return ( |
| 25 | <PullRequestMarkdown |
| 26 | text={text} |
| 27 | cwd={context.cwd} |
| 28 | environmentId={context.environmentId} |
| 29 | lineBreaks={false} |
| 30 | className={cn("space-y-0 [&_.chat-markdown]:text-inherit", className)} |
| 31 | /> |
| 32 | ); |
| 33 | } |