()
| 16 | const PreviewNodeId = "preview-aifilediff-node"; |
| 17 | |
| 18 | export function AiFileDiffPreview() { |
| 19 | const env = useWaveEnv(); |
| 20 | const [blockId, setBlockId] = React.useState<string>(null); |
| 21 | |
| 22 | useRpcOverride("WaveAIGetToolDiffCommand", async (_client, data) => { |
| 23 | if (data.chatid !== DefaultAiFileDiffChatId || data.toolcallid !== DefaultAiFileDiffToolCallId) { |
| 24 | return null; |
| 25 | } |
| 26 | return makeMockAiFileDiffResponse(); |
| 27 | }); |
| 28 | |
| 29 | React.useEffect(() => { |
| 30 | env.createBlock( |
| 31 | { |
| 32 | meta: { |
| 33 | view: "aifilediff", |
| 34 | file: DefaultAiFileDiffFileName, |
| 35 | "aifilediff:chatid": DefaultAiFileDiffChatId, |
| 36 | "aifilediff:toolcallid": DefaultAiFileDiffToolCallId, |
| 37 | }, |
| 38 | }, |
| 39 | false, |
| 40 | false |
| 41 | ).then((id) => setBlockId(id)); |
| 42 | }, []); |
| 43 | |
| 44 | const nodeModel = React.useMemo( |
| 45 | () => (blockId != null ? makeMockNodeModel({ nodeId: PreviewNodeId, blockId }) : null), |
| 46 | [blockId] |
| 47 | ); |
| 48 | |
| 49 | if (blockId == null || nodeModel == null) { |
| 50 | return null; |
| 51 | } |
| 52 | |
| 53 | return ( |
| 54 | <div className="flex w-full max-w-[1120px] flex-col gap-2 px-6 py-6"> |
| 55 | <div className="text-xs text-muted font-mono">full aifilediff block (mock WOS + mock WaveAI diff RPC)</div> |
| 56 | <div className="rounded-md border border-border bg-panel p-4"> |
| 57 | <div className="h-[720px]"> |
| 58 | <Block preview={false} nodeModel={nodeModel} /> |
| 59 | </div> |
| 60 | </div> |
| 61 | </div> |
| 62 | ); |
| 63 | } |
nothing calls this directly
no test coverage detected