refactor(webui): unify code and diff highlighting (#6412)
* refactor(webui): unify code and diff highlighting Replace Prism with shared Highlights tokens and Pierre read-only diffs, retaining rare grammars through lazy Shiki and preserving source, copy, preview and diff controls. Restore single-session Composer ownership inside the conversation column while retaining the shared multi-pane footer. Keep the measured large-diff scroll regression explicit during review. * fix(webui): contain highlighting errors and retain diff selections Refs NAN-343 * test(webui): align pane fixtures after main rebase * chore(webui): update highlighting dependencies Keep grammar fallback coverage on a language that still requires Shiki, and align reading-size assertions with main.
This commit is contained in:
1 parent
f5c359476b
commit
3a37269f3f
44 files changed
+2261
-1072
No files matched your search
@@ -46,6 +46,9 @@ const noop = () => {};
|
||||
function ThemeChatFixture({ theme, toggle }: { theme: "light" | "dark"; toggle: () => void }) {
|
||||
const [activeKey, setActiveKey] = useState(sessions[0].key);
|
||||
const composer = <ThreadComposer onSend={noop} />;
|
||||
const header = <ThreadHeader title="Theme chat" hideTitle theme={theme} onToggleTheme={toggle} onToggleSidebar={noop} />;
|
||||
const panes = [{ key: "theme", title: "Theme chat" }];
|
||||
if (new URLSearchParams(location.search).has("split")) panes.push({ key: "theme-secondary", title: "Secondary chat" });
|
||||
return <main data-theme-surface className="flex bg-background" style={{ height: "100vh" }}>
|
||||
<aside className="hidden w-64 shrink-0 sm:block">
|
||||
<Sidebar sessions={sessions} activeKey={activeKey} onSelect={setActiveKey} loading={false} newChatActive={false}
|
||||
@@ -55,14 +58,16 @@ function ThemeChatFixture({ theme, toggle }: { theme: "light" | "dark"; toggle:
|
||||
onOpenChannels={noop} onOpenSearch={noop} onToggleArchived={noop} />
|
||||
</aside>
|
||||
<div className="min-w-0 flex-1">
|
||||
<PaneWorkbench panes={[{ key: "theme", title: "Theme chat" }]} activePaneKey="theme" layout="columns"
|
||||
<PaneWorkbench panes={panes} activePaneKey="theme" layout="columns"
|
||||
showLayoutControl={false} onActivatePane={noop} onAddPane={noop} onLayoutChange={noop} onPaneOrderChange={noop}
|
||||
renderPane={(_pane, context) => <div className="relative flex min-h-0 flex-1 flex-col">
|
||||
<ThreadHeader title="Theme chat" hideTitle theme={theme} onToggleTheme={toggle} onToggleSidebar={noop} />
|
||||
{context.active && (context.headerPortalTarget
|
||||
? createPortal(header, context.headerPortalTarget)
|
||||
: context.headerPortalTarget === undefined ? header : null)}
|
||||
<ThreadViewport messages={messages} isStreaming={false} conversationKey={activeKey}
|
||||
navigationFrame={context.navigationFrame} composer={null} />
|
||||
navigationFrame={context.navigationFrame} composer={context.composerPortalTarget === undefined ? composer : null} />
|
||||
<ThreadHistoryStatus loading={false} error={null} exhausted onRetry={noop} />
|
||||
{context.composerPortalTarget && createPortal(<div data-active-composer>{composer}</div>, context.composerPortalTarget)}
|
||||
{context.active && context.composerPortalTarget && createPortal(<div data-active-composer>{composer}</div>, context.composerPortalTarget)}
|
||||
</div>} />
|
||||
</div>
|
||||
</main>;
|
||||
|
||||
Reference in new issue
Block a user