Skip to content

Self-hosted, Self-Improving, Federated Everything App — dev management, agent orchestration, persistent mind, digital twin, second brain, and creative pipeline from a single dashboard over Tailscale to port the user into the OS

reveal an editorial note in Review mode and scroll its card into view

[._.]/ Adam Eivyc33520824b0e
diff --git a/client/src/components/pipeline/manuscript/AnnotatedManuscriptSection.jsx b/client/src/components/pipeline/manuscript/AnnotatedManuscriptSection.jsx
index 3a4bf3a51a..4c8448fbf5 100644
--- a/client/src/components/pipeline/manuscript/AnnotatedManuscriptSection.jsx
+++ b/client/src/components/pipeline/manuscript/AnnotatedManuscriptSection.jsx
@@ -30,6 +30,14 @@ export default function AnnotatedManuscriptSection({
if (openComment) cardRef.current?.scrollIntoView?.({ behavior: 'smooth', block: 'center' });
}, [openComment?.id]); // eslint-disable-line react-hooks/exhaustive-deps
+ // Esc closes the open note — parity with the Live popover.
+ useEffect(() => {
+ if (!openComment) return undefined;
+ const onKey = (e) => { if (e.key === 'Escape') onCloseComment(); };
+ window.addEventListener('keydown', onKey);
+ return () => window.removeEventListener('keydown', onKey);
+ }, [openComment, onCloseComment]);
+
const editToggle = (
<button
type="button"
diff --git a/client/src/pages/PipelineManuscriptEditor.jsx b/client/src/pages/PipelineManuscriptEditor.jsx
index cb038b18ab..65f6a29db5 100644
--- a/client/src/pages/PipelineManuscriptEditor.jsx
+++ b/client/src/pages/PipelineManuscriptEditor.jsx
@@ -258,17 +258,18 @@ export default function PipelineManuscriptEditor() {
return result;
};
- // Reveal a comment in context: switch to its issue tab and open its card. An
- // issue-anchored note navigates to that issue (the section scrolls the card
- // into view on arrival); a story-level note with no issueNumber has no tab, so
- // it expands inline in the sidebar index instead.
+ // Reveal a comment in context: drop into Review mode (where the note expands
+ // as an in-context card) and open it, switching to its issue tab if needed.
+ // The section's card-scroll effect brings the card into view — on arrival for
+ // a cross-issue jump, or immediately when it's the active issue. A story-level
+ // note with no issueNumber has no tab, so it expands inline in the sidebar.
const revealComment = (comment) => {
setOpenCommentId(comment.id);
- if (comment.issueNumber == null) return; // unanchored — shown in the sidebar
+ setViewMode('review'); // surface the in-context review card…
+ setEditingIssueId(null); // …and make sure it's the card showing, not the editor
+ if (comment.issueNumber == null) return; // unanchored — expands in the sidebar
if (comment.issueNumber !== activeNumber) {
navigate(`/pipeline/series/${seriesId}/manuscript/${comment.issueNumber}`);
- } else {
- sectionRefs.current.get(comment.issueNumber)?.scrollIntoView?.({ behavior: 'smooth', block: 'start' });
}
if (comment.stageId && viewType && comment.stageId !== viewType) {
toast(`This note is on the ${STAGE_LABEL[comment.stageId] || comment.stageId} — switch formats to edit it in context`);
@@ -472,10 +473,13 @@ export default function PipelineManuscriptEditor() {
registerRef: registerSectionRef(section.number),
commentCardProps,
};
+ // Key on issueId so switching issues mounts a fresh section —
+ // the card-scroll-into-view effect then fires on arrival.
return viewMode === 'live' ? (
- <ManuscriptLiveSection {...common} />
+ <ManuscriptLiveSection key={section.issueId} {...common} />
) : (
<AnnotatedManuscriptSection
+ key={section.issueId}
{...common}
editing={editingIssueId === section.issueId}
onToggleEdit={() => setEditingIssueId((cur) => (cur === section.issueId ? null : section.issueId))}
diff --git a/client/src/pages/PipelineManuscriptEditor.test.jsx b/client/src/pages/PipelineManuscriptEditor.test.jsx
index 88d7f6ff4a..a4034a41dd 100644
--- a/client/src/pages/PipelineManuscriptEditor.test.jsx
+++ b/client/src/pages/PipelineManuscriptEditor.test.jsx
@@ -67,18 +67,21 @@ describe('PipelineManuscriptEditor', () => {
expect(screen.getByText(/1 open/)).toBeInTheDocument();
});
- it('reveals a comment in-context (Live mode) when its index row is clicked, and closes it', async () => {
+ it('revealing a comment from the sidebar switches to Review mode and opens it in-context, then closes', async () => {
renderEditor();
await screen.findByText('My Series');
- // Initially only the sidebar index row references the comment.
+ // Initially only the sidebar index row references the comment, and we're in
+ // Live mode (the section is an editable textarea).
expect(screen.getAllByText('The ending is abrupt')).toHaveLength(1);
+ expect(screen.getByDisplayValue('The hero walked in. She left.')).toBeInTheDocument();
revealFromIndex('The ending is abrupt');
- // Now an in-context note card also shows the problem text → two instances.
+ // Reveal drops into Review mode (read-only prose, no textarea) and opens the
+ // note in-context — the problem text now shows in both the index and card.
await waitFor(() => expect(screen.getAllByText('The ending is abrupt')).toHaveLength(2));
+ expect(screen.queryByDisplayValue('The hero walked in. She left.')).not.toBeInTheDocument();
- // Closing the in-context note leaves the sidebar index intact.
fireEvent.click(screen.getByLabelText('Close note'));
await waitFor(() => expect(screen.getAllByText('The ending is abrupt')).toHaveLength(1));
});
@@ -104,7 +107,7 @@ describe('PipelineManuscriptEditor', () => {
renderEditor();
await screen.findByText('My Series');
- revealFromIndex('The ending is abrupt');
+ revealFromIndex('The ending is abrupt'); // → Review mode + opens the card
fireEvent.click(await screen.findByText('Generate fix'));
expect(await screen.findByDisplayValue('She left, but paused.')).toBeInTheDocument();
@@ -112,7 +115,8 @@ describe('PipelineManuscriptEditor', () => {
fireEvent.click(screen.getByText('Accept'));
- expect(await screen.findByDisplayValue('The hero walked in. She left, but paused.')).toBeInTheDocument();
+ // Review mode is read-only prose (no textarea) — the accepted text shows there.
+ expect(await screen.findByText('The hero walked in. She left, but paused.')).toBeInTheDocument();
await waitFor(() => expect(screen.getByText(/0 open/)).toBeInTheDocument());
expect(api.acceptPipelineManuscriptFix).toHaveBeenCalledWith('ser-1', 'mrc-1', {
edits: [{ issueNumber: 1, issueId: 'iss-1', stageId: 'prose', find: 'She left.', replace: 'She left, but paused.', fuzzy: undefined }],