Skip to content

feat(visualization): cap floor label depth slider at the loaded project's depth#11

Open
Patrez wants to merge 2 commits into
ci/notify-codebase-architecturesfrom
feature/dynamic-floor-label-depth
Open

feat(visualization): cap floor label depth slider at the loaded project's depth#11
Patrez wants to merge 2 commits into
ci/notify-codebase-architecturesfrom
feature/dynamic-floor-label-depth

Conversation

@Patrez
Copy link
Copy Markdown
Contributor

@Patrez Patrez commented May 11, 2026

Description

The floor label depth slider was hardcoded to a max of 8, which is lower than the actual depth of many real codebases. This PR replaces the static cap with a dynamic one computed from the loaded project's tree.

What changed:

  • New selector maxFolderDepthSelector (visualization/app/codeCharta/state/selectors/accumulatedData/maxFolderDepth.selector.ts) walks the unified map node and returns the deepest folder depth.
  • The slider in areaSettingsPanel binds its [max] to this selector via async pipe, with a ?? 15 fallback for the pre-load state.
  • 4 selector tests covering: no project, leaves-only root, nested tree, empty root.

Result: sliding all the way right now labels every folder level of whatever's loaded, and the cap matches the data instead of an arbitrary number.

Definition of Done

  • Changes have been manually tested
  • There are automated tests for newly written code
  • Documentation update — not needed (no user-facing docs reference the previous 8-cap)
  • CHANGELOG.md — not updated in this fork (please confirm fork's convention)

Notes

  • Branch targets ci/notify-codebase-architectures rather than main because the floor label depth feature itself (PR Add configurable floor label depth #9 upstream, commit 72b037c) is on that branch but not yet on the fork's main. Adjust the base if you'd prefer main as the target.
  • A follow-up performance pass is desirable: setting floorLabelDepth currently triggers a full map re-render plus per-level canvas/texture re-allocation. Sliding to deeper values exposes this cost. See floorLabelDrawer.ts and actionsRequiringRerender.ts for the hot path.

Co-Authored-By: Claude Opus 4.7 (1M context) noreply@anthropic.com

…ct's depth

Replaces the hardcoded slider max of 8 with a selector that walks the
unified map node and returns the deepest folder depth, so sliding all
the way right labels every folder level and the cap matches the data.
Falls back to 15 when no project is loaded.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR removes the hardcoded floor label depth slider cap (previously 8) and replaces it with a dynamic maximum derived from the loaded project’s map hierarchy, so the UI can represent deeper real-world codebases.

Changes:

  • Added maxFolderDepthSelector, which traverses the loaded unifiedMapNode to compute the maximum labelable folder depth.
  • Wired the Floor Label Depth slider’s [max] to maxFolderDepthSelector (with a ?? 15 fallback before a project is loaded).
  • Added unit tests covering multiple project/tree shapes for the new selector.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.

File Description
visualization/app/codeCharta/ui/ribbonBar/areaSettingsPanel/areaSettingsPanel.component.ts Selects maxFolderDepthSelector and exposes it to the template as maxFloorLabelDepth$.
visualization/app/codeCharta/ui/ribbonBar/areaSettingsPanel/areaSettingsPanel.component.html Binds the floor label depth slider [max] to the computed depth (fallback 15).
visualization/app/codeCharta/state/selectors/accumulatedData/maxFolderDepth.selector.ts Implements the selector that computes the max folder depth from unifiedMapNode.
visualization/app/codeCharta/state/selectors/accumulatedData/maxFolderDepth.selector.spec.ts Adds tests for the selector across “no project”, shallow, nested, and empty-root cases.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

… spec

Replace synchronous subscribe-and-return helper with firstValueFrom + take(1)
so each test awaits one emission and the subscription closes. Aligns with the
repo's other MockStore-based selector specs and removes a subscription leak.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
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.

2 participants