Skip to content

refactor(web): extract ConversationToc from ConversationPane#1010

Merged
wbxl2000 merged 1 commit into
mainfrom
refactor/web-split-conversation-toc
Jun 23, 2026
Merged

refactor(web): extract ConversationToc from ConversationPane#1010
wbxl2000 merged 1 commit into
mainfrom
refactor/web-split-conversation-toc

Conversation

@wbxl2000

Copy link
Copy Markdown
Collaborator

Related Issue

Part of the apps/kimi-web god-component split tracked in web-refactor-plan.md (follows #998 Sidebar→WorkspaceGroup and #1001 ChatPane helpers). No standalone issue.

Problem

ConversationPane.vue had grown to 1613 lines. The beta conversation outline (the right-edge proportional-bubble table of contents with a viewport indicator and hover tooltip) is a self-contained piece of UI that lived inline in the pane: its own markup, its own tooltip hover state, and a sizable block of scoped CSS. Extracting it makes the pane easier to read and gives the outline a clear, testable boundary.

What changed

  • New apps/kimi-web/src/components/ConversationToc.vue:
    • Owns the <nav class="conversation-toc"> markup, the tooltip hover state (showTooltip/hideTooltip), and the TOC scoped CSS (moved verbatim).
    • Owns its own visibility: hidden on mobile, while the session is loading, or when there is only one turn. The pane now only gates rendering on the betaToc feature flag.
    • Exports the ConversationTocItem view type (mirroring how MentionMenu.vue exports FileItem), so the pane imports the type instead of redefining it.
  • ConversationPane.vue:
    • Replaces the inline nav with <ConversationToc :items :metrics :active-turn-id :viewport :mobile :session-loading @select="scrollToTurn" />.
    • Keeps conversationTocItems, tocMetrics, tocTotalHeight, activeTurnId, tocViewport, updateTocViewport(), and scrollToTurn() — these are coupled to the scroll container (panesRef) and feed both the outline and the auto-scroll/follow logic, so they belong in the pane.
    • Removes the inline tooltip state, showTooltip/hideTooltip, the showConversationToc computed, and the moved CSS block.
    • 1613 → 1422 lines.

No user-visible behavior change. The DOM structure, class names, and scoped styles are preserved byte-for-byte.

Verification

  • pnpm --filter @moonshot-ai/kimi-web typecheck — pass (vue-tsc --noEmit)
  • pnpm --filter @moonshot-ai/kimi-web test — 40 passed
  • pnpm --filter @moonshot-ai/kimi-web build — pass
  • oxlint --type-aware on the two changed files — 0 warnings, 0 errors

Checklist

  • I have read the CONTRIBUTING document.
  • I have linked a related issue, or explained the problem above.
  • I have added tests that prove my feature works. (N/A — pure refactor; the web app has no component tests since test(kimi-web): keep only pure logic unit tests #959. vue-tsc --noEmit is the safety net, plus manual verification.)
  • Ran gen-changesets skill, or this PR needs no changeset. (Added .changeset/web-split-conversation-toc.md, patch on @moonshot-ai/kimi-code.)
  • Ran gen-docs skill, or this PR needs no doc update. (No user-facing change.)

Move the beta conversation outline (proportional bubbles, viewport
indicator, hover tooltip) into a dedicated ConversationToc component.
The child owns the nav markup, the tooltip hover state, and its own
visibility (mobile / session-loading / single-turn), while the metric
derivation and scroll-driven viewport/active-turn tracking stay in the
pane because they are coupled to the scroll container.

ConversationPane.vue: 1613 -> 1422 lines. No behavior change.
@changeset-bot

changeset-bot Bot commented Jun 23, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: a685d42

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@moonshot-ai/kimi-code Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@pkg-pr-new

pkg-pr-new Bot commented Jun 23, 2026

Copy link
Copy Markdown
pnpm dlx https://pkg.pr.new/@moonshot-ai/kimi-code@a685d42
npx https://pkg.pr.new/@moonshot-ai/kimi-code@a685d42

commit: a685d42

@wbxl2000 wbxl2000 merged commit a2650f8 into main Jun 23, 2026
9 checks passed
@wbxl2000 wbxl2000 deleted the refactor/web-split-conversation-toc branch June 23, 2026 07:51
@github-actions github-actions Bot mentioned this pull request Jun 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant