mirror of
https://github.com/backnotprop/plannotator.git
synced 2026-09-14 14:17:26 +08:00
e3de938914
Combine the PR Summary/Comments/Checks tabs into one PR Overview panel, then make the description and comments annotatable and render their media. - PR Overview panel (one sidebar entry) + comment UI (avatars, filters, hide bots, live context, responsive stacking). - Annotate the PR description (select → comment) and PR comments (Annotate button), with Ask AI; notes show in the Annotations sidebar and ship to the agent. - Split/Unified diff toggle relocated into the dock tab strip. - Render images + video in descriptions and comments (raw HTML + markdown), capped to the card so nothing bleeds. - Review-flow fixes: copy-all feedback, prose-only feedback preamble, no image control on prose notes, GitHub review-body seeding; stronger review trailer. - Add Claude Sonnet 5 as the default Ask AI model. No server, endpoint, or Pi-runtime changes.
55 lines
1.8 KiB
TypeScript
55 lines
1.8 KiB
TypeScript
import React, { useMemo } from 'react';
|
|
import { parseMarkdownToBlocks, groupBlocks, computeListIndices } from '../utils/parser';
|
|
import { BlockRenderer } from './BlockRenderer';
|
|
|
|
/**
|
|
* Full markdown renderer for surfaces outside the plan editor (e.g. the PR
|
|
* description). Reuses the shared {@link BlockRenderer} — so tables, HTML,
|
|
* callouts, code, and `data-block-id` all come along — without dragging in the
|
|
* plan Viewer's diagram/toolbar/lightbox machinery.
|
|
*
|
|
* Sizing/spacing is inherited from the wrapper: pass `className="md-compact"`
|
|
* (or any scope) to override the renderer's plan-sized defaults via CSS.
|
|
*/
|
|
export interface RenderedMarkdownProps {
|
|
markdown: string;
|
|
className?: string;
|
|
onImageClick?: (src: string, alt: string) => void;
|
|
onOpenLinkedDoc?: (path: string) => void;
|
|
onOpenCodeFile?: (path: string) => void;
|
|
githubRepo?: string;
|
|
}
|
|
|
|
export const RenderedMarkdown: React.FC<RenderedMarkdownProps> = ({
|
|
markdown,
|
|
className,
|
|
onImageClick,
|
|
onOpenLinkedDoc,
|
|
onOpenCodeFile,
|
|
githubRepo,
|
|
}) => {
|
|
const groups = useMemo(() => groupBlocks(parseMarkdownToBlocks(markdown)), [markdown]);
|
|
const cb = { onImageClick, onOpenLinkedDoc, onOpenCodeFile, githubRepo };
|
|
|
|
return (
|
|
<div className={className}>
|
|
{groups.map((group) =>
|
|
group.type === 'list-group' ? (
|
|
(() => {
|
|
const indices = computeListIndices(group.blocks);
|
|
return (
|
|
<div key={group.key}>
|
|
{group.blocks.map((block, i) => (
|
|
<BlockRenderer key={block.id} block={block} orderedIndex={indices[i]} {...cb} />
|
|
))}
|
|
</div>
|
|
);
|
|
})()
|
|
) : (
|
|
<BlockRenderer key={group.block.id} block={group.block} {...cb} />
|
|
),
|
|
)}
|
|
</div>
|
|
);
|
|
};
|