[PR #241] [MERGED] feat(game): jump back to a segment by clicking it in Session Logs #4524

Closed
opened 2026-10-22 04:08:24 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/Pasta-Devs/Marinara-Engine/pull/241
Author: @Romuromylus
Created: 4/26/2026
Status: ✅ Merged
Merged: 4/27/2026
Merged by: @LukaTheHero

Base: main ← Head: fix/game-logs-jump-to-segment


📝 Commits (4)

  • 525f0b8 feat(game): jump back to a segment by clicking it in Session Logs
  • a548148 fix(game): add SFX and a11y to Session Logs jump rows
  • 9082dbd fix(game): widen interactive-target guard from HTMLElement to Element
  • 1f8ec27 Merge branch 'main' into fix/game-logs-jump-to-segment

📊 Changes

1 file changed (+54 additions, -1 deletions)

View changed files

📝 packages/client/src/components/game/GameNarration.tsx (+54 -1)

📄 Description

Why this change

In Game Mode, the Session Logs modal is a read-only history. If you scroll past a beat and want to re-experience it (replay the typewriter for that exact narration segment, or reground yourself in a moment of dialogue), there's no way to get back — setActiveIndex is internal to GameNarration and segments past the active one have no affordance. This adds the natural interaction: click a logged row from the current scene to make it the active narration segment again.

What changed

  • packages/client/src/components/game/GameNarration.tsx: each row in the Session Logs modal that belongs to the latest assistant message (the "current scene") now accepts a click. Clicking sets activeIndex to that segment's index in the live segments list, resets visibleChars via getSegmentStartVisibleChars (so the typewriter replays — or reveals instantly if gameInstantTextReveal is on), closes the modal, and clears any in-progress log edit state.
  • Past-scene rows remain non-interactive: latestAssistant is the only message the narration stage can play, so older messages would require a destructive "delete everything after" rewind. Out of scope here — this PR is scoped strictly to the cheap, non-destructive case.
  • Click handler short-circuits on target.closest("button, input, textarea, a") so the existing edit/delete pencil/trash buttons (and inline edit textareas) keep working without bubbling into a jump.
  • Hover affordance: jumpable rows get cursor-pointer and a faint hover:ring-1 hover:ring-white/15. The currently-active segment keeps its existing ring-1 ring-[var(--primary)]/40 and is excluded from the jump (it would be a no-op).

Wired across all four segment renderers in the modal — dialogue, system, readable (Note/Book), and the default narration row.

Validation

  • pnpm check
  • Manual verification completed (describe below)

Manual verification notes

Built and deployed to the author's EasyPanel instance off fork main; verified in-browser:

  • Hovering a current-scene row shows the white hover ring and pointer cursor; tooltip reads "Jump back to this segment".
  • Clicking a current-scene row closes the modal and rewinds the narration stage to that segment, with the typewriter replaying from the start of that segment.
  • The currently-active segment shows the existing primary-color ring and does not pick up the hover affordance.
  • Past-scene rows (older AI messages) are not interactive — no hover ring, default cursor, no click effect.
  • Edit (pencil) and delete (trash) icons on hover continue to work normally; clicking them does not also trigger a jump.
  • Persistence: the rewound activeIndex flows through the existing onSegmentChange path and is written to both localStorage (narration-idx:<chatId>) and the server's gameNarrationIndex, so a refresh restores the rewound position.

Docs and release impact

  • No docs changes needed

Summary by CodeRabbit

  • New Features
    • Log rows can be focused and clicked (or activated via Enter/Space) to jump back to the corresponding live narration segment when applicable.
    • Jump restores the conversation view to that point, closes the logs modal, clears log-edit state, resets scroll tracking, and plays a click sound.
    • Eligible rows show hover/focus ring styling; in-row controls are ignored so their interactions aren’t interrupted.

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/Pasta-Devs/Marinara-Engine/pull/241 **Author:** [@Romuromylus](https://github.com/Romuromylus) **Created:** 4/26/2026 **Status:** ✅ Merged **Merged:** 4/27/2026 **Merged by:** [@LukaTheHero](https://github.com/LukaTheHero) **Base:** `main` ← **Head:** `fix/game-logs-jump-to-segment` --- ### 📝 Commits (4) - [`525f0b8`](https://github.com/Pasta-Devs/Marinara-Engine/commit/525f0b8e77f536e3edf57823b443a19eecc0c06d) feat(game): jump back to a segment by clicking it in Session Logs - [`a548148`](https://github.com/Pasta-Devs/Marinara-Engine/commit/a5481485835104e91c7d476c98b504e14709df7b) fix(game): add SFX and a11y to Session Logs jump rows - [`9082dbd`](https://github.com/Pasta-Devs/Marinara-Engine/commit/9082dbd42d56292a780f8516f9045c1ebaa35d55) fix(game): widen interactive-target guard from HTMLElement to Element - [`1f8ec27`](https://github.com/Pasta-Devs/Marinara-Engine/commit/1f8ec27fffaf43ab304c31bb0e7b9e2e43b33c2c) Merge branch 'main' into fix/game-logs-jump-to-segment ### 📊 Changes **1 file changed** (+54 additions, -1 deletions) <details> <summary>View changed files</summary> 📝 `packages/client/src/components/game/GameNarration.tsx` (+54 -1) </details> ### 📄 Description ## Why this change In Game Mode, the Session Logs modal is a read-only history. If you scroll past a beat and want to re-experience it (replay the typewriter for that exact narration segment, or reground yourself in a moment of dialogue), there's no way to get back — `setActiveIndex` is internal to `GameNarration` and segments past the active one have no affordance. This adds the natural interaction: click a logged row from the current scene to make it the active narration segment again. ## What changed - `packages/client/src/components/game/GameNarration.tsx`: each row in the Session Logs modal that belongs to the latest assistant message (the "current scene") now accepts a click. Clicking sets `activeIndex` to that segment's index in the live `segments` list, resets `visibleChars` via `getSegmentStartVisibleChars` (so the typewriter replays — or reveals instantly if `gameInstantTextReveal` is on), closes the modal, and clears any in-progress log edit state. - Past-scene rows remain non-interactive: `latestAssistant` is the only message the narration stage can play, so older messages would require a destructive "delete everything after" rewind. Out of scope here — this PR is scoped strictly to the cheap, non-destructive case. - Click handler short-circuits on `target.closest("button, input, textarea, a")` so the existing edit/delete pencil/trash buttons (and inline edit textareas) keep working without bubbling into a jump. - Hover affordance: jumpable rows get `cursor-pointer` and a faint `hover:ring-1 hover:ring-white/15`. The currently-active segment keeps its existing `ring-1 ring-[var(--primary)]/40` and is excluded from the jump (it would be a no-op). Wired across all four segment renderers in the modal — dialogue, system, readable (Note/Book), and the default narration row. ## Validation - [x] `pnpm check` - [x] Manual verification completed (describe below) ### Manual verification notes Built and deployed to the author's EasyPanel instance off fork main; verified in-browser: - Hovering a current-scene row shows the white hover ring and pointer cursor; tooltip reads "Jump back to this segment". - Clicking a current-scene row closes the modal and rewinds the narration stage to that segment, with the typewriter replaying from the start of that segment. - The currently-active segment shows the existing primary-color ring and does not pick up the hover affordance. - Past-scene rows (older AI messages) are not interactive — no hover ring, default cursor, no click effect. - Edit (pencil) and delete (trash) icons on hover continue to work normally; clicking them does not also trigger a jump. - Persistence: the rewound `activeIndex` flows through the existing `onSegmentChange` path and is written to both `localStorage` (`narration-idx:<chatId>`) and the server's `gameNarrationIndex`, so a refresh restores the rewound position. ## Docs and release impact - [x] No docs changes needed <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **New Features** * Log rows can be focused and clicked (or activated via Enter/Space) to jump back to the corresponding live narration segment when applicable. * Jump restores the conversation view to that point, closes the logs modal, clears log-edit state, resets scroll tracking, and plays a click sound. * Eligible rows show hover/focus ring styling; in-row controls are ignored so their interactions aren’t interrupted. <!-- end of auto-generated comment: release notes by coderabbit.ai --> --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-10-22 04:08:24 +07:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
Pasta-Devs/Marinara-Engine#4524
No description provided.