|
160 | 160 | let commitDiffSha = $state<string | null>(null); |
161 | 161 |
|
162 | 162 | // Note modal (opened by clicking a note in the timeline) |
163 | | - let openNote = $state<{ title: string; content: string } | null>(null); |
| 163 | + let openNote = $state<{ title: string; content: string; sessionId?: string } | null>(null); |
164 | 164 |
|
165 | 165 | // Image viewer modal (opened by clicking an image in the timeline) |
166 | 166 | let viewImageId = $state<string | null>(null); |
|
351 | 351 | // Timeline item interactions |
352 | 352 | // ========================================================================= |
353 | 353 |
|
| 354 | + /** Look up note info from timeline data by session ID (for cross-modal navigation). */ |
| 355 | + function findNoteForSession( |
| 356 | + sessionId: string |
| 357 | + ): { id: string; title: string; content: string } | null { |
| 358 | + const note = timeline?.notes.find((n) => n.sessionId === sessionId && n.content?.trim()); |
| 359 | + if (!note) return null; |
| 360 | + return { id: note.id, title: note.title, content: note.content }; |
| 361 | + } |
| 362 | +
|
354 | 363 | function handleCommitClick(sha: string) { |
355 | 364 | commitDiffSha = sha; |
356 | 365 | } |
357 | 366 |
|
358 | | - function handleNoteClick(_noteId: string, title: string, content: string) { |
359 | | - openNote = { title, content }; |
| 367 | + function handleNoteClick(_noteId: string, title: string, content: string, sessionId?: string) { |
| 368 | + openNote = { title, content, sessionId }; |
360 | 369 | } |
361 | 370 |
|
362 | 371 | async function handleReviewClick(reviewId: string) { |
|
803 | 812 | {/if} |
804 | 813 |
|
805 | 814 | {#if openNote} |
806 | | - <NoteModal title={openNote.title} content={openNote.content} onClose={() => (openNote = null)} /> |
| 815 | + <NoteModal |
| 816 | + title={openNote.title} |
| 817 | + content={openNote.content} |
| 818 | + sessionId={openNote.sessionId} |
| 819 | + onClose={() => (openNote = null)} |
| 820 | + onOpenSession={(sid) => { |
| 821 | + openNote = null; |
| 822 | + sessionMgr.openSessionId = sid; |
| 823 | + }} |
| 824 | + /> |
807 | 825 | {/if} |
808 | 826 |
|
809 | 827 | {#if viewImageId} |
|
847 | 865 | repoDir={branch.worktreePath} |
848 | 866 | branchId={branch.id} |
849 | 867 | projectId={branch.projectId} |
| 868 | + noteInfo={findNoteForSession(sessionMgr.openSessionId)} |
| 869 | + onOpenNote={(noteId, title, content) => { |
| 870 | + const sid = sessionMgr.openSessionId; |
| 871 | + sessionMgr.openSessionId = null; |
| 872 | + openNote = { title, content, sessionId: sid ?? undefined }; |
| 873 | + }} |
850 | 874 | onClose={async () => { |
851 | 875 | const closedSessionId = sessionMgr.openSessionId; |
852 | 876 | sessionMgr.openSessionId = null; |
|
0 commit comments