feat(visualization): cap floor label depth slider at the loaded project's depth#11
Open
Patrez wants to merge 2 commits into
Open
feat(visualization): cap floor label depth slider at the loaded project's depth#11Patrez wants to merge 2 commits into
Patrez wants to merge 2 commits into
Conversation
…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>
There was a problem hiding this comment.
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 loadedunifiedMapNodeto compute the maximum labelable folder depth. - Wired the Floor Label Depth slider’s
[max]tomaxFolderDepthSelector(with a?? 15fallback 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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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:
maxFolderDepthSelector(visualization/app/codeCharta/state/selectors/accumulatedData/maxFolderDepth.selector.ts) walks the unified map node and returns the deepest folder depth.areaSettingsPanelbinds its[max]to this selector via async pipe, with a?? 15fallback for the pre-load state.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
Notes
ci/notify-codebase-architecturesrather thanmainbecause 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.floorLabelDepthcurrently triggers a full map re-render plus per-level canvas/texture re-allocation. Sliding to deeper values exposes this cost. SeefloorLabelDrawer.tsandactionsRequiringRerender.tsfor the hot path.Co-Authored-By: Claude Opus 4.7 (1M context) noreply@anthropic.com