Repository navigation
feat(favorites): nest categories, and drag a favorite between them - #618
Merged
Merged
Conversation
FR-9.2.2 asks for hierarchical folders, and the flat `categories: string[]` was read as the whole of what was possible (#334). It is not: a category is a name, and a name can be a path. "Reports/Daily" is one category to the store and two folders to the user. No migration, and a favorite saved under a flat name lands exactly where it always did. The separator is "/" because that is what people already type when they mean nesting. Dragging a favorite onto a folder moves it. The drag carries a private `text/sqlpilot-favorite` type rather than text/plain, so dropping a file on the panel does nothing, and a row being renamed is not draggable — a drag started mid-edit would take the half-typed name with it. The tree logic is a separate module with its own tests, because most of the sharp edges are in it rather than in the rendering. An intermediate folder is created even when nothing declared it, or a lone "Reports/Daily" leaves its nesting invisible. A collapsed folder hides its descendants but stays visible, or there is nothing left to click to reopen it. "Reports Archive" is not inside "Reports" despite the prefix. A folder cannot be moved inside itself or its own descendant, which would detach the subtree and lose it. Drag-reordering within a folder is deliberately not built, and the requirement now says so: favorites sort by recency, and a manual order would be a second ordering to keep in step with no one asking for it. Closes #334 Co-Authored-By: Claude Opus 5 <[email protected]>
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.
Closes #334. Last of the favorites audit.
FR-9.2.2 asks for hierarchical folders, and the flat
categories: string[]was read as the whole of what was possible. It isn't: a category is a name, and a name can be a path. "Reports/Daily" is one category to the store and two folders to the user.No migration, and a favorite saved under a flat name lands exactly where it always did.
Dragging a favorite onto a folder moves it. The drag carries a private
text/sqlpilot-favoritetype rather thantext/plain, so dropping a file on the panel does nothing — and a row being renamed isn't draggable, since a drag started mid-edit would take the half-typed name with it.The sharp edges are in the tree logic, so it's its own module
lib/category-tree.ts, 28 tests. Each of these is a case that would otherwise be found in the UI:Reports/Dailyleaves its nesting invisible.Reports Archiveis not insideReports, despite the prefix.Reports//Daily/normalises toReports/Daily; a stray separator is a typo, not a folder with no name.One thing deliberately not built
Drag-reordering within a folder. Favorites sort by recency, and a manual order would be a second ordering to keep in step with nobody asking for it. FR-9.2.2 now says so rather than leaving it looking unfinished.
Verification
28 tree tests, 9 component tests. Unit 2127, browser 297, 0 lint errors.