@bevel-software/platform-core-frontend 0.4.1 → 0.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +5 -3
- package/src/core/CoreAppShell.tsx +195 -56
- package/src/core/__tests__/AppChrome.test.tsx +125 -0
- package/src/core/__tests__/ShellRoutes.test.tsx +37 -2
- package/src/core/__tests__/bootstrap.test.ts +63 -0
- package/src/core/bootstrap.ts +73 -0
- package/src/core/events.ts +12 -0
- package/src/core/registry.ts +58 -9
- package/src/index.css +100 -11
- package/src/index.ts +24 -23
- package/src/lib/utils.ts +93 -117
- package/src/modules/access/__tests__/ManageAccessDialog.placement.test.tsx +281 -0
- package/src/modules/access/__tests__/ManageAccessDialog.test.tsx +166 -1
- package/src/modules/access/api.ts +49 -0
- package/src/modules/access/components/ManageAccessDialog.tsx +786 -481
- package/src/modules/access/hooks/useFileAccess.ts +1 -1
- package/src/modules/admin/__tests__/AdminRolesPage.suggest.test.tsx +86 -0
- package/src/modules/admin/__tests__/UserAccountsPage.test.tsx +17 -1
- package/src/modules/admin/__tests__/admin.unread.test.tsx +61 -0
- package/src/modules/admin/components/AdminRolesPage.tsx +44 -38
- package/src/modules/admin/components/RolesCorruptedBanner.tsx +11 -10
- package/src/modules/admin/components/UserAccountsPage.tsx +36 -28
- package/src/modules/admin/state/admin.context.tsx +15 -6
- package/src/modules/auth/components/AccountPage.tsx +11 -11
- package/src/modules/auth/components/LoginScreen.tsx +12 -12
- package/src/modules/auth/services/sso.ts +47 -1
- package/src/modules/change-requests/__tests__/ChangeRequestDialog.test.tsx +277 -0
- package/src/modules/change-requests/__tests__/author.test.ts +48 -0
- package/src/modules/change-requests/__tests__/conflict.test.ts +73 -0
- package/src/modules/change-requests/__tests__/diff.test.ts +134 -0
- package/src/modules/change-requests/__tests__/propose.test.ts +93 -0
- package/src/modules/change-requests/__tests__/useFileOnBranch.test.tsx +72 -0
- package/src/modules/change-requests/change-requests.css +22 -0
- package/src/modules/change-requests/components/ChangeBox.tsx +277 -0
- package/src/modules/change-requests/components/ChangeRequestDialog.tsx +713 -0
- package/src/modules/change-requests/components/ConflictHelp.tsx +47 -0
- package/src/modules/change-requests/components/CrFileTree.tsx +398 -0
- package/src/modules/change-requests/components/FileChangeBoxes.tsx +168 -0
- package/src/modules/change-requests/hooks/useApplyChangeRequest.ts +236 -0
- package/src/modules/change-requests/hooks/useCrFileDiffs.ts +79 -0
- package/src/modules/change-requests/hooks/useFileOnBranch.ts +80 -0
- package/src/modules/change-requests/services/change-requests.api.ts +45 -0
- package/src/modules/change-requests/services/propose.api.ts +162 -0
- package/src/modules/change-requests/utils/author.ts +47 -0
- package/src/modules/change-requests/utils/conflict.ts +38 -0
- package/src/modules/change-requests/utils/diff.ts +80 -0
- package/src/modules/git/__tests__/BranchSwitcher.test.tsx +27 -18
- package/src/modules/git/__tests__/FileHistoryPanel.test.tsx +36 -83
- package/src/modules/git/__tests__/PullNeededBanner.test.tsx +5 -5
- package/src/modules/git/__tests__/PullRequestsForMe.test.tsx +147 -0
- package/src/modules/git/__tests__/useAutoPullUpdates.test.tsx +2 -8
- package/src/modules/git/components/BranchSwitcher.tsx +68 -31
- package/src/modules/git/components/DiffView.tsx +4 -4
- package/src/modules/git/components/FileComparisonPanel.tsx +20 -20
- package/src/modules/git/components/FileHistoryPanel.tsx +71 -107
- package/src/modules/git/components/PullNeededBanner.tsx +6 -13
- package/src/modules/git/components/PullRequestsForMe.tsx +71 -36
- package/src/modules/git/components/UnifiedDiffView.tsx +4 -4
- package/src/modules/git/hooks/__tests__/useGitState.deleteBranch.test.tsx +2 -2
- package/src/modules/git/hooks/useGitState.ts +15 -14
- package/src/modules/git/services/__tests__/error-messages.test.ts +4 -4
- package/src/modules/git/services/error-messages.ts +7 -7
- package/src/modules/git/services/git.api.ts +17 -11
- package/src/modules/git/services/pr-prompts.ts +2 -2
- package/src/modules/git/state/git.context.ts +10 -1
- package/src/modules/layout/__tests__/SidebarFrameResponsive.test.tsx +224 -0
- package/src/modules/layout/__tests__/SidebarToggle.test.tsx +242 -0
- package/src/modules/layout/__tests__/breakpoints.test.ts +56 -0
- package/src/modules/layout/breakpoints.ts +6 -0
- package/src/modules/layout/components/AppLayout.tsx +17 -5
- package/src/modules/layout/components/DemoBanner.tsx +10 -1
- package/src/modules/layout/components/MaintenanceOverlay.tsx +3 -3
- package/src/modules/layout/components/MobileChatLayout.tsx +31 -26
- package/src/modules/layout/components/ResizableThreePaneLayout.tsx +59 -24
- package/src/modules/layout/components/SidebarFrame.tsx +317 -0
- package/src/modules/layout/components/SidebarToggle.tsx +86 -0
- package/src/modules/layout/components/SlideOverlay.tsx +1 -1
- package/src/modules/layout/components/__tests__/MobileChatLayout.test.tsx +40 -2
- package/src/modules/layout/components/__tests__/ResizableThreePaneLayout.test.tsx +19 -3
- package/src/modules/layout/state/sidebar.ts +200 -0
- package/src/modules/library/__tests__/AddToGroupDialog.test.tsx +313 -0
- package/src/modules/library/__tests__/ChangeRequestDock.test.tsx +84 -0
- package/src/modules/library/__tests__/GroupJoinRequests.test.tsx +178 -0
- package/src/modules/library/__tests__/GroupPage.test.tsx +479 -0
- package/src/modules/library/__tests__/GroupsIndexPage.test.tsx +283 -0
- package/src/modules/library/__tests__/GroupsSidebar.contextmenu.test.tsx +175 -0
- package/src/modules/library/__tests__/GroupsSidebar.locked.test.tsx +96 -0
- package/src/modules/library/__tests__/GroupsSidebar.test.tsx +142 -0
- package/src/modules/library/__tests__/GroupsSidebarMenu.test.tsx +142 -0
- package/src/modules/library/__tests__/LibraryCard.test.tsx +149 -0
- package/src/modules/library/__tests__/LibraryRoutes.test.tsx +378 -0
- package/src/modules/library/__tests__/LibrarySidebarMenu.test.tsx +347 -0
- package/src/modules/library/__tests__/LockedGroupView.test.tsx +203 -0
- package/src/modules/library/__tests__/NewGroupDialog.test.tsx +114 -0
- package/src/modules/library/__tests__/PersonalAddDialog.test.tsx +177 -0
- package/src/modules/library/__tests__/SkillPage.test.tsx +1063 -0
- package/src/modules/library/__tests__/ToolConnectionSection.test.tsx +259 -0
- package/src/modules/library/__tests__/ToolLogo.test.tsx +63 -0
- package/src/modules/library/__tests__/ToolPage.test.tsx +315 -0
- package/src/modules/library/__tests__/ToolSharePanel.test.tsx +36 -0
- package/src/modules/library/__tests__/ToolVarRow.test.tsx +260 -0
- package/src/modules/library/__tests__/WorkspaceItemRoute.test.tsx +197 -0
- package/src/modules/library/__tests__/auth-harness.tsx +37 -0
- package/src/modules/library/__tests__/oauth-fragment.test.ts +48 -0
- package/src/modules/library/__tests__/status.test.ts +113 -20
- package/src/modules/library/__tests__/useSkillDetail.test.tsx +102 -0
- package/src/modules/library/__tests__/useToolPage.test.tsx +146 -0
- package/src/modules/library/components/AccessRequestsBanner.tsx +101 -0
- package/src/modules/library/components/AddToGroupDialog.tsx +115 -0
- package/src/modules/library/components/ChangeRequestDock.tsx +52 -28
- package/src/modules/library/components/DeleteGroupDialog.tsx +87 -0
- package/src/modules/library/components/GroupIndexRow.tsx +63 -0
- package/src/modules/library/components/GroupJoinRequests.tsx +56 -0
- package/src/modules/library/components/GroupPage.tsx +373 -0
- package/src/modules/library/components/GroupsIndexPage.tsx +222 -0
- package/src/modules/library/components/GroupsSidebar.tsx +338 -0
- package/src/modules/library/components/GroupsSidebarMenu.tsx +160 -0
- package/src/modules/library/components/LibraryCard.tsx +123 -102
- package/src/modules/library/components/LibraryLayout.tsx +344 -0
- package/src/modules/library/components/LibraryPage.tsx +111 -227
- package/src/modules/library/components/LockGlyph.tsx +31 -0
- package/src/modules/library/components/LockedGroupView.tsx +159 -0
- package/src/modules/library/components/ManagedGroupRequests.tsx +70 -0
- package/src/modules/library/components/NewGroupDialog.tsx +112 -0
- package/src/modules/library/components/NewSkillPanel.tsx +151 -0
- package/src/modules/library/components/PageActions.tsx +156 -0
- package/src/modules/library/components/PendingSkillReview.tsx +63 -0
- package/src/modules/library/components/PersonalAddDialog.tsx +88 -0
- package/src/modules/library/components/PersonalGroupPage.tsx +125 -0
- package/src/modules/library/components/StatusDot.tsx +25 -0
- package/src/modules/library/components/ToolLogo.tsx +171 -0
- package/src/modules/library/components/group-page-parts.tsx +419 -0
- package/src/modules/library/components/skill-page/SkillFileEditor.tsx +134 -0
- package/src/modules/library/components/skill-page/SkillFilePane.tsx +117 -0
- package/src/modules/library/components/skill-page/SkillFileTabs.tsx +112 -0
- package/src/modules/library/components/skill-page/SkillPage.tsx +673 -0
- package/src/modules/library/components/skill-page/tab-ids.ts +33 -0
- package/src/modules/library/components/tool-page/ToolConnectionSection.tsx +175 -0
- package/src/modules/library/components/tool-page/ToolPage.tsx +228 -0
- package/src/modules/library/components/tool-page/ToolSharePanel.tsx +45 -0
- package/src/modules/library/components/tool-page/ToolVarRow.tsx +289 -0
- package/src/modules/library/hooks/useJoinRequests.ts +114 -0
- package/src/modules/library/hooks/useLibraryData.ts +134 -119
- package/src/modules/library/hooks/useSkillDetail.ts +119 -74
- package/src/modules/library/hooks/useToolPage.ts +145 -0
- package/src/modules/library/library.css +33 -245
- package/src/modules/library/routes/LibraryRoutes.tsx +134 -0
- package/src/modules/library/routes/WorkspaceItemRoute.tsx +74 -0
- package/src/modules/library/routes/library-paths.ts +191 -0
- package/src/modules/library/services/groups.api.ts +189 -0
- package/src/modules/library/services/library.api.ts +291 -164
- package/src/modules/library/services/tools.api.ts +60 -0
- package/src/modules/library/state/library-context.ts +22 -0
- package/src/modules/library/state/library-data.tsx +223 -0
- package/src/modules/library/state/toast.context.ts +32 -0
- package/src/modules/library/state/toast.tsx +84 -42
- package/src/modules/library/utils/clipboard.ts +33 -0
- package/src/modules/library/utils/group-summary.ts +68 -0
- package/src/modules/library/utils/names.ts +30 -0
- package/src/modules/library/utils/navigate-external.ts +15 -0
- package/src/modules/library/utils/oauth-fragment.ts +32 -0
- package/src/modules/library/utils/personal-group.ts +36 -0
- package/src/modules/library/utils/status.ts +108 -25
- package/src/modules/library/utils/toast-duration.ts +16 -0
- package/src/modules/onboarding/__tests__/onboarding.test.tsx +533 -0
- package/src/modules/onboarding/agent-clients.ts +48 -0
- package/src/modules/onboarding/components/ConnectAgentPill.tsx +133 -0
- package/src/modules/onboarding/components/RootLanding.tsx +54 -0
- package/src/modules/onboarding/components/WelcomePage.tsx +364 -0
- package/src/modules/onboarding/paths.ts +9 -0
- package/src/modules/onboarding/state/onboarding.ts +191 -0
- package/src/modules/pr/components/OpenChangeRequestDialog.tsx +10 -10
- package/src/modules/pr/services/pr-approvals.api.ts +19 -0
- package/src/modules/pr/services/pr-cancel.api.ts +11 -0
- package/src/modules/review/components/BinaryChangePlaceholder.tsx +3 -3
- package/src/modules/review/components/DiffViewer.tsx +4 -4
- package/src/modules/review/components/MarkdownDiffViewer.tsx +84 -26
- package/src/modules/review/components/ReviewFileRow.tsx +10 -10
- package/src/modules/review/components/ReviewPanel.tsx +49 -17
- package/src/modules/review/components/ReviewPanelSurface.tsx +1 -1
- package/src/modules/review/components/__tests__/MarkdownDiffViewer.test.tsx +122 -0
- package/src/modules/review/hooks/__tests__/useReviewState.test.ts +1 -1
- package/src/modules/secrets-vault/components/ConnectToolsPage.tsx +273 -171
- package/src/modules/secrets-vault/components/SecretsPage.tsx +147 -110
- package/src/modules/secrets-vault/components/ToolSecretsPanel.tsx +109 -92
- package/src/modules/secrets-vault/components/__tests__/SecretsPage.test.tsx +35 -4
- package/src/modules/secrets-vault/services/connect.api.ts +24 -3
- package/src/modules/settings/components/DeploymentPage.tsx +90 -0
- package/src/modules/settings/components/SettingsLayout.tsx +135 -0
- package/src/modules/settings/components/SettingsNav.tsx +114 -0
- package/src/modules/settings/components/__tests__/DeploymentPage.test.tsx +110 -0
- package/src/modules/settings/components/__tests__/SettingsLayout.test.tsx +249 -0
- package/src/modules/settings/settings-nav-items.tsx +166 -0
- package/src/modules/setup/__tests__/setup.test.tsx +540 -0
- package/src/modules/setup/components/SetupGate.tsx +67 -0
- package/src/modules/setup/components/SetupScreen.tsx +573 -0
- package/src/modules/setup/services/setup.api.ts +106 -0
- package/src/modules/setup/utils/git-host.ts +34 -0
- package/src/modules/toolbar/components/AppSwitcher.tsx +38 -15
- package/src/modules/toolbar/components/ExternalAgentAccessPage.tsx +50 -50
- package/src/modules/toolbar/components/ProfileMenu.tsx +294 -0
- package/src/modules/toolbar/components/Toolbar.tsx +56 -54
- package/src/modules/toolbar/components/__tests__/AppSwitcher.test.tsx +176 -122
- package/src/modules/toolbar/components/__tests__/Toolbar.test.tsx +252 -77
- package/src/modules/tools/ToolsExplorerPage.tsx +45 -40
- package/src/modules/workspace/__tests__/design-system-parity.test.ts +133 -0
- package/src/modules/workspace/__tests__/testFixtures.ts +2 -0
- package/src/modules/workspace/components/EditorTabs.tsx +82 -50
- package/src/modules/workspace/components/FileExplorer.tsx +413 -189
- package/src/modules/workspace/components/FilePaneCard.tsx +53 -0
- package/src/modules/workspace/components/FileRoute.tsx +89 -84
- package/src/modules/workspace/components/FileViewer.tsx +700 -294
- package/src/modules/workspace/components/KbDocumentShell.tsx +138 -0
- package/src/modules/workspace/components/KbFileRail.tsx +128 -0
- package/src/modules/workspace/components/KbPageHeader.tsx +390 -0
- package/src/modules/workspace/components/__tests__/EditorTabs.test.tsx +87 -3
- package/src/modules/workspace/components/__tests__/FileExplorer.test.tsx +293 -39
- package/src/modules/workspace/components/__tests__/FileRoute.test.tsx +1 -16
- package/src/modules/workspace/components/__tests__/FileViewer.test.tsx +462 -44
- package/src/modules/workspace/components/__tests__/KbDocumentShell.test.tsx +84 -0
- package/src/modules/workspace/components/__tests__/KbFileRail.test.tsx +83 -0
- package/src/modules/workspace/components/__tests__/KbPageHeader.test.tsx +192 -0
- package/src/modules/workspace/components/renderers/CopyAnchorButton.tsx +64 -0
- package/src/modules/workspace/components/renderers/CsvRenderer.tsx +8 -8
- package/src/modules/workspace/components/renderers/DocxRenderer.tsx +18 -9
- package/src/modules/workspace/components/renderers/HtmlRenderer.tsx +14 -14
- package/src/modules/workspace/components/renderers/ImageRenderer.tsx +2 -2
- package/src/modules/workspace/components/renderers/KbMarkdownView.tsx +31 -165
- package/src/modules/workspace/components/renderers/MarkdownRenderer.tsx +18 -5
- package/src/modules/workspace/components/renderers/MermaidDiagram.tsx +27 -10
- package/src/modules/workspace/components/renderers/PdfRenderer.tsx +2 -2
- package/src/modules/workspace/components/renderers/TextRenderer.tsx +11 -5
- package/src/modules/workspace/components/renderers/ToolForm.tsx +24 -24
- package/src/modules/workspace/components/renderers/ToolRenderer.tsx +27 -27
- package/src/modules/workspace/components/renderers/XlsxRenderer.tsx +11 -11
- package/src/modules/workspace/components/renderers/__tests__/DocxRenderer.test.tsx +66 -0
- package/src/modules/workspace/components/renderers/__tests__/KbMarkdownView.test.tsx +17 -1
- package/src/modules/workspace/components/renderers/__tests__/MarkdownRenderer.test.tsx +1 -1
- package/src/modules/workspace/components/renderers/__tests__/MermaidDiagram.test.tsx +58 -0
- package/src/modules/workspace/components/renderers/__tests__/lazyRenderer.test.tsx +68 -0
- package/src/modules/workspace/components/renderers/__tests__/rendererLayout.test.ts +64 -0
- package/src/modules/workspace/components/renderers/__tests__/sanitizeDocxHtml.test.ts +0 -0
- package/src/modules/workspace/components/renderers/chunk-boundary.tsx +71 -0
- package/src/modules/workspace/components/renderers/index.ts +78 -2
- package/src/modules/workspace/components/renderers/kbMarkdownPipeline.tsx +241 -0
- package/src/modules/workspace/components/renderers/lazyRenderer.tsx +59 -0
- package/src/modules/workspace/components/renderers/sanitizeDocxHtml.ts +91 -0
- package/src/modules/workspace/hooks/__tests__/useLinksOut.test.ts +59 -0
- package/src/modules/workspace/hooks/__tests__/useOpenChangeRequests.test.tsx +237 -0
- package/src/modules/workspace/hooks/__tests__/useWorkspaceState.test.tsx +185 -0
- package/src/modules/workspace/hooks/useAutoGrowTextarea.ts +30 -0
- package/src/modules/workspace/hooks/useLastCommit.ts +66 -0
- package/src/modules/workspace/hooks/useLinksOut.ts +56 -0
- package/src/modules/workspace/hooks/useOpenChangeRequests.ts +20 -0
- package/src/modules/workspace/hooks/useWorkspaceState.ts +123 -14
- package/src/modules/workspace/routing/__tests__/kb-routes.test.tsx +1 -1
- package/src/modules/workspace/services/workspace.api.ts +9 -2
- package/src/modules/workspace/state/open-change-requests.context.ts +35 -0
- package/src/modules/workspace/state/open-change-requests.tsx +185 -0
- package/src/modules/workspace/state/workspace.context.ts +9 -0
- package/src/modules/workspace/utils/__tests__/diff.test.ts +87 -0
- package/src/modules/workspace/utils/diff.ts +130 -53
- package/src/modules/workspace/utils/fileTree.ts +7 -4
- package/src/modules/workspace/workspace.css +28 -0
- package/src/shared/components/Badge.tsx +62 -0
- package/src/shared/components/Banner.tsx +58 -0
- package/src/shared/components/Button.tsx +90 -0
- package/src/shared/components/Dialog.tsx +6 -6
- package/src/shared/components/Field.tsx +45 -0
- package/src/shared/components/IconButton.tsx +74 -0
- package/src/shared/components/ListRow.tsx +96 -0
- package/src/shared/components/Menu.tsx +88 -0
- package/src/shared/components/PageShell.tsx +8 -5
- package/src/shared/components/Surface.tsx +86 -0
- package/src/shared/components/__tests__/primitives.test.tsx +333 -0
- package/src/shared/components/index.ts +48 -0
- package/src/shared/components/useDismissableMenu.ts +71 -0
- package/src/shared/theme/__tests__/accent-contrast.test.ts +84 -0
- package/src/shared/theme/index.css +12 -0
- package/src/shared/theme/measure.ts +64 -0
- package/src/shared/theme/shadows.css +34 -0
- package/src/shared/theme/tokens.css +193 -0
- package/src/test-setup.ts +9 -0
- package/src/modules/access/components/AccessRestrictedBanner.tsx +0 -31
- package/src/modules/access/components/NodeOwnersBanner.tsx +0 -30
- package/src/modules/git/__tests__/ProtectedBranchBanner.test.tsx +0 -82
- package/src/modules/git/components/ProtectedBranchBanner.tsx +0 -42
- package/src/modules/library/__tests__/DetailDialog.test.tsx +0 -200
- package/src/modules/library/__tests__/diff.test.ts +0 -62
- package/src/modules/library/__tests__/loadout.test.tsx +0 -72
- package/src/modules/library/components/CompareView.tsx +0 -357
- package/src/modules/library/components/DetailDialog.tsx +0 -566
- package/src/modules/library/components/GearIcon.tsx +0 -12
- package/src/modules/library/components/LoadoutSidebar.tsx +0 -156
- package/src/modules/library/components/StatusGem.tsx +0 -21
- package/src/modules/library/components/SuggestChange.tsx +0 -171
- package/src/modules/library/components/particles.ts +0 -50
- package/src/modules/library/state/loadout.tsx +0 -129
- package/src/modules/library/utils/diff.ts +0 -102
- package/src/modules/pr/__tests__/PrApprovalBadge.test.tsx +0 -93
- package/src/modules/pr/__tests__/PrCancelButton.test.tsx +0 -158
- package/src/modules/pr/__tests__/PrCancelConfirmDialog.test.tsx +0 -44
- package/src/modules/pr/__tests__/PrMergeButton.test.tsx +0 -360
- package/src/modules/pr/__tests__/bucketize-comments.test.ts +0 -85
- package/src/modules/pr/__tests__/parsePatch.test.ts +0 -104
- package/src/modules/pr/__tests__/usePrViewerState.test.ts +0 -72
- package/src/modules/pr/components/PrApprovalBadge.tsx +0 -80
- package/src/modules/pr/components/PrCancelButton.tsx +0 -99
- package/src/modules/pr/components/PrCancelConfirmDialog.tsx +0 -119
- package/src/modules/pr/components/PrCommentComposer.tsx +0 -92
- package/src/modules/pr/components/PrCommentThread.tsx +0 -168
- package/src/modules/pr/components/PrCommentsPanel.tsx +0 -143
- package/src/modules/pr/components/PrDiffPane.tsx +0 -425
- package/src/modules/pr/components/PrFileRow.tsx +0 -164
- package/src/modules/pr/components/PrFilesList.tsx +0 -53
- package/src/modules/pr/components/PrHeader.tsx +0 -45
- package/src/modules/pr/components/PrHeaderOverflowMenu.tsx +0 -58
- package/src/modules/pr/components/PrMergeButton.tsx +0 -268
- package/src/modules/pr/components/PrMergeConfirmDialog.tsx +0 -112
- package/src/modules/pr/components/PrRefreshFromTargetButton.tsx +0 -110
- package/src/modules/pr/components/PrViewer.tsx +0 -364
- package/src/modules/pr/hooks/usePrViewerState.ts +0 -150
- package/src/modules/pr/state/pr-viewer.context.ts +0 -34
- package/src/modules/pr/utils/bucketize-comments.ts +0 -55
- package/src/modules/pr/utils/parsePatch.ts +0 -57
- package/src/modules/toolbar/components/AdminMenu.tsx +0 -271
|
@@ -1,9 +1,6 @@
|
|
|
1
1
|
import { useState, useCallback, useEffect, useMemo, useRef, createContext, useContext } from 'react';
|
|
2
2
|
import {
|
|
3
|
-
Folder,
|
|
4
|
-
FolderOpen,
|
|
5
3
|
ChevronRight,
|
|
6
|
-
ChevronDown,
|
|
7
4
|
FilePlus,
|
|
8
5
|
FolderPlus,
|
|
9
6
|
FolderUp,
|
|
@@ -13,32 +10,74 @@ import {
|
|
|
13
10
|
X,
|
|
14
11
|
PackageOpen,
|
|
15
12
|
Download,
|
|
13
|
+
Link2,
|
|
16
14
|
Loader2,
|
|
17
15
|
Pin,
|
|
18
16
|
PinOff,
|
|
19
17
|
Users,
|
|
20
18
|
} from 'lucide-react';
|
|
21
|
-
import {
|
|
22
|
-
import type { FileTreeEntry } from '@bevel-software/platform-shared';
|
|
19
|
+
import type { FileTreeEntry, PullRequestSummary } from '@bevel-software/platform-shared';
|
|
23
20
|
import {
|
|
24
21
|
validateFilename,
|
|
25
22
|
KNOWLEDGE_BASE_DIR,
|
|
26
|
-
SKILLS_DIR,
|
|
27
|
-
TOOLS_DIR,
|
|
28
23
|
DATA_DIR,
|
|
24
|
+
GROUPS_DIR,
|
|
29
25
|
AGENTS_DIR,
|
|
30
26
|
PIPELINES_DIR,
|
|
31
27
|
} from '@bevel-software/platform-shared';
|
|
32
|
-
import { useWorkspace } from '../state/workspace.context';
|
|
33
|
-
import { mergePendingIntoTree, findKbRoot, KB_ROOT_DIRS } from '../utils/fileTree';
|
|
28
|
+
import { useWorkspace, type PendingEntry } from '../state/workspace.context';
|
|
29
|
+
import { mergePendingIntoTree, pathExistsInTree, findKbRoot, KB_ROOT_DIRS } from '../utils/fileTree';
|
|
30
|
+
import { ChangeRequestDialog } from '../../change-requests/components/ChangeRequestDialog';
|
|
31
|
+
import { PR_STALE_EVENT } from '../../../core/events';
|
|
34
32
|
import { snapshotEntries } from '../utils/readDroppedEntries';
|
|
35
33
|
import { useFileNav } from '../routing/kb-routes';
|
|
36
34
|
import { authFetch } from '../../../lib/api';
|
|
37
|
-
import {
|
|
35
|
+
import { cn } from '../../../lib/utils';
|
|
36
|
+
import { MenuPanel, MenuItem, TextField, IconButton } from '../../../shared/components';
|
|
37
|
+
import { useDismissableMenu } from '../../../shared/components';
|
|
38
|
+
import { useOpenChangeRequests } from '../hooks/useOpenChangeRequests';
|
|
38
39
|
import { PullRequestsForMe } from '../../git/components/PullRequestsForMe';
|
|
39
40
|
import { ManageAccessDialog } from '../../access/components/ManageAccessDialog';
|
|
40
41
|
import { useAppRegistry } from '../../../core/registry';
|
|
41
42
|
|
|
43
|
+
/**
|
|
44
|
+
* The tree row — the prototype's `.trow` (proto:684-693), and token for token
|
|
45
|
+
* the same string as the Library sidebar's `rowClass`
|
|
46
|
+
* (`GroupsSidebar.tsx:68-72`). Two sidebars in one app should not read as two
|
|
47
|
+
* different products, and the only way to guarantee that is for both to be
|
|
48
|
+
* this one declaration.
|
|
49
|
+
*
|
|
50
|
+
* Names and one caret, nothing else. The folder icon repeated what the caret
|
|
51
|
+
* already said and the file icon repeated what the extension already said;
|
|
52
|
+
* both stood where the name should start (proto:3552-3559).
|
|
53
|
+
*/
|
|
54
|
+
const ROW_CLASS =
|
|
55
|
+
'flex w-full items-center gap-1.5 rounded-sm px-2.5 py-1.5 text-left text-ui transition-colors';
|
|
56
|
+
const ROW_TONE = (current: boolean) =>
|
|
57
|
+
current ? 'bg-hover font-semibold text-ink' : 'text-ink-muted hover:bg-hover hover:text-ink';
|
|
58
|
+
|
|
59
|
+
/** Indent: `10 + depth * 13` (proto:3561). */
|
|
60
|
+
const indentFor = (depth: number) => 10 + depth * 13;
|
|
61
|
+
|
|
62
|
+
/**
|
|
63
|
+
* The caret's slot — 13px wide, and rendered EMPTY for a file and for a
|
|
64
|
+
* childless folder. It is what keeps a file's name in line with its siblings'
|
|
65
|
+
* once the icons are gone: the indent is the tree, so it has to survive them
|
|
66
|
+
* (proto:3571-3572).
|
|
67
|
+
*/
|
|
68
|
+
function CaretSlot({ open, show }: { open?: boolean; show: boolean }) {
|
|
69
|
+
return (
|
|
70
|
+
<span className="flex h-3.5 w-3.5 flex-none items-center justify-center text-ink-faint">
|
|
71
|
+
{show && (
|
|
72
|
+
<ChevronRight
|
|
73
|
+
size={13}
|
|
74
|
+
className={cn('transition-transform duration-150', open && 'rotate-90')}
|
|
75
|
+
/>
|
|
76
|
+
)}
|
|
77
|
+
</span>
|
|
78
|
+
);
|
|
79
|
+
}
|
|
80
|
+
|
|
42
81
|
// ── Pinned folders (client-side, localStorage) ──
|
|
43
82
|
|
|
44
83
|
const PINNED_STORAGE_KEY = 'bevel-pinned-folders';
|
|
@@ -73,6 +112,29 @@ const usePinned = () => useContext(PinnedContext);
|
|
|
73
112
|
const ManageAccessContext = createContext<(entry: FileTreeEntry) => void>(() => {});
|
|
74
113
|
const useManageAccess = () => useContext(ManageAccessContext);
|
|
75
114
|
|
|
115
|
+
/**
|
|
116
|
+
* The tree shows files from TWO places: this branch, and the caller's own
|
|
117
|
+
* open change requests. A path in this controller is the second kind — it was
|
|
118
|
+
* synthesized into the tree from `minePaths` because it does not exist on the
|
|
119
|
+
* branch — and its row renders differently and opens the change request,
|
|
120
|
+
* because there is no content here to open.
|
|
121
|
+
*
|
|
122
|
+
* Context, not props, for the same reason as the two above: the tree is
|
|
123
|
+
* recursive, and every intermediate directory would otherwise have to carry
|
|
124
|
+
* a concern that only file rows have.
|
|
125
|
+
*/
|
|
126
|
+
interface SuggestionsController {
|
|
127
|
+
/** CR number for a synthesized suggestion-only path; null for real files. */
|
|
128
|
+
crFor(path: string): number | null;
|
|
129
|
+
/** Open the shared change-request dialog on the request this path belongs to. */
|
|
130
|
+
open(path: string, crNumber: number): void;
|
|
131
|
+
}
|
|
132
|
+
const SuggestionsContext = createContext<SuggestionsController>({
|
|
133
|
+
crFor: () => null,
|
|
134
|
+
open: () => {},
|
|
135
|
+
});
|
|
136
|
+
const useSuggestions = () => useContext(SuggestionsContext);
|
|
137
|
+
|
|
76
138
|
/** Depth-first lookup of a tree entry by its exact relativePath. */
|
|
77
139
|
function findEntryByPath(node: FileTreeEntry, path: string): FileTreeEntry | null {
|
|
78
140
|
if (node.relativePath === path) return node;
|
|
@@ -96,6 +158,7 @@ function ContextMenu({
|
|
|
96
158
|
onCreateFolder,
|
|
97
159
|
onRename,
|
|
98
160
|
onDownload,
|
|
161
|
+
returnFocusTo,
|
|
99
162
|
}: {
|
|
100
163
|
x: number;
|
|
101
164
|
y: number;
|
|
@@ -106,26 +169,39 @@ function ContextMenu({
|
|
|
106
169
|
onCreateFolder?: () => void;
|
|
107
170
|
onRename?: () => void;
|
|
108
171
|
onDownload?: () => void;
|
|
172
|
+
/** The row this menu was opened from — Escape hands focus back to it. */
|
|
173
|
+
returnFocusTo?: React.RefObject<HTMLElement | null>;
|
|
109
174
|
}) {
|
|
110
175
|
const { deleteEntry, unzipHere } = useWorkspace();
|
|
111
176
|
const { isPinned, togglePin } = usePinned();
|
|
112
177
|
const openManageAccess = useManageAccess();
|
|
113
178
|
const pinned = isPinned(entry.relativePath);
|
|
114
|
-
const ref = useRef<HTMLDivElement>(null);
|
|
115
179
|
const [unzipping, setUnzipping] = useState(false);
|
|
180
|
+
// Outside-click, Escape, and focus return — none of which `MenuPanel`
|
|
181
|
+
// provides (it is presentation only, by design).
|
|
182
|
+
const ref = useDismissableMenu<HTMLDivElement>({ open: true, onClose, returnFocusTo });
|
|
116
183
|
|
|
117
184
|
// Only files whose name ends with `.zip` (case-insensitive) get the
|
|
118
185
|
// extraction affordance — matches the OS shell-extension behavior users
|
|
119
186
|
// already know from Windows Explorer / macOS Finder.
|
|
120
187
|
const isZip = entry.type === 'file' && /\.zip$/i.test(entry.name);
|
|
121
188
|
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
189
|
+
// The one prototype context-menu item the platform has never had
|
|
190
|
+
// (proto:3948). The page-level `⋯ → Copy path` does not cover it: that only
|
|
191
|
+
// ever reaches the file you have open, never a folder row or an unopened
|
|
192
|
+
// one. A clipboard write can be refused outright (a non-secure origin), and
|
|
193
|
+
// a silent no-op is the worst possible answer to "copy this" — so a refusal
|
|
194
|
+
// surfaces the same way every other failure in this tree does.
|
|
195
|
+
const handleCopyPath = async () => {
|
|
196
|
+
try {
|
|
197
|
+
await navigator.clipboard.writeText(entry.relativePath);
|
|
198
|
+
onClose();
|
|
199
|
+
} catch (err) {
|
|
200
|
+
console.error('Failed to copy path:', err);
|
|
201
|
+
onClose();
|
|
202
|
+
alert(`Couldn't copy the path to the clipboard.\n\n${entry.relativePath}`);
|
|
203
|
+
}
|
|
204
|
+
};
|
|
129
205
|
|
|
130
206
|
const handleDelete = async () => {
|
|
131
207
|
onClose();
|
|
@@ -168,88 +244,73 @@ function ContextMenu({
|
|
|
168
244
|
};
|
|
169
245
|
|
|
170
246
|
return (
|
|
247
|
+
// Positioning stays with the caller — `MenuPanel` is presentation only, so
|
|
248
|
+
// the fixed-to-the-pointer wrapper is ours and the panel inside is the
|
|
249
|
+
// shared one.
|
|
171
250
|
<div
|
|
172
251
|
ref={ref}
|
|
173
|
-
className="fixed z-50
|
|
252
|
+
className="fixed z-50"
|
|
174
253
|
style={{ left: x, top: y }}
|
|
175
254
|
onMouseDown={(e) => e.stopPropagation()}
|
|
176
255
|
>
|
|
256
|
+
<MenuPanel role="menu" aria-label={`Actions for ${entry.name}`} className="min-w-[180px]">
|
|
177
257
|
{onCreateFile && (
|
|
178
|
-
<
|
|
179
|
-
className="flex items-center gap-2
|
|
180
|
-
|
|
181
|
-
>
|
|
182
|
-
<FilePlus size={14} />
|
|
183
|
-
New file
|
|
184
|
-
</button>
|
|
258
|
+
<MenuItem role="menuitem" onClick={() => { onCreateFile(); onClose(); }}>
|
|
259
|
+
<span className="flex items-center gap-2"><FilePlus size={14} />New file</span>
|
|
260
|
+
</MenuItem>
|
|
185
261
|
)}
|
|
186
262
|
{onCreateFolder && (
|
|
187
|
-
<
|
|
188
|
-
className="flex items-center gap-2
|
|
189
|
-
|
|
190
|
-
>
|
|
191
|
-
<FolderPlus size={14} />
|
|
192
|
-
New folder
|
|
193
|
-
</button>
|
|
263
|
+
<MenuItem role="menuitem" onClick={() => { onCreateFolder(); onClose(); }}>
|
|
264
|
+
<span className="flex items-center gap-2"><FolderPlus size={14} />New folder</span>
|
|
265
|
+
</MenuItem>
|
|
194
266
|
)}
|
|
195
267
|
{isZip && (
|
|
196
|
-
<
|
|
197
|
-
className="flex items-center gap-2
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
{unzipping ? 'Unzipping…' : 'Unzip here'}
|
|
203
|
-
</button>
|
|
268
|
+
<MenuItem role="menuitem" onClick={handleUnzip} disabled={unzipping}>
|
|
269
|
+
<span className="flex items-center gap-2">
|
|
270
|
+
<PackageOpen size={14} />
|
|
271
|
+
{unzipping ? 'Unzipping…' : 'Unzip here'}
|
|
272
|
+
</span>
|
|
273
|
+
</MenuItem>
|
|
204
274
|
)}
|
|
205
275
|
{onDownload && (
|
|
206
|
-
<
|
|
207
|
-
className="flex items-center gap-2
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
</button>
|
|
276
|
+
<MenuItem role="menuitem" onClick={() => { onDownload(); onClose(); }}>
|
|
277
|
+
<span className="flex items-center gap-2">
|
|
278
|
+
<Download size={14} />
|
|
279
|
+
{entry.type === 'directory' ? 'Download as zip' : 'Download'}
|
|
280
|
+
</span>
|
|
281
|
+
</MenuItem>
|
|
213
282
|
)}
|
|
283
|
+
<MenuItem role="menuitem" onClick={handleCopyPath}>
|
|
284
|
+
<span className="flex items-center gap-2"><Link2 size={14} />Copy path</span>
|
|
285
|
+
</MenuItem>
|
|
214
286
|
{!isRoot && (
|
|
215
287
|
<>
|
|
216
|
-
<div className="my-1 border-t border-
|
|
217
|
-
<
|
|
218
|
-
className="flex items-center gap-2
|
|
219
|
-
|
|
220
|
-
>
|
|
221
|
-
<Users size={14} />
|
|
222
|
-
Manage access
|
|
223
|
-
</button>
|
|
288
|
+
<div className="my-1 border-t border-line" />
|
|
289
|
+
<MenuItem role="menuitem" onClick={() => { openManageAccess(entry); onClose(); }}>
|
|
290
|
+
<span className="flex items-center gap-2"><Users size={14} />Manage access</span>
|
|
291
|
+
</MenuItem>
|
|
224
292
|
</>
|
|
225
293
|
)}
|
|
226
294
|
{entry.type === 'directory' && !isRoot && (
|
|
227
|
-
<
|
|
228
|
-
className="flex items-center gap-2
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
</button>
|
|
295
|
+
<MenuItem role="menuitem" onClick={() => { togglePin(entry.relativePath); onClose(); }}>
|
|
296
|
+
<span className="flex items-center gap-2">
|
|
297
|
+
{pinned ? <PinOff size={14} /> : <Pin size={14} />}
|
|
298
|
+
{pinned ? 'Unpin' : 'Pin to top'}
|
|
299
|
+
</span>
|
|
300
|
+
</MenuItem>
|
|
234
301
|
)}
|
|
235
302
|
{!isRoot && onRename && (
|
|
236
|
-
<
|
|
237
|
-
className="flex items-center gap-2
|
|
238
|
-
|
|
239
|
-
>
|
|
240
|
-
<Pencil size={14} />
|
|
241
|
-
Rename
|
|
242
|
-
</button>
|
|
303
|
+
<MenuItem role="menuitem" onClick={() => { onRename(); onClose(); }}>
|
|
304
|
+
<span className="flex items-center gap-2"><Pencil size={14} />Rename</span>
|
|
305
|
+
</MenuItem>
|
|
243
306
|
)}
|
|
244
307
|
{!isRoot && (
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
>
|
|
249
|
-
<Trash2 size={14} />
|
|
250
|
-
Delete
|
|
251
|
-
</button>
|
|
308
|
+
// Danger tone comes from the primitive, not from a hand-written red.
|
|
309
|
+
<MenuItem role="menuitem" tone="danger" onClick={handleDelete}>
|
|
310
|
+
<span className="flex items-center gap-2"><Trash2 size={14} />Delete</span>
|
|
311
|
+
</MenuItem>
|
|
252
312
|
)}
|
|
313
|
+
</MenuPanel>
|
|
253
314
|
</div>
|
|
254
315
|
);
|
|
255
316
|
}
|
|
@@ -276,11 +337,9 @@ function InlineInput({
|
|
|
276
337
|
|
|
277
338
|
return (
|
|
278
339
|
<div className="w-full">
|
|
279
|
-
<
|
|
340
|
+
<TextField
|
|
280
341
|
autoFocus
|
|
281
|
-
className={
|
|
282
|
-
error ? 'border-red-500' : 'border-slate-300 focus:border-slate-400'
|
|
283
|
-
}`}
|
|
342
|
+
className={cn('bg-sunken px-2 py-0.5 text-detail', error && 'border-danger')}
|
|
284
343
|
placeholder={placeholder}
|
|
285
344
|
value={value}
|
|
286
345
|
onChange={(e) => setValue(e.target.value)}
|
|
@@ -293,10 +352,9 @@ function InlineInput({
|
|
|
293
352
|
else onCancel();
|
|
294
353
|
}}
|
|
295
354
|
title={error ?? undefined}
|
|
355
|
+
aria-invalid={error ? true : undefined}
|
|
296
356
|
/>
|
|
297
|
-
{error &&
|
|
298
|
-
<div className="text-[11px] text-red-700 mt-0.5 px-1">{error}</div>
|
|
299
|
-
)}
|
|
357
|
+
{error && <div className="mt-0.5 px-1 text-meta text-danger">{error}</div>}
|
|
300
358
|
</div>
|
|
301
359
|
);
|
|
302
360
|
}
|
|
@@ -326,11 +384,9 @@ function RenameInput({
|
|
|
326
384
|
|
|
327
385
|
return (
|
|
328
386
|
<div className="w-full">
|
|
329
|
-
<
|
|
387
|
+
<TextField
|
|
330
388
|
autoFocus
|
|
331
|
-
className={
|
|
332
|
-
error ? 'border-red-500' : 'border-slate-300 focus:border-slate-400'
|
|
333
|
-
}`}
|
|
389
|
+
className={cn('bg-sunken px-2 py-0.5 text-detail', error && 'border-danger')}
|
|
334
390
|
value={value}
|
|
335
391
|
onClick={(e) => e.stopPropagation()}
|
|
336
392
|
onMouseDown={(e) => e.stopPropagation()}
|
|
@@ -351,10 +407,9 @@ function RenameInput({
|
|
|
351
407
|
}
|
|
352
408
|
}}
|
|
353
409
|
title={error ?? undefined}
|
|
410
|
+
aria-invalid={error ? true : undefined}
|
|
354
411
|
/>
|
|
355
|
-
{error &&
|
|
356
|
-
<div className="text-[11px] text-red-700 mt-0.5 px-1">{error}</div>
|
|
357
|
-
)}
|
|
412
|
+
{error && <div className="mt-0.5 px-1 text-meta text-danger">{error}</div>}
|
|
358
413
|
</div>
|
|
359
414
|
);
|
|
360
415
|
}
|
|
@@ -367,7 +422,6 @@ function FileTreeNode({
|
|
|
367
422
|
entry,
|
|
368
423
|
depth,
|
|
369
424
|
initiallyExpanded,
|
|
370
|
-
accent,
|
|
371
425
|
collapseChildren,
|
|
372
426
|
}: {
|
|
373
427
|
entry: FileTreeEntry;
|
|
@@ -376,14 +430,15 @@ function FileTreeNode({
|
|
|
376
430
|
// The explorer's Knowledge/Skills roots use this so their own children start
|
|
377
431
|
// collapsed regardless of depth (auto-reveal on deep links still wins).
|
|
378
432
|
initiallyExpanded?: boolean;
|
|
379
|
-
// Green-tints the folder icon + label — used for the Knowledge / Skills roots.
|
|
380
|
-
accent?: boolean;
|
|
381
433
|
// When set, this node's direct children start collapsed (so opening Knowledge
|
|
382
434
|
// reveals the ontologies without cascading them all open).
|
|
383
435
|
collapseChildren?: boolean;
|
|
384
436
|
}) {
|
|
385
437
|
const { openFilePath, createFile, createDirectory, dispatchUpload, isUploading, moveEntry, workspaceId, pendingUploads } = useWorkspace();
|
|
386
438
|
const { openFile } = useFileNav();
|
|
439
|
+
// One shared fetch behind this — see `OpenChangeRequestsProvider`.
|
|
440
|
+
const openChangeRequests = useOpenChangeRequests();
|
|
441
|
+
const suggestions = useSuggestions();
|
|
387
442
|
|
|
388
443
|
const handleDownload = useCallback(async () => {
|
|
389
444
|
if (!workspaceId) return;
|
|
@@ -468,9 +523,14 @@ function FileTreeNode({
|
|
|
468
523
|
const [dragging, setDragging] = useState(false);
|
|
469
524
|
const [contextMenu, setContextMenu] = useState<{ x: number; y: number } | null>(null);
|
|
470
525
|
|
|
471
|
-
const paddingLeft =
|
|
526
|
+
const paddingLeft = indentFor(depth);
|
|
472
527
|
const isRoot = entry.relativePath === '.';
|
|
473
528
|
const isPending = pendingUploads.has(entry.relativePath);
|
|
529
|
+
// A folder with nothing in it doesn't get a caret, because there is nothing
|
|
530
|
+
// to open (proto:3565).
|
|
531
|
+
const hasChildren = (entry.children?.length ?? 0) > 0;
|
|
532
|
+
// Escape inside the context menu hands focus back to the row it came from.
|
|
533
|
+
const rowRef = useRef<HTMLButtonElement>(null);
|
|
474
534
|
|
|
475
535
|
// Auto-expand a directory whenever the open file lives inside it (so
|
|
476
536
|
// deep-link URLs reveal the file's row in the tree) or while files
|
|
@@ -578,9 +638,12 @@ function FileTreeNode({
|
|
|
578
638
|
return (
|
|
579
639
|
<div>
|
|
580
640
|
<div
|
|
581
|
-
className={
|
|
582
|
-
|
|
583
|
-
|
|
641
|
+
className={cn(
|
|
642
|
+
ROW_CLASS,
|
|
643
|
+
ROW_TONE(false),
|
|
644
|
+
'group',
|
|
645
|
+
dragOver && 'bg-hover text-ink ring-1 ring-accent/40',
|
|
646
|
+
)}
|
|
584
647
|
style={{ paddingLeft, opacity: dragging ? 0.5 : isPending ? 0.6 : 1 }}
|
|
585
648
|
draggable={!isRoot && !renaming && !isPending}
|
|
586
649
|
onDragStart={handleDragStart}
|
|
@@ -591,19 +654,13 @@ function FileTreeNode({
|
|
|
591
654
|
onContextMenu={handleContextMenu}
|
|
592
655
|
>
|
|
593
656
|
<button
|
|
594
|
-
|
|
595
|
-
|
|
657
|
+
ref={rowRef}
|
|
658
|
+
type="button"
|
|
659
|
+
aria-expanded={isExpanded}
|
|
660
|
+
className="flex min-w-0 flex-1 items-center gap-1.5 text-left"
|
|
661
|
+
onClick={() => { if (hasChildren) setUserIntent(!isExpanded); }}
|
|
596
662
|
>
|
|
597
|
-
{isExpanded
|
|
598
|
-
<ChevronDown size={14} className="text-slate-600 shrink-0" />
|
|
599
|
-
) : (
|
|
600
|
-
<ChevronRight size={14} className="text-slate-600 shrink-0" />
|
|
601
|
-
)}
|
|
602
|
-
{isExpanded ? (
|
|
603
|
-
<FolderOpen size={14} className={`shrink-0 ${accent ? 'text-emerald-600' : 'text-slate-600'}`} />
|
|
604
|
-
) : (
|
|
605
|
-
<Folder size={14} className={`shrink-0 ${accent ? 'text-emerald-600' : 'text-slate-600'}`} />
|
|
606
|
-
)}
|
|
663
|
+
<CaretSlot open={isExpanded} show={hasChildren} />
|
|
607
664
|
{renaming ? (
|
|
608
665
|
<RenameInput
|
|
609
666
|
currentName={entry.name}
|
|
@@ -627,13 +684,14 @@ function FileTreeNode({
|
|
|
627
684
|
onCancel={() => setRenaming(false)}
|
|
628
685
|
/>
|
|
629
686
|
) : (
|
|
630
|
-
<span className=
|
|
687
|
+
<span className="truncate">{entry.name}</span>
|
|
631
688
|
)}
|
|
632
689
|
</button>
|
|
633
|
-
<div className="hidden group-hover:flex group-focus-within:flex
|
|
634
|
-
<
|
|
635
|
-
|
|
690
|
+
<div className="hidden shrink-0 items-center gap-0.5 group-hover:flex group-focus-within:flex">
|
|
691
|
+
<IconButton
|
|
692
|
+
size={18}
|
|
636
693
|
title="New file"
|
|
694
|
+
aria-label={`New file in ${entry.name}`}
|
|
637
695
|
onClick={(e) => {
|
|
638
696
|
e.stopPropagation();
|
|
639
697
|
setUserIntent(true);
|
|
@@ -641,10 +699,11 @@ function FileTreeNode({
|
|
|
641
699
|
}}
|
|
642
700
|
>
|
|
643
701
|
<FilePlus size={13} />
|
|
644
|
-
</
|
|
645
|
-
<
|
|
646
|
-
|
|
702
|
+
</IconButton>
|
|
703
|
+
<IconButton
|
|
704
|
+
size={18}
|
|
647
705
|
title="New folder"
|
|
706
|
+
aria-label={`New folder in ${entry.name}`}
|
|
648
707
|
onClick={(e) => {
|
|
649
708
|
e.stopPropagation();
|
|
650
709
|
setUserIntent(true);
|
|
@@ -652,20 +711,19 @@ function FileTreeNode({
|
|
|
652
711
|
}}
|
|
653
712
|
>
|
|
654
713
|
<FolderPlus size={13} />
|
|
655
|
-
</
|
|
714
|
+
</IconButton>
|
|
656
715
|
</div>
|
|
657
716
|
{isRoot && (
|
|
658
717
|
<>
|
|
659
|
-
<
|
|
660
|
-
|
|
661
|
-
className="p-0.5 rounded hover:bg-slate-200 text-slate-600 hover:text-slate-900 disabled:opacity-50 disabled:cursor-not-allowed shrink-0"
|
|
718
|
+
<IconButton
|
|
719
|
+
size={18}
|
|
662
720
|
title="Add files"
|
|
663
721
|
aria-label="Add files"
|
|
664
722
|
disabled={isUploading}
|
|
665
723
|
onClick={handleRootUploadClick}
|
|
666
724
|
>
|
|
667
725
|
<Upload size={13} />
|
|
668
|
-
</
|
|
726
|
+
</IconButton>
|
|
669
727
|
<input
|
|
670
728
|
ref={rootFileInputRef}
|
|
671
729
|
type="file"
|
|
@@ -675,16 +733,15 @@ function FileTreeNode({
|
|
|
675
733
|
data-testid="file-explorer-file-input"
|
|
676
734
|
onChange={handleRootFileChange}
|
|
677
735
|
/>
|
|
678
|
-
<
|
|
679
|
-
|
|
680
|
-
className="p-0.5 rounded hover:bg-slate-200 text-slate-600 hover:text-slate-900 disabled:opacity-50 disabled:cursor-not-allowed shrink-0"
|
|
736
|
+
<IconButton
|
|
737
|
+
size={18}
|
|
681
738
|
title="Add folder"
|
|
682
739
|
aria-label="Add folder"
|
|
683
740
|
disabled={isUploading}
|
|
684
741
|
onClick={handleRootFolderClick}
|
|
685
742
|
>
|
|
686
743
|
<FolderUp size={13} />
|
|
687
|
-
</
|
|
744
|
+
</IconButton>
|
|
688
745
|
<input
|
|
689
746
|
ref={rootFolderInputRef}
|
|
690
747
|
type="file"
|
|
@@ -701,7 +758,10 @@ function FileTreeNode({
|
|
|
701
758
|
{isExpanded && (
|
|
702
759
|
<div>
|
|
703
760
|
{creating && (
|
|
704
|
-
|
|
761
|
+
// Line the input up with the child rows it is about to join:
|
|
762
|
+
// one more indent step (13px), plus the caret slot (13px) and
|
|
763
|
+
// the row gap (6px) the child's name starts after.
|
|
764
|
+
<div style={{ paddingLeft: paddingLeft + 32 }} className="px-2 py-0.5">
|
|
705
765
|
<InlineInput
|
|
706
766
|
placeholder={creating === 'file' ? 'filename' : 'folder name'}
|
|
707
767
|
onSubmit={async (name) => {
|
|
@@ -751,24 +811,58 @@ function FileTreeNode({
|
|
|
751
811
|
onCreateFolder={() => { setUserIntent(true); setCreating('directory'); }}
|
|
752
812
|
onRename={() => setRenaming(true)}
|
|
753
813
|
onDownload={handleDownload}
|
|
814
|
+
returnFocusTo={rowRef}
|
|
754
815
|
/>
|
|
755
816
|
)}
|
|
756
817
|
</div>
|
|
757
818
|
);
|
|
758
819
|
}
|
|
759
820
|
|
|
821
|
+
// A file from the caller's own open change request that does not exist on
|
|
822
|
+
// this branch. Its row is a LINK to the request, not a file: there is no
|
|
823
|
+
// content here to show, so clicking opens the change-request view, and none
|
|
824
|
+
// of the file affordances (rename, drag, download, context menu) apply —
|
|
825
|
+
// they would all 404 against a path this branch has never heard of. The
|
|
826
|
+
// accent colour is the tell that this is proposed, not present.
|
|
827
|
+
const suggestedCr = suggestions.crFor(entry.relativePath);
|
|
828
|
+
if (suggestedCr !== null) {
|
|
829
|
+
return (
|
|
830
|
+
<button
|
|
831
|
+
type="button"
|
|
832
|
+
className={cn(
|
|
833
|
+
ROW_CLASS,
|
|
834
|
+
'text-accent hover:bg-hover hover:text-accent-hover',
|
|
835
|
+
'focus-visible:outline-2 focus-visible:-outline-offset-1 focus-visible:outline-ink-muted',
|
|
836
|
+
)}
|
|
837
|
+
style={{ paddingLeft }}
|
|
838
|
+
onClick={() => suggestions.open(entry.relativePath, suggestedCr)}
|
|
839
|
+
title="Proposed by you: opens the change request"
|
|
840
|
+
>
|
|
841
|
+
<CaretSlot show={false} />
|
|
842
|
+
<span className="truncate">{entry.name}</span>
|
|
843
|
+
<span
|
|
844
|
+
aria-hidden
|
|
845
|
+
className="ml-auto h-1.5 w-1.5 flex-none rounded-full bg-accent"
|
|
846
|
+
/>
|
|
847
|
+
</button>
|
|
848
|
+
);
|
|
849
|
+
}
|
|
850
|
+
|
|
760
851
|
const isActive = entry.relativePath === openFilePath;
|
|
761
|
-
const iconName = getFileIcon(entry.name);
|
|
762
852
|
|
|
763
853
|
return (
|
|
764
854
|
<>
|
|
765
855
|
<button
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
856
|
+
ref={rowRef}
|
|
857
|
+
type="button"
|
|
858
|
+
aria-current={isActive}
|
|
859
|
+
className={cn(
|
|
860
|
+
ROW_CLASS,
|
|
861
|
+
ROW_TONE(isActive),
|
|
862
|
+
'focus-visible:outline-2 focus-visible:-outline-offset-1 focus-visible:outline-ink-muted',
|
|
863
|
+
isPending && 'cursor-progress',
|
|
864
|
+
)}
|
|
865
|
+
style={{ paddingLeft, opacity: dragging ? 0.5 : isPending ? 0.6 : 1 }}
|
|
772
866
|
draggable={!renaming && !isPending}
|
|
773
867
|
onDragStart={handleDragStart}
|
|
774
868
|
onDragEnd={handleDragEnd}
|
|
@@ -776,15 +870,15 @@ function FileTreeNode({
|
|
|
776
870
|
onContextMenu={handleContextMenu}
|
|
777
871
|
title={isPending ? 'Adding…' : undefined}
|
|
778
872
|
>
|
|
873
|
+
{/* The pending spinner is the one glyph that survives the icon cull,
|
|
874
|
+
because it says something no other part of the row says. It takes
|
|
875
|
+
the caret's slot so the name never shifts when it appears. */}
|
|
779
876
|
{isPending ? (
|
|
780
|
-
<
|
|
877
|
+
<span className="flex h-3.5 w-3.5 flex-none items-center justify-center">
|
|
878
|
+
<Loader2 size={13} className="animate-spin text-ink-faint" />
|
|
879
|
+
</span>
|
|
781
880
|
) : (
|
|
782
|
-
<
|
|
783
|
-
icon={`material-icon-theme:${iconName}`}
|
|
784
|
-
width={16}
|
|
785
|
-
height={16}
|
|
786
|
-
className="shrink-0"
|
|
787
|
-
/>
|
|
881
|
+
<CaretSlot show={false} />
|
|
788
882
|
)}
|
|
789
883
|
{renaming ? (
|
|
790
884
|
<RenameInput
|
|
@@ -811,6 +905,15 @@ function FileTreeNode({
|
|
|
811
905
|
) : (
|
|
812
906
|
<span className="truncate">{entry.name}</span>
|
|
813
907
|
)}
|
|
908
|
+
{/* News about a file you are not looking at (proto:692). Amber, not
|
|
909
|
+
the tab dot's accent: on a tab the dot marks the file you have
|
|
910
|
+
open; here it marks one you do not. */}
|
|
911
|
+
{openChangeRequests.paths.has(entry.relativePath) && (
|
|
912
|
+
<span
|
|
913
|
+
title="Open change request"
|
|
914
|
+
className="ml-auto h-1.5 w-1.5 flex-none rounded-full bg-wait-dot"
|
|
915
|
+
/>
|
|
916
|
+
)}
|
|
814
917
|
</button>
|
|
815
918
|
{contextMenu && (
|
|
816
919
|
<ContextMenu
|
|
@@ -821,6 +924,7 @@ function FileTreeNode({
|
|
|
821
924
|
onClose={() => setContextMenu(null)}
|
|
822
925
|
onRename={() => setRenaming(true)}
|
|
823
926
|
onDownload={handleDownload}
|
|
927
|
+
returnFocusTo={rowRef}
|
|
824
928
|
/>
|
|
825
929
|
)}
|
|
826
930
|
</>
|
|
@@ -841,7 +945,16 @@ function FileTreeNode({
|
|
|
841
945
|
// contributed explorer items.)
|
|
842
946
|
|
|
843
947
|
export function FileExplorer() {
|
|
844
|
-
const {
|
|
948
|
+
const {
|
|
949
|
+
fileTree,
|
|
950
|
+
kbDirName,
|
|
951
|
+
dispatchUpload,
|
|
952
|
+
uploadError,
|
|
953
|
+
clearUploadError,
|
|
954
|
+
uploadNotice,
|
|
955
|
+
clearUploadNotice,
|
|
956
|
+
pendingUploads,
|
|
957
|
+
} = useWorkspace();
|
|
845
958
|
const [dragOver, setDragOver] = useState(false);
|
|
846
959
|
// Download is now a per-path permission (resolved server-side from the
|
|
847
960
|
// access tree's `download:` verb), so there's no global preflight gate
|
|
@@ -850,11 +963,69 @@ export function FileExplorer() {
|
|
|
850
963
|
// and `handleDownload` shows the error.
|
|
851
964
|
// Optimistic overlay: every dropped/picked file shows up in the tree
|
|
852
965
|
// within a frame, even before its commit echoes back from the server.
|
|
853
|
-
const
|
|
966
|
+
const serverTree = useMemo(
|
|
854
967
|
() => (fileTree ? mergePendingIntoTree(fileTree, pendingUploads) : null),
|
|
855
968
|
[fileTree, pendingUploads],
|
|
856
969
|
);
|
|
857
970
|
|
|
971
|
+
// The caller's own proposed files that do NOT exist on this branch — they
|
|
972
|
+
// live only on the personal suggestions branch behind an open change
|
|
973
|
+
// request. The tree shows them beside the branch's real files (synthesized
|
|
974
|
+
// below), coloured differently, and clicking one opens the request.
|
|
975
|
+
const openChangeRequests = useOpenChangeRequests();
|
|
976
|
+
const suggestionOnlyPaths = useMemo(() => {
|
|
977
|
+
const map = new Map<string, number>();
|
|
978
|
+
if (!serverTree) return map;
|
|
979
|
+
/**
|
|
980
|
+
* "Not in the tree" has TWO causes, and only one earns a row: the file is
|
|
981
|
+
* new on the suggestions branch — or the server FILTERED it (.bevelignore,
|
|
982
|
+
* read gates). The client cannot evaluate those rules itself, but it can
|
|
983
|
+
* read their verdict off the tree: if the path's top-level folder under
|
|
984
|
+
* the repo root is absent, the whole subtree is hidden (a skill proposal
|
|
985
|
+
* under a bevelignored `Groups/` was the observed leak), so the overlay
|
|
986
|
+
* must not resurrect it. The known cost: a proposal that CREATES a new
|
|
987
|
+
* top-level root folder shows no row until it merges.
|
|
988
|
+
*/
|
|
989
|
+
const hiddenRoot = (path: string): boolean => {
|
|
990
|
+
const prefix = kbDirName && path.startsWith(`${kbDirName}/`) ? `${kbDirName}/` : '';
|
|
991
|
+
const segments = path.slice(prefix.length).split('/');
|
|
992
|
+
if (segments.length < 2) return false; // directly under the repo root
|
|
993
|
+
return !pathExistsInTree(serverTree, `${prefix}${segments[0]}`);
|
|
994
|
+
};
|
|
995
|
+
for (const [path, crNumber] of openChangeRequests.minePaths) {
|
|
996
|
+
if (!pathExistsInTree(serverTree, path) && !hiddenRoot(path)) {
|
|
997
|
+
map.set(path, crNumber);
|
|
998
|
+
}
|
|
999
|
+
}
|
|
1000
|
+
return map;
|
|
1001
|
+
}, [serverTree, openChangeRequests, kbDirName]);
|
|
1002
|
+
|
|
1003
|
+
const mergedTree = useMemo(() => {
|
|
1004
|
+
if (!serverTree || suggestionOnlyPaths.size === 0) return serverTree;
|
|
1005
|
+
// Reuses the pending-upload synthesizer: same parent-directory creation,
|
|
1006
|
+
// same sort order, and a real entry always wins over a synthesized one.
|
|
1007
|
+
const asEntries = new Map<string, PendingEntry>();
|
|
1008
|
+
for (const path of suggestionOnlyPaths.keys()) {
|
|
1009
|
+
asEntries.set(path, { fullPath: path, type: 'file' });
|
|
1010
|
+
}
|
|
1011
|
+
return mergePendingIntoTree(serverTree, asEntries);
|
|
1012
|
+
}, [serverTree, suggestionOnlyPaths]);
|
|
1013
|
+
|
|
1014
|
+
// A clicked suggestion row opens the SHARED change-request dialog on the
|
|
1015
|
+
// request the path belongs to — the row is a link to the request, and the
|
|
1016
|
+
// dialog is the one change-request view the app has.
|
|
1017
|
+
const [openSuggestionCr, setOpenSuggestionCr] = useState<PullRequestSummary | null>(null);
|
|
1018
|
+
const suggestionsController = useMemo<SuggestionsController>(
|
|
1019
|
+
() => ({
|
|
1020
|
+
crFor: (path) => suggestionOnlyPaths.get(path) ?? null,
|
|
1021
|
+
open: (path, crNumber) => {
|
|
1022
|
+
const cr = openChangeRequests.forPath(path).find((c) => c.number === crNumber) ?? null;
|
|
1023
|
+
setOpenSuggestionCr(cr);
|
|
1024
|
+
},
|
|
1025
|
+
}),
|
|
1026
|
+
[suggestionOnlyPaths, openChangeRequests],
|
|
1027
|
+
);
|
|
1028
|
+
|
|
858
1029
|
// Pinned folders — a personal, client-side shortcut list surfaced at the top
|
|
859
1030
|
// of the explorer. Stored as relativePaths in localStorage; toggled from the
|
|
860
1031
|
// right-click menu (Pin to top / Unpin).
|
|
@@ -895,14 +1066,24 @@ export function FileExplorer() {
|
|
|
895
1066
|
// Right-click → Manage access opens this sheet for the chosen entry.
|
|
896
1067
|
const [accessTarget, setAccessTarget] = useState<FileTreeEntry | null>(null);
|
|
897
1068
|
|
|
898
|
-
// KB content splits
|
|
899
|
-
//
|
|
900
|
-
//
|
|
901
|
-
//
|
|
902
|
-
//
|
|
903
|
-
//
|
|
904
|
-
//
|
|
905
|
-
//
|
|
1069
|
+
// KB content splits into separate top-level folders; surface them as labelled
|
|
1070
|
+
// sections rather than a single flat root. The Knowledge section hoists
|
|
1071
|
+
// `KnowledgeBase/`'s children and folds in any other top-level content folder
|
|
1072
|
+
// (e.g. a stray `Legal/`); loose top-level files (access.md, roles.yaml) sit
|
|
1073
|
+
// below a divider. Clones that predate the split (none of the well-known root
|
|
1074
|
+
// dirs) fall back to the flat tree.
|
|
1075
|
+
//
|
|
1076
|
+
// `Groups/` is NOT among them. It is the Skills & Tools app's storage — one
|
|
1077
|
+
// folder per group holding its skills and its tools — and that app presents
|
|
1078
|
+
// it as groups, skills and tools rather than as files. Listing it here too
|
|
1079
|
+
// offered a second, worse way in: raw markdown editing of a SKILL.md with
|
|
1080
|
+
// none of the surrounding affordances, on a folder whose access is managed
|
|
1081
|
+
// from the group page. Deep links into a group file still resolve; the
|
|
1082
|
+
// folder just is not a browsing destination in Knowledge.
|
|
1083
|
+
//
|
|
1084
|
+
// `Data/`, `Agents/` and `Pipelines/` are rendered when PRESENT but never
|
|
1085
|
+
// created by core (see `CORE_REQUIRED_DIRS`) — a deployment that owns the
|
|
1086
|
+
// agentic execution layer seeds them, and this reads whatever is there.
|
|
906
1087
|
const sections = useMemo(() => {
|
|
907
1088
|
// Descend past the workspace / KB-clone wrapper levels to the node that
|
|
908
1089
|
// actually holds the well-known root dirs, then split that level.
|
|
@@ -914,17 +1095,20 @@ export function FileExplorer() {
|
|
|
914
1095
|
const data = findDir(DATA_DIR);
|
|
915
1096
|
const agents = findDir(AGENTS_DIR);
|
|
916
1097
|
const pipelines = findDir(PIPELINES_DIR);
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
|
|
1098
|
+
// Groups counts toward "is this a split layout?" even though it is never
|
|
1099
|
+
// rendered: its presence proves the split just as well as the others, and
|
|
1100
|
+
// without it a KB whose only root is Groups would fail this check, fall
|
|
1101
|
+
// back to the flat tree, and show the folder that way instead.
|
|
1102
|
+
const groups = findDir(GROUPS_DIR);
|
|
1103
|
+
if (!knowledgeBase && !data && !agents && !pipelines && !groups) return null;
|
|
920
1104
|
// Any other top-level content folder (e.g. a stray `Legal/`) folds into Knowledge.
|
|
921
1105
|
const otherDirs = kids.filter(
|
|
922
1106
|
(c) => c.type === 'directory' && !KB_ROOT_DIRS.has(c.name),
|
|
923
1107
|
);
|
|
924
|
-
// Present Knowledge, Data
|
|
925
|
-
//
|
|
926
|
-
//
|
|
927
|
-
//
|
|
1108
|
+
// Present Knowledge, Data and Groups as named roots. Knowledge is
|
|
1109
|
+
// synthetic so it can relabel `KnowledgeBase` and absorb the stray
|
|
1110
|
+
// content folders; it reuses KnowledgeBase's own path so file ops on the
|
|
1111
|
+
// row still resolve.
|
|
928
1112
|
const knowledge: FileTreeEntry | null = knowledgeBase
|
|
929
1113
|
? {
|
|
930
1114
|
...knowledgeBase,
|
|
@@ -939,15 +1123,11 @@ export function FileExplorer() {
|
|
|
939
1123
|
const pipelinesRoot: FileTreeEntry | null = pipelines
|
|
940
1124
|
? { ...pipelines, name: PIPELINES_DIR }
|
|
941
1125
|
: null;
|
|
942
|
-
const skillsRoot: FileTreeEntry | null = skills ? { ...skills, name: SKILLS_DIR } : null;
|
|
943
|
-
const toolsRoot: FileTreeEntry | null = tools ? { ...tools, name: TOOLS_DIR } : null;
|
|
944
1126
|
return {
|
|
945
1127
|
knowledge,
|
|
946
1128
|
data: dataRoot,
|
|
947
1129
|
agents: agentsRoot,
|
|
948
1130
|
pipelines: pipelinesRoot,
|
|
949
|
-
skills: skillsRoot,
|
|
950
|
-
tools: toolsRoot,
|
|
951
1131
|
looseFiles: kids.filter((c) => c.type === 'file'),
|
|
952
1132
|
};
|
|
953
1133
|
}, [mergedTree]);
|
|
@@ -971,9 +1151,18 @@ export function FileExplorer() {
|
|
|
971
1151
|
|
|
972
1152
|
return (
|
|
973
1153
|
<>
|
|
974
|
-
|
|
975
|
-
|
|
976
|
-
|
|
1154
|
+
{/* No background, no border, no width: this is the CONTENTS of the app's
|
|
1155
|
+
one sidebar, and `SidebarFrame` is the sidebar. It used to be
|
|
1156
|
+
`bg-white` against the Library's `bg-sidebar`, which is how two navs in
|
|
1157
|
+
one app ended up looking like two apps. */}
|
|
1158
|
+
<div
|
|
1159
|
+
// The drop target. It was findable as `role="complementary"` while this
|
|
1160
|
+
// was the `<aside>`; the aside is `SidebarFrame`'s now, and a second
|
|
1161
|
+
// complementary nested inside the first would be a lie about the page's
|
|
1162
|
+
// landmarks.
|
|
1163
|
+
data-testid="file-explorer-root"
|
|
1164
|
+
className={`h-full w-full min-w-0 flex flex-col overflow-hidden ${
|
|
1165
|
+
dragOver ? 'ring-2 ring-inset ring-accent/40' : ''
|
|
977
1166
|
}`}
|
|
978
1167
|
onDrop={handleDrop}
|
|
979
1168
|
onDragOver={(e) => {
|
|
@@ -988,60 +1177,81 @@ export function FileExplorer() {
|
|
|
988
1177
|
{uploadError && (
|
|
989
1178
|
<div
|
|
990
1179
|
role="alert"
|
|
991
|
-
className="flex items-start gap-1 px-2 py-1 text-xs text-
|
|
1180
|
+
className="flex items-start gap-1 px-2 py-1 text-xs text-danger bg-danger-soft border-b border-danger/30 shrink-0"
|
|
992
1181
|
>
|
|
993
1182
|
<span className="flex-1 truncate" title={uploadError.reason}>
|
|
994
1183
|
Couldn't add {uploadError.filename}: {uploadError.reason}
|
|
995
1184
|
</span>
|
|
996
|
-
<
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
className="p-0.5 rounded hover:bg-red-100 text-red-600 hover:text-red-800 shrink-0"
|
|
1185
|
+
<IconButton
|
|
1186
|
+
size={18}
|
|
1187
|
+
tone="danger"
|
|
1000
1188
|
title="Dismiss"
|
|
1001
1189
|
aria-label="Dismiss upload error"
|
|
1190
|
+
onClick={clearUploadError}
|
|
1002
1191
|
>
|
|
1003
1192
|
<X size={12} />
|
|
1004
|
-
</
|
|
1193
|
+
</IconButton>
|
|
1194
|
+
</div>
|
|
1195
|
+
)}
|
|
1196
|
+
{/* Not an error: the upload LANDED, on the suggestions branch. Saying
|
|
1197
|
+
so is load-bearing — nothing appears in the tree where the user
|
|
1198
|
+
dropped the files, and silence there reads as a failed upload. */}
|
|
1199
|
+
{uploadNotice && (
|
|
1200
|
+
<div
|
|
1201
|
+
role="status"
|
|
1202
|
+
className="flex items-start gap-1 px-2 py-1 text-xs text-ink bg-wait-soft border-b border-line shrink-0"
|
|
1203
|
+
>
|
|
1204
|
+
<span className="flex-1" title={uploadNotice}>
|
|
1205
|
+
{uploadNotice}
|
|
1206
|
+
</span>
|
|
1207
|
+
<IconButton
|
|
1208
|
+
size={18}
|
|
1209
|
+
title="Dismiss"
|
|
1210
|
+
aria-label="Dismiss upload notice"
|
|
1211
|
+
onClick={clearUploadNotice}
|
|
1212
|
+
>
|
|
1213
|
+
<X size={12} />
|
|
1214
|
+
</IconButton>
|
|
1005
1215
|
</div>
|
|
1006
1216
|
)}
|
|
1007
1217
|
<PinnedContext.Provider value={pinnedController}>
|
|
1008
1218
|
<ManageAccessContext.Provider value={setAccessTarget}>
|
|
1009
|
-
<
|
|
1010
|
-
|
|
1011
|
-
|
|
1012
|
-
|
|
1219
|
+
<SuggestionsContext.Provider value={suggestionsController}>
|
|
1220
|
+
<div className="flex-1 overflow-y-auto min-h-0">
|
|
1221
|
+
{/* "Company Context", not "Pinned". The mechanism is pinning; the
|
|
1222
|
+
SECTION is the handful of places this company actually works out
|
|
1223
|
+
of. A label naming the mechanism tells you how the rows got there,
|
|
1224
|
+
which nobody is wondering — the useful heading says what they are.
|
|
1225
|
+
|
|
1226
|
+
Same padding as the Library's `SectionLabel`, because it is the
|
|
1227
|
+
same thing: a heading over a list of places. */}
|
|
1228
|
+
<div className="px-2.5 pb-1.5 text-label uppercase text-ink-faint">Company Context</div>
|
|
1013
1229
|
{pinnedEntries.map((e) => (
|
|
1014
1230
|
<FileTreeNode key={`pin:${e.relativePath}`} entry={e} depth={0} collapseChildren />
|
|
1015
1231
|
))}
|
|
1016
1232
|
{explorerItems.map(({ id, Component }) => (
|
|
1017
1233
|
<Component key={id} tree={mergedTree} />
|
|
1018
1234
|
))}
|
|
1019
|
-
<div className="mx-3 my-2 border-t border-
|
|
1235
|
+
<div className="mx-3 my-2 border-t border-line" />
|
|
1020
1236
|
{!mergedTree ? (
|
|
1021
|
-
<div className="px-3 py-4 text-xs text-
|
|
1237
|
+
<div className="px-3 py-4 text-xs text-ink-muted">Loading...</div>
|
|
1022
1238
|
) : sections ? (
|
|
1023
1239
|
<>
|
|
1024
1240
|
{sections.knowledge && (
|
|
1025
|
-
<FileTreeNode entry={sections.knowledge} depth={0}
|
|
1241
|
+
<FileTreeNode entry={sections.knowledge} depth={0} collapseChildren />
|
|
1026
1242
|
)}
|
|
1027
1243
|
{sections.data && (
|
|
1028
|
-
<FileTreeNode entry={sections.data} depth={0}
|
|
1244
|
+
<FileTreeNode entry={sections.data} depth={0} collapseChildren />
|
|
1029
1245
|
)}
|
|
1030
1246
|
{sections.agents && (
|
|
1031
|
-
<FileTreeNode entry={sections.agents} depth={0}
|
|
1247
|
+
<FileTreeNode entry={sections.agents} depth={0} collapseChildren />
|
|
1032
1248
|
)}
|
|
1033
1249
|
{sections.pipelines && (
|
|
1034
|
-
<FileTreeNode entry={sections.pipelines} depth={0}
|
|
1035
|
-
)}
|
|
1036
|
-
{sections.skills && (
|
|
1037
|
-
<FileTreeNode entry={sections.skills} depth={0} accent collapseChildren />
|
|
1038
|
-
)}
|
|
1039
|
-
{sections.tools && (
|
|
1040
|
-
<FileTreeNode entry={sections.tools} depth={0} accent collapseChildren />
|
|
1250
|
+
<FileTreeNode entry={sections.pipelines} depth={0} collapseChildren />
|
|
1041
1251
|
)}
|
|
1042
1252
|
{sections.looseFiles.length > 0 && (
|
|
1043
1253
|
<>
|
|
1044
|
-
<div className="mx-3 my-2 border-t border-
|
|
1254
|
+
<div className="mx-3 my-2 border-t border-line" />
|
|
1045
1255
|
{sections.looseFiles.map((c) => (
|
|
1046
1256
|
<FileTreeNode key={c.relativePath} entry={c} depth={0} />
|
|
1047
1257
|
))}
|
|
@@ -1052,14 +1262,28 @@ export function FileExplorer() {
|
|
|
1052
1262
|
<FileTreeNode entry={mergedTree} depth={0} />
|
|
1053
1263
|
)}
|
|
1054
1264
|
</div>
|
|
1265
|
+
</SuggestionsContext.Provider>
|
|
1055
1266
|
</ManageAccessContext.Provider>
|
|
1056
1267
|
</PinnedContext.Provider>
|
|
1057
1268
|
<PullRequestsForMe />
|
|
1058
|
-
</
|
|
1269
|
+
</div>
|
|
1270
|
+
{openSuggestionCr && (
|
|
1271
|
+
<ChangeRequestDialog
|
|
1272
|
+
cr={openSuggestionCr}
|
|
1273
|
+
onClose={() => setOpenSuggestionCr(null)}
|
|
1274
|
+
onResolved={() => {
|
|
1275
|
+
setOpenSuggestionCr(null);
|
|
1276
|
+
window.dispatchEvent(new Event(PR_STALE_EVENT));
|
|
1277
|
+
}}
|
|
1278
|
+
/>
|
|
1279
|
+
)}
|
|
1059
1280
|
{accessTarget && (
|
|
1060
1281
|
<ManageAccessDialog
|
|
1061
1282
|
key={accessTarget.relativePath}
|
|
1062
1283
|
entry={accessTarget}
|
|
1284
|
+
// The dialog is keyed on the path, so pointing it at a parent remounts
|
|
1285
|
+
// it against that folder — the whole retarget is this one setter.
|
|
1286
|
+
onManageAncestor={setAccessTarget}
|
|
1063
1287
|
onClose={() => setAccessTarget(null)}
|
|
1064
1288
|
/>
|
|
1065
1289
|
)}
|