feat(sidebar): feature-flagged file-system tree sidebar#2468
Draft
raquelmsmith wants to merge 4 commits into
Draft
feat(sidebar): feature-flagged file-system tree sidebar#2468raquelmsmith wants to merge 4 commits into
raquelmsmith wants to merge 4 commits into
Conversation
Behind the `posthog-code-file-system-sidebar` flag (force-enabled in dev),
replace the sidebar's repo/task list with a tree of items from the PostHog
file-system "desktop" surface (PostHog PR #61047). Folders render with a `#`
icon and are expandable like the current repo sections; leaf items render as
inert rows for now.
- posthogClient: getDesktopFileSystem() hits the server-controlled
/api/projects/{id}/desktop_file_system/ route via the raw fetcher with
pagination-following (route isn't in the generated OpenAPI client).
- buildFileSystemTree(): pure util turning the flat list into a nested tree
(derives intermediate folders, attaches explicit folder rows, guards empty
segments, sorts folders-first then alphabetically) + unit tests.
- useDesktopFileSystem(): useAuthenticatedQuery wrapper mirroring useTaskSummaries.
- FileSystemTreeView: recursive renderer reusing SidebarSection (folders) and
SidebarItem (leaves), with empty state and fs:-namespaced collapse keys.
- SidebarSection: additive `depth` prop for nested indentation (depth=0 keeps
the existing TaskListView rendering unchanged).
- SidebarMenu: flag branch between the new tree view and TaskListView.
Generated-By: PostHog Code
Task-Id: 26a4498f-f1b9-405b-a439-56af14877c6d
Make the flagged file-system sidebar a panel the user can switch away from, instead of fully replacing the task list. Adds a two-segment "Files" / "Tasks" toggle shown only when the file-system sidebar flag is on, with the selected panel persisted in the sidebar store. When the flag is off, the task list renders as before. Generated-By: PostHog Code Task-Id: 26a4498f-f1b9-405b-a439-56af14877c6d
Rename the file-system sidebar panel label from "Files" to "Channels" (keeping the persisted "files" panel value), and add the ability to create and delete top-level channels synced to the cloud desktop_file_system surface. - SidebarPanelToggle: label "Channels" with Hash icon - posthogClient: createDesktopFileSystemChannel / deleteDesktopFileSystem - useDesktopFileSystemMutations: create/delete with query invalidation - ChannelsHeader: inline add-channel input - SidebarSection: generic hover delete action - FileSystemTreeView: delete top-level channels behind a confirmation Generated-By: PostHog Code Task-Id: b3c22a1c-8b74-4790-b7a1-673715dee381
Replace the inline channel-name input in the sidebar with a Slack-style "Create a channel" modal: a Name field with a # prefix, character counter, helper text, and a Create action. Generated-By: PostHog Code Task-Id: b3c22a1c-8b74-4790-b7a1-673715dee381
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.
Summary
Behind the
posthog-code-file-system-sidebarfeature flag (force-enabled in dev), this replaces the sidebar's repo/task list with a tree of items from the PostHog file-system desktop surface introduced server-side by PostHog #61047. Folders render with a#icon and are expandable exactly like the current repo sections; leaf items render as inert rows (no-op click) for this first pass.The desktop tree is served from its own server-controlled route
GET /api/projects/{id}/desktop_file_system/(surface is not a query param). That route isn't in the generated OpenAPI client yet, so it's called via the raw fetcher, mirroringgetTaskSummaries.Changes
New (under
apps/code/src/renderer/features/sidebar/):utils/fileSystemTree.ts— purebuildFileSystemTree()turning the flatFileSystem[]into a nested tree: derives intermediate folders from path segments, attaches explicittype: "folder"rows, guards empty segments, sorts folders-first then alphabetically.utils/fileSystemTree.test.ts— 6 unit tests (folder derivation, explicit rows, sorting, empty-segment guarding, folder/leaf collisions).hooks/useDesktopFileSystem.ts—useAuthenticatedQuerywrapper, mirroringuseTaskSummaries.components/FileSystemTreeView.tsx— recursive renderer usingSidebarSection(folders,#icon) andSidebarItem(leaves), with a "Nothing here yet" empty state,fs:-namespaced collapse keys, and a visual indent cap.Modified:
api/posthogClient.ts—getDesktopFileSystem()with pagination-following.shared/constants.ts—FILE_SYSTEM_SIDEBAR_FLAG.components/SidebarSection.tsx— additivedepthprop for nested indentation (depth=0reproduces the priorpl-2, soTaskListViewis visually unchanged).components/SidebarMenu.tsx— flag branch betweenFileSystemTreeViewand the existingTaskListView; top nav andProjectSwitcheruntouched.Notes
Verification
pnpm --filter code typecheckpassespnpm --filter code test fileSystemTree— 6/6 passNot yet verified with a live Electron run.