@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,4 +1,6 @@
|
|
|
1
1
|
import type { PullRequestSummary } from '@bevel-software/platform-shared';
|
|
2
|
+
import { Badge } from '../../../shared/components';
|
|
3
|
+
import { changeAuthorName } from '../../change-requests/utils/author';
|
|
2
4
|
|
|
3
5
|
interface ChangeRequestDockProps {
|
|
4
6
|
crs: PullRequestSummary[];
|
|
@@ -6,42 +8,64 @@ interface ChangeRequestDockProps {
|
|
|
6
8
|
}
|
|
7
9
|
|
|
8
10
|
/**
|
|
9
|
-
* Owner-only panel
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
11
|
+
* Owner-only panel: a minimal name-list of the open change requests touching
|
|
12
|
+
* this skill — nothing else (approved design). Selecting one opens the
|
|
13
|
+
* side-by-side compare.
|
|
14
|
+
*
|
|
15
|
+
* It anchors to the VIEWPORT's right edge. It used to sit at
|
|
16
|
+
* `right: calc(50% + 22.5rem)` — left of a centred dialog — and when the skill
|
|
17
|
+
* detail became a page that put it on top of the group sidebar. A page has no
|
|
18
|
+
* centred panel to hang off, so the edge is the only stable anchor.
|
|
19
|
+
*
|
|
20
|
+
* Renders nothing when there is nothing to review: an empty box floating beside
|
|
21
|
+
* a skill states, permanently and to the one person who could act, that there
|
|
22
|
+
* is work here — when there isn't.
|
|
23
|
+
*
|
|
24
|
+
* It sits in the app's PAGE-FURNITURE band (`z-30`), not the overlay bands: it
|
|
25
|
+
* is ambient — always there while you read the skill — and nothing ambient may
|
|
26
|
+
* cover something the user just opened. The bands, as used across the app, are
|
|
27
|
+
* page content < 30 furniture < 40 anchored dropdowns < 50 modals < 60
|
|
28
|
+
* full-screen surfaces. `Toolbar` establishes no stacking context, so its
|
|
29
|
+
* `z-40` menus compete with this panel directly at the root: at its previous
|
|
30
|
+
* `z-55` the dock won, and the open profile menu was covered by a list of
|
|
31
|
+
* change requests (and so was any `z-50` dialog).
|
|
32
|
+
*
|
|
33
|
+
* An `<aside>`, not a div: `aria-label` on a generic element is DROPPED (a bare
|
|
34
|
+
* div has the implicit `generic` role, which takes no accessible name), so the
|
|
35
|
+
* label below was dead text and the panel was unreachable by landmark
|
|
36
|
+
* navigation. The name is also what keeps it one: `<aside>` nested inside the
|
|
37
|
+
* page's `<article>` degrades to `generic` UNLESS it is named, so the label and
|
|
38
|
+
* the element depend on each other — do not drop either.
|
|
14
39
|
*/
|
|
15
40
|
export function ChangeRequestDock({ crs, onSelect }: ChangeRequestDockProps) {
|
|
41
|
+
if (crs.length === 0) return null;
|
|
42
|
+
|
|
16
43
|
return (
|
|
17
|
-
<
|
|
18
|
-
className="lib-cr-dock fixed top-1/2 z-
|
|
19
|
-
style={{ right: 'calc(50% + 22.5rem)' }}
|
|
44
|
+
<aside
|
|
45
|
+
className="lib-cr-dock fixed right-6 top-1/2 z-30 flex max-h-[72vh] w-56 -translate-y-1/2 flex-col overflow-hidden rounded-2xl border border-line bg-surface shadow-overlay"
|
|
20
46
|
aria-label="Change requests for this skill"
|
|
21
47
|
>
|
|
22
|
-
<div className="flex items-center gap-2 px-4 pb-2.5 pt-3.5 text-
|
|
48
|
+
<div className="flex items-center gap-2 px-4 pb-2.5 pt-3.5 text-label font-semibold uppercase text-ink-muted">
|
|
23
49
|
Change requests
|
|
24
|
-
<
|
|
50
|
+
<Badge tone="wait" size="xs">
|
|
51
|
+
{crs.length}
|
|
52
|
+
</Badge>
|
|
25
53
|
</div>
|
|
26
54
|
<div className="flex flex-col gap-2 overflow-y-auto px-2.5 pb-3">
|
|
27
|
-
{crs.
|
|
28
|
-
<
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
</span>
|
|
41
|
-
</button>
|
|
42
|
-
))
|
|
43
|
-
)}
|
|
55
|
+
{crs.map((cr) => (
|
|
56
|
+
<button
|
|
57
|
+
key={cr.number}
|
|
58
|
+
type="button"
|
|
59
|
+
className="rounded-md border border-line bg-sunken px-3 py-2.5 text-left text-detail font-semibold text-ink transition-colors hover:border-line-strong"
|
|
60
|
+
onClick={() => onSelect(cr)}
|
|
61
|
+
>
|
|
62
|
+
{cr.title}
|
|
63
|
+
<span className="mt-0.5 block text-meta font-normal text-ink-faint">
|
|
64
|
+
{changeAuthorName(cr)}
|
|
65
|
+
</span>
|
|
66
|
+
</button>
|
|
67
|
+
))}
|
|
44
68
|
</div>
|
|
45
|
-
</
|
|
69
|
+
</aside>
|
|
46
70
|
);
|
|
47
71
|
}
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
import { useState } from 'react';
|
|
2
|
+
import { Banner, Button, Dialog } from '../../../shared/components';
|
|
3
|
+
import { deleteGroup } from '../services/groups.api';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* The "are you sure" a group deletion deserves — and it deserves a bigger one
|
|
7
|
+
* than a single skill's: this takes the folder, every skill and tool inside
|
|
8
|
+
* it, and the membership that made it appear in people's MCPs. The content
|
|
9
|
+
* survives only in git history.
|
|
10
|
+
*
|
|
11
|
+
* One dialog serves both openers (the sidebar's right-click and the group
|
|
12
|
+
* page's `⋯` menu), so the two surfaces cannot describe the same act in
|
|
13
|
+
* different words. Who may open it is the caller's decision (`isOwner` on the
|
|
14
|
+
* summary); the backend enforces the same verdict for real.
|
|
15
|
+
*/
|
|
16
|
+
export function DeleteGroupDialog({
|
|
17
|
+
name,
|
|
18
|
+
skillCount,
|
|
19
|
+
toolCount,
|
|
20
|
+
onClose,
|
|
21
|
+
onDeleted,
|
|
22
|
+
}: {
|
|
23
|
+
name: string;
|
|
24
|
+
/** The group's totals, for copy that says what is actually at stake. */
|
|
25
|
+
skillCount: number;
|
|
26
|
+
toolCount: number;
|
|
27
|
+
onClose(): void;
|
|
28
|
+
/** Fired after the delete lands; the host reloads and navigates away. */
|
|
29
|
+
onDeleted(): void;
|
|
30
|
+
}) {
|
|
31
|
+
const [busy, setBusy] = useState(false);
|
|
32
|
+
const [error, setError] = useState<string | null>(null);
|
|
33
|
+
|
|
34
|
+
const contents =
|
|
35
|
+
skillCount === 0 && toolCount === 0
|
|
36
|
+
? 'It has no skills or tools in it.'
|
|
37
|
+
: `Its ${[
|
|
38
|
+
skillCount > 0 ? `${skillCount} ${skillCount === 1 ? 'skill' : 'skills'}` : null,
|
|
39
|
+
toolCount > 0 ? `${toolCount} ${toolCount === 1 ? 'tool' : 'tools'}` : null,
|
|
40
|
+
]
|
|
41
|
+
.filter(Boolean)
|
|
42
|
+
.join(' and ')} go with it.`;
|
|
43
|
+
|
|
44
|
+
async function remove() {
|
|
45
|
+
setBusy(true);
|
|
46
|
+
setError(null);
|
|
47
|
+
try {
|
|
48
|
+
await deleteGroup(name);
|
|
49
|
+
onDeleted();
|
|
50
|
+
onClose();
|
|
51
|
+
} catch (err) {
|
|
52
|
+
// The backend's refusal names the rule (ownership, a refused push); a
|
|
53
|
+
// generic apology would hide the one thing worth reading.
|
|
54
|
+
setError(err instanceof Error ? err.message : "Couldn't delete the group.");
|
|
55
|
+
setBusy(false);
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
return (
|
|
60
|
+
<Dialog
|
|
61
|
+
open
|
|
62
|
+
onClose={onClose}
|
|
63
|
+
title={`Delete ${name}?`}
|
|
64
|
+
size="md"
|
|
65
|
+
busy={busy}
|
|
66
|
+
footer={
|
|
67
|
+
<>
|
|
68
|
+
<Button variant="quiet" onClick={onClose} disabled={busy}>
|
|
69
|
+
Cancel
|
|
70
|
+
</Button>
|
|
71
|
+
<Button variant="danger" onClick={() => void remove()} disabled={busy}>
|
|
72
|
+
{busy ? 'Deleting…' : 'Delete group'}
|
|
73
|
+
</Button>
|
|
74
|
+
</>
|
|
75
|
+
}
|
|
76
|
+
>
|
|
77
|
+
<p className="text-ui text-ink-muted">
|
|
78
|
+
{`This deletes the group for everyone in it. ${contents} Members lose it the next time their agent connects, and there is no undo — the content survives only in git history.`}
|
|
79
|
+
</p>
|
|
80
|
+
{error && (
|
|
81
|
+
<Banner tone="danger" role="alert" className="mt-3">
|
|
82
|
+
{error}
|
|
83
|
+
</Banner>
|
|
84
|
+
)}
|
|
85
|
+
</Dialog>
|
|
86
|
+
);
|
|
87
|
+
}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import type { ReactNode } from 'react';
|
|
2
|
+
import { ListRow } from '../../../shared/components';
|
|
3
|
+
|
|
4
|
+
export interface GroupIndexRowProps {
|
|
5
|
+
label: string;
|
|
6
|
+
/** Inline with the label — the `Owner` chip. */
|
|
7
|
+
badge?: ReactNode;
|
|
8
|
+
description?: string;
|
|
9
|
+
/** Right-aligned counts, e.g. `4 skills · 2 tools`. */
|
|
10
|
+
meta?: string;
|
|
11
|
+
/**
|
|
12
|
+
* After the counts: the amber attention count on a group you are in, or —
|
|
13
|
+
* on an "Ask to join" row — the `Locked` chip, which becomes `Requested`
|
|
14
|
+
* once the caller has a pending access request. A slot rather than a
|
|
15
|
+
* boolean, which is why those three states cost this file nothing.
|
|
16
|
+
*/
|
|
17
|
+
trailing?: ReactNode;
|
|
18
|
+
onOpen(): void;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* One row on the all-groups index — a group, or one of the two personal views.
|
|
23
|
+
*
|
|
24
|
+
* The whole row is the target, which is why it is a `<button>` and not a card
|
|
25
|
+
* with a link inside it: every row here means exactly one thing, "go there".
|
|
26
|
+
* Counts live in `meta` as plain text so the row's accessible name reads as the
|
|
27
|
+
* sentence it looks like ("GTM Run by Olga Ivanova 4 skills · 2 tools").
|
|
28
|
+
*/
|
|
29
|
+
export function GroupIndexRow({
|
|
30
|
+
label,
|
|
31
|
+
badge,
|
|
32
|
+
description,
|
|
33
|
+
meta,
|
|
34
|
+
trailing,
|
|
35
|
+
onOpen,
|
|
36
|
+
}: GroupIndexRowProps) {
|
|
37
|
+
return (
|
|
38
|
+
<ListRow
|
|
39
|
+
as="button"
|
|
40
|
+
density="row"
|
|
41
|
+
onClick={onOpen}
|
|
42
|
+
label={
|
|
43
|
+
badge ? (
|
|
44
|
+
<span className="flex items-center gap-2">
|
|
45
|
+
<span className="truncate">{label}</span>
|
|
46
|
+
{badge}
|
|
47
|
+
</span>
|
|
48
|
+
) : (
|
|
49
|
+
label
|
|
50
|
+
)
|
|
51
|
+
}
|
|
52
|
+
description={description}
|
|
53
|
+
meta={
|
|
54
|
+
meta || trailing ? (
|
|
55
|
+
<>
|
|
56
|
+
{meta && <span className="whitespace-nowrap tabular-nums">{meta}</span>}
|
|
57
|
+
{trailing}
|
|
58
|
+
</>
|
|
59
|
+
) : undefined
|
|
60
|
+
}
|
|
61
|
+
/>
|
|
62
|
+
);
|
|
63
|
+
}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { useEffect } from 'react';
|
|
2
|
+
import { useJoinRequests } from '../hooks/useJoinRequests';
|
|
3
|
+
import { AccessRequestsBanner } from './AccessRequestsBanner';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* One group's join requests, fetching their own data.
|
|
7
|
+
*
|
|
8
|
+
* A component rather than a hook call in each page because the gallery shows
|
|
9
|
+
* a banner per group the caller manages, and a hook cannot be called in a
|
|
10
|
+
* loop. Rendering one of these per group keeps that legal and gives the group
|
|
11
|
+
* page the identical surface for free.
|
|
12
|
+
*
|
|
13
|
+
* Render it only for groups the caller MANAGES: the endpoint answers `[]` to
|
|
14
|
+
* everyone else, so an ungated render is harmless but pointlessly chatty.
|
|
15
|
+
*/
|
|
16
|
+
export interface GroupJoinRequestsProps {
|
|
17
|
+
group: string;
|
|
18
|
+
/** The group's constituent folders — for the Manage-access affordance. */
|
|
19
|
+
folders: string[];
|
|
20
|
+
onManage(folder: string): void;
|
|
21
|
+
/**
|
|
22
|
+
* Bump to refetch. The pages raise it after the Manage-access dialog
|
|
23
|
+
* closes: granting there can settle a request, and this surface would
|
|
24
|
+
* otherwise keep offering proposals that have already landed until its
|
|
25
|
+
* next natural fetch.
|
|
26
|
+
*/
|
|
27
|
+
reloadSignal?: number;
|
|
28
|
+
className?: string;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
export function GroupJoinRequests({
|
|
32
|
+
group,
|
|
33
|
+
folders,
|
|
34
|
+
onManage,
|
|
35
|
+
reloadSignal = 0,
|
|
36
|
+
className,
|
|
37
|
+
}: GroupJoinRequestsProps) {
|
|
38
|
+
const requests = useJoinRequests(group, folders[0] ?? null);
|
|
39
|
+
const { reload } = requests;
|
|
40
|
+
|
|
41
|
+
useEffect(() => {
|
|
42
|
+
if (reloadSignal > 0) reload();
|
|
43
|
+
}, [reloadSignal, reload]);
|
|
44
|
+
|
|
45
|
+
return (
|
|
46
|
+
<AccessRequestsBanner
|
|
47
|
+
group={group}
|
|
48
|
+
folders={folders}
|
|
49
|
+
requests={requests.requests}
|
|
50
|
+
onManage={onManage}
|
|
51
|
+
onAccept={(r, p) => void requests.accept(r, p)}
|
|
52
|
+
onDecline={(r) => void requests.decline(r)}
|
|
53
|
+
className={className}
|
|
54
|
+
/>
|
|
55
|
+
);
|
|
56
|
+
}
|
|
@@ -0,0 +1,373 @@
|
|
|
1
|
+
import { useEffect, useMemo, useRef, useState } from 'react';
|
|
2
|
+
import { Link, useNavigate, useParams } from 'react-router-dom';
|
|
3
|
+
import { Banner, Button } from '../../../shared/components';
|
|
4
|
+
import { attentionOf, useLibrary, type LibraryItem } from '../state/library-data';
|
|
5
|
+
import { useLibraryToast } from '../state/toast.context';
|
|
6
|
+
import {
|
|
7
|
+
decodeGroupSegment,
|
|
8
|
+
pathForGroupsIndex,
|
|
9
|
+
urlForItemFile,
|
|
10
|
+
} from '../routes/library-paths';
|
|
11
|
+
import { primaryFolderOf } from '../utils/group-summary';
|
|
12
|
+
import { GroupJoinRequests } from './GroupJoinRequests';
|
|
13
|
+
import { useWorkspace } from '../../workspace/state/workspace.context';
|
|
14
|
+
import { ManageAccessDialog } from '../../access/components/ManageAccessDialog';
|
|
15
|
+
import { AddToGroupDialog } from './AddToGroupDialog';
|
|
16
|
+
import { BandControls, GroupBreadcrumb, GroupItemSections, PageNote, RemoveLibraryItemDialog,
|
|
17
|
+
} from './group-page-parts';
|
|
18
|
+
import { DeleteGroupDialog } from './DeleteGroupDialog';
|
|
19
|
+
import { PageActions } from './PageActions';
|
|
20
|
+
import { copyToClipboard } from '../utils/clipboard';
|
|
21
|
+
import { LockedGroupView } from './LockedGroupView';
|
|
22
|
+
import { PendingSkillReview } from './PendingSkillReview';
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* One group, as a place: `/skills-and-tools/groups/:group`.
|
|
26
|
+
*
|
|
27
|
+
* A group is a KB folder, so this page is the folder made legible — its skills
|
|
28
|
+
* and the tools those skills need, side by side, with who runs it and who it is
|
|
29
|
+
* shared with in one line above them. The sidebar and the gallery could already
|
|
30
|
+
* FILTER to a group; what they could not do is be linked to, bookmarked, or
|
|
31
|
+
* handed to somebody. That is the whole difference this page makes.
|
|
32
|
+
*
|
|
33
|
+
* WHICH VIEW: the page decides member-vs-locked, not the router and not the
|
|
34
|
+
* sidebar. The member view renders when the folder verdict says `canRead`, OR
|
|
35
|
+
* when the caller's catalog already contains an item in the group (a per-file
|
|
36
|
+
* grant can hand somebody one skill inside a folder they cannot read). Locked
|
|
37
|
+
* means: the summary says no AND the catalog agrees — which can only happen
|
|
38
|
+
* for a DISCOVERABLE group, because an undiscoverable one never reaches this
|
|
39
|
+
* page's data at all and renders like one that does not exist.
|
|
40
|
+
*/
|
|
41
|
+
export function GroupPage() {
|
|
42
|
+
const params = useParams();
|
|
43
|
+
const group = decodeGroupSegment(params.group ?? '');
|
|
44
|
+
const data = useLibrary();
|
|
45
|
+
const toast = useLibraryToast();
|
|
46
|
+
const navigate = useNavigate();
|
|
47
|
+
const { kbDirName } = useWorkspace();
|
|
48
|
+
const [addOpen, setAddOpen] = useState(false);
|
|
49
|
+
// The Skills band's two controls. `filterOn` narrows the band to what is
|
|
50
|
+
// waiting on the reader; `refresh` re-reads the catalog and then says when it
|
|
51
|
+
// last did, because "nothing changed" and "nothing was checked" otherwise
|
|
52
|
+
// look identical. Both are page state — neither belongs in the URL, since
|
|
53
|
+
// neither is a place you would link someone to.
|
|
54
|
+
const [filterOn, setFilterOn] = useState(false);
|
|
55
|
+
const [refreshState, setRefreshState] = useState<'idle' | 'spin' | 'done'>('idle');
|
|
56
|
+
/** Repo-relative folder whose `access.md` the Manage-access dialog is on. */
|
|
57
|
+
const [manageFolder, setManageFolder] = useState<string | null>(null);
|
|
58
|
+
/** Bumped when an access edit lands, so the join-request surface refetches. */
|
|
59
|
+
const [accessRevision, setAccessRevision] = useState(0);
|
|
60
|
+
/** The proposed skill being reviewed, if the reader opened one. */
|
|
61
|
+
const [reviewing, setReviewing] = useState<LibraryItem | null>(null);
|
|
62
|
+
|
|
63
|
+
/**
|
|
64
|
+
* "Last updated just now" has to be TRUE.
|
|
65
|
+
*
|
|
66
|
+
* Both refetches behind the refresh button are revision bumps that return
|
|
67
|
+
* `void` — there is no promise to await, so a timer was standing in for
|
|
68
|
+
* completion and would claim success while the catalog was still in flight,
|
|
69
|
+
* or after it had failed outright. The loads report themselves instead:
|
|
70
|
+
* `spin` ends the moment both have settled, and a failure returns the button
|
|
71
|
+
* rather than printing a freshness claim the page cannot back up (the error
|
|
72
|
+
* itself is surfaced by the gallery banner, which owns it).
|
|
73
|
+
*
|
|
74
|
+
* `sawLoading` is the part that is easy to leave out and wrong without: "both
|
|
75
|
+
* loads are settled" is also true of the instant BEFORE the refetch starts,
|
|
76
|
+
* and of an unrelated load that was already in flight settling first. So the
|
|
77
|
+
* spin only ends on a settle that FOLLOWS a loading phase this click caused.
|
|
78
|
+
* `reloadGroups()` raises `groupsLoading` synchronously, so that phase is
|
|
79
|
+
* guaranteed to be observed — and if it somehow were not, the button keeps
|
|
80
|
+
* spinning, which is the failure worth having.
|
|
81
|
+
*/
|
|
82
|
+
const sawLoading = useRef(false);
|
|
83
|
+
const spinning = refreshState === 'spin';
|
|
84
|
+
const loadsSettled = !data.loading && !data.groupsLoading;
|
|
85
|
+
useEffect(() => {
|
|
86
|
+
if (!spinning) return;
|
|
87
|
+
if (!loadsSettled) {
|
|
88
|
+
sawLoading.current = true;
|
|
89
|
+
return;
|
|
90
|
+
}
|
|
91
|
+
if (!sawLoading.current) return;
|
|
92
|
+
sawLoading.current = false;
|
|
93
|
+
setRefreshState(data.error || data.groupsError ? 'idle' : 'done');
|
|
94
|
+
}, [spinning, loadsSettled, data.error, data.groupsError]);
|
|
95
|
+
|
|
96
|
+
// The freshness line decays on its own — that one IS a clock, and it is the
|
|
97
|
+
// only timer left. Cleared on unmount rather than left to fire into a
|
|
98
|
+
// component that is gone.
|
|
99
|
+
useEffect(() => {
|
|
100
|
+
if (refreshState !== 'done') return;
|
|
101
|
+
const timer = window.setTimeout(() => setRefreshState('idle'), 4000);
|
|
102
|
+
return () => window.clearTimeout(timer);
|
|
103
|
+
}, [refreshState]);
|
|
104
|
+
|
|
105
|
+
/** The card being removed, while its confirm dialog is up. */
|
|
106
|
+
const [removing, setRemoving] = useState<LibraryItem | null>(null);
|
|
107
|
+
/** Whether the group's own delete confirmation is up. */
|
|
108
|
+
const [deleteOpen, setDeleteOpen] = useState(false);
|
|
109
|
+
|
|
110
|
+
const summary = useMemo(
|
|
111
|
+
() => data.groupSummaries.find((g) => g.name === group) ?? null,
|
|
112
|
+
[data.groupSummaries, group],
|
|
113
|
+
);
|
|
114
|
+
const groupItems = useMemo(
|
|
115
|
+
() => data.items.filter((i) => i.group === group),
|
|
116
|
+
[data.items, group],
|
|
117
|
+
);
|
|
118
|
+
/** For the add dialog's name check — global, because a skill's id is global. */
|
|
119
|
+
const allSkillNames = useMemo(
|
|
120
|
+
() => data.items.filter((i) => i.kind === 'skill').map((i) => i.name),
|
|
121
|
+
[data.items],
|
|
122
|
+
);
|
|
123
|
+
|
|
124
|
+
const skillItems = groupItems.filter((i) => i.kind === 'skill');
|
|
125
|
+
const toolItems = groupItems.filter((i) => i.kind === 'integration');
|
|
126
|
+
const attention = attentionOf(data.items, group);
|
|
127
|
+
// What the Skills band actually renders. The filter is a VIEW over the band,
|
|
128
|
+
// not a different query — flipping it back must show exactly what was there.
|
|
129
|
+
const shownSkills = filterOn ? skillItems.filter((i) => i.status.state !== 'ok') : skillItems;
|
|
130
|
+
|
|
131
|
+
/**
|
|
132
|
+
* Both kinds open a PAGE — `skills/:name` has landed, so the contract this
|
|
133
|
+
* function used to carry is discharged and the dialog is gone. Kept identical
|
|
134
|
+
* to `LibraryPage.openItem` on purpose: a card must do the same thing
|
|
135
|
+
* wherever you clicked it — including the proposed-skill case, which opens
|
|
136
|
+
* its change request because it has no page to open.
|
|
137
|
+
*/
|
|
138
|
+
function openItem(item: LibraryItem) {
|
|
139
|
+
if (item.pending) {
|
|
140
|
+
setReviewing(item);
|
|
141
|
+
return;
|
|
142
|
+
}
|
|
143
|
+
if (kbDirName) navigate(urlForItemFile(kbDirName, item.path));
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
/**
|
|
147
|
+
* THE access surface — one dialog, two openers: the title row's `Share` and
|
|
148
|
+
* the Manage-access affordances. There is deliberately no read-only sibling:
|
|
149
|
+
* the dialog itself degrades to read-only when the resolved verdict says the
|
|
150
|
+
* caller cannot write, so a second "view access" panel would be the same
|
|
151
|
+
* information twice.
|
|
152
|
+
*
|
|
153
|
+
* `kbDirName` gates it because the resolver addresses files repo-relative and
|
|
154
|
+
* the dialog strips that prefix — without it the path we would hand over is
|
|
155
|
+
* not the path we mean. Same guard the skill dialog uses.
|
|
156
|
+
*/
|
|
157
|
+
const manageDialog =
|
|
158
|
+
manageFolder && kbDirName ? (
|
|
159
|
+
<ManageAccessDialog
|
|
160
|
+
entry={{
|
|
161
|
+
name: manageFolder.split('/').pop() ?? manageFolder,
|
|
162
|
+
relativePath: `${kbDirName}/${manageFolder}`,
|
|
163
|
+
type: 'directory',
|
|
164
|
+
}}
|
|
165
|
+
onClose={() => {
|
|
166
|
+
setManageFolder(null);
|
|
167
|
+
// Granting through the dialog can settle a pending join request —
|
|
168
|
+
// refresh the roster, the catalog and the request surface together.
|
|
169
|
+
data.reloadGroups();
|
|
170
|
+
data.reload();
|
|
171
|
+
setAccessRevision((r) => r + 1);
|
|
172
|
+
}}
|
|
173
|
+
/>
|
|
174
|
+
) : null;
|
|
175
|
+
|
|
176
|
+
// Nothing has spoken yet: the catalog is still loading, the group index is
|
|
177
|
+
// still loading, and no item has proven the group exists. Deciding now would
|
|
178
|
+
// flash "doesn't exist" (or a locked splash) at somebody who is simply early.
|
|
179
|
+
if (groupItems.length === 0 && (data.loading || data.groupsLoading)) {
|
|
180
|
+
return <PageNote>Loading the library…</PageNote>;
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
if (summary && !summary.canRead && groupItems.length === 0) {
|
|
184
|
+
return (
|
|
185
|
+
<>
|
|
186
|
+
<LockedGroupView
|
|
187
|
+
group={summary}
|
|
188
|
+
onRequested={data.reloadGroups}
|
|
189
|
+
onUnlocked={() => {
|
|
190
|
+
data.reload();
|
|
191
|
+
data.reloadGroups();
|
|
192
|
+
}}
|
|
193
|
+
onManage={setManageFolder}
|
|
194
|
+
/>
|
|
195
|
+
{manageDialog}
|
|
196
|
+
</>
|
|
197
|
+
);
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
// No summary, no items, and the endpoint did NOT fail — the group really is
|
|
201
|
+
// not there. With a failed endpoint the honest answer is the degraded member
|
|
202
|
+
// view below, because "we couldn't ask" is not "it doesn't exist".
|
|
203
|
+
if (!summary && groupItems.length === 0 && !data.groupsError) {
|
|
204
|
+
return (
|
|
205
|
+
<div className="py-16 text-center">
|
|
206
|
+
<p className="text-ui text-ink-faint">{"This group doesn't exist yet."}</p>
|
|
207
|
+
<Link
|
|
208
|
+
to={pathForGroupsIndex()}
|
|
209
|
+
className="mt-2 inline-block rounded-xs text-ui font-semibold text-ink underline"
|
|
210
|
+
>
|
|
211
|
+
All groups
|
|
212
|
+
</Link>
|
|
213
|
+
</div>
|
|
214
|
+
);
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
const primaryFolder = summary ? primaryFolderOf(summary) : null;
|
|
218
|
+
|
|
219
|
+
return (
|
|
220
|
+
<div className="pb-14">
|
|
221
|
+
<GroupBreadcrumb name={group} />
|
|
222
|
+
|
|
223
|
+
{/* The title row carries the page's one persistent action. `Share` IS
|
|
224
|
+
the manage-access dialog — not a doorway to it. It stays un-gated:
|
|
225
|
+
for a non-writer the dialog renders read-only (its own `canWrite`
|
|
226
|
+
verdict decides), which is exactly what "who is this shared with?"
|
|
227
|
+
should answer. Hidden only when no folder is known to manage. */}
|
|
228
|
+
{/* Three actions, beside the title, for everyone (proto:3012-3025).
|
|
229
|
+
Share stays un-gated: for a non-writer the dialog renders read-only,
|
|
230
|
+
which is exactly what "who is this shared with?" should answer. */}
|
|
231
|
+
<div className="flex items-start justify-between gap-4">
|
|
232
|
+
<h1 className="mt-1.5 text-display font-semibold">{group}</h1>
|
|
233
|
+
<div className="mt-1.5">
|
|
234
|
+
<PageActions
|
|
235
|
+
onShare={primaryFolder ? () => setManageFolder(primaryFolder) : undefined}
|
|
236
|
+
onAdd={() => setAddOpen(true)}
|
|
237
|
+
onCopyLink={() => copyToClipboard(window.location.href)}
|
|
238
|
+
// The OWNER's verb — `isOwner` is the same verdict the DELETE
|
|
239
|
+
// route enforces, so the item appears for exactly the people the
|
|
240
|
+
// backend will let through.
|
|
241
|
+
onDelete={summary?.isOwner ? () => setDeleteOpen(true) : undefined}
|
|
242
|
+
addLabel={`Add a skill or tool to ${group}`}
|
|
243
|
+
/>
|
|
244
|
+
</div>
|
|
245
|
+
</div>
|
|
246
|
+
|
|
247
|
+
{/* Somebody is waiting on the person reading this. Rendered only for a
|
|
248
|
+
group manager (canWrite) — every member can see the CRs elsewhere,
|
|
249
|
+
but only the people who can act on a request get its banner. */}
|
|
250
|
+
{summary?.canWrite && (
|
|
251
|
+
<GroupJoinRequests
|
|
252
|
+
group={group}
|
|
253
|
+
folders={summary.folders}
|
|
254
|
+
onManage={setManageFolder}
|
|
255
|
+
reloadSignal={accessRevision}
|
|
256
|
+
className="mt-4"
|
|
257
|
+
/>
|
|
258
|
+
)}
|
|
259
|
+
|
|
260
|
+
{attention > 0 && (
|
|
261
|
+
<Banner role="status" tone="wait" className="mt-4">
|
|
262
|
+
<span>
|
|
263
|
+
{`${attention} ${
|
|
264
|
+
attention === 1
|
|
265
|
+
? 'integration needs setup: connect it'
|
|
266
|
+
: 'integrations need setup: connect them'
|
|
267
|
+
} to unblock this group's skills.`}
|
|
268
|
+
</span>{' '}
|
|
269
|
+
<Button variant="outline" size="tiny" onClick={() => navigate('/connect')}>
|
|
270
|
+
Finish setup
|
|
271
|
+
</Button>
|
|
272
|
+
</Banner>
|
|
273
|
+
)}
|
|
274
|
+
|
|
275
|
+
<GroupItemSections
|
|
276
|
+
skillItems={shownSkills}
|
|
277
|
+
toolItems={toolItems}
|
|
278
|
+
onOpen={openItem}
|
|
279
|
+
// Removal is the GROUP MANAGER's verb — the same canWrite that lets
|
|
280
|
+
// them answer join requests. The backend's per-path gate enforces it
|
|
281
|
+
// for real; this only decides who sees the affordance.
|
|
282
|
+
onRemove={summary?.canWrite ? setRemoving : undefined}
|
|
283
|
+
emptySkills={
|
|
284
|
+
filterOn
|
|
285
|
+
? 'Nothing in this band needs you right now.'
|
|
286
|
+
: `No skills yet. Add one, or ask your agent to write one for ${group}.`
|
|
287
|
+
}
|
|
288
|
+
// The band fades its controls until you hover it, and `opacity`
|
|
289
|
+
// composites — so "the filter stays lit when it is on" has to be said
|
|
290
|
+
// to the wrapper, not to the button inside it. Same for the spinner:
|
|
291
|
+
// a refresh you cannot see is one people click twice.
|
|
292
|
+
skillControlsActive={filterOn || refreshState !== 'idle'}
|
|
293
|
+
skillControls={
|
|
294
|
+
<BandControls
|
|
295
|
+
attention={attention}
|
|
296
|
+
filterOn={filterOn}
|
|
297
|
+
onToggleFilter={() => setFilterOn((v) => !v)}
|
|
298
|
+
refreshState={refreshState}
|
|
299
|
+
onRefresh={() => {
|
|
300
|
+
sawLoading.current = false;
|
|
301
|
+
setRefreshState('spin');
|
|
302
|
+
data.reload();
|
|
303
|
+
data.reloadGroups();
|
|
304
|
+
}}
|
|
305
|
+
/>
|
|
306
|
+
}
|
|
307
|
+
/>
|
|
308
|
+
|
|
309
|
+
{reviewing && (
|
|
310
|
+
<PendingSkillReview
|
|
311
|
+
item={reviewing}
|
|
312
|
+
onClose={() => setReviewing(null)}
|
|
313
|
+
onResolved={() => {
|
|
314
|
+
setReviewing(null);
|
|
315
|
+
// One reload moves it off the review shelf and into the catalog;
|
|
316
|
+
// the group index follows because its skill count just changed.
|
|
317
|
+
data.reload();
|
|
318
|
+
data.reloadGroups();
|
|
319
|
+
}}
|
|
320
|
+
/>
|
|
321
|
+
)}
|
|
322
|
+
|
|
323
|
+
{addOpen && summary && primaryFolder && (
|
|
324
|
+
<AddToGroupDialog
|
|
325
|
+
name={group}
|
|
326
|
+
primaryPath={primaryFolder}
|
|
327
|
+
canWrite={summary.canWrite}
|
|
328
|
+
// Every skill, not just this group's: a skill's id is its name and
|
|
329
|
+
// ids are global, so the collision that matters is with any of them.
|
|
330
|
+
existingSkills={allSkillNames}
|
|
331
|
+
onClose={() => setAddOpen(false)}
|
|
332
|
+
/>
|
|
333
|
+
)}
|
|
334
|
+
|
|
335
|
+
{deleteOpen && summary && (
|
|
336
|
+
<DeleteGroupDialog
|
|
337
|
+
name={group}
|
|
338
|
+
skillCount={summary.skillCount}
|
|
339
|
+
toolCount={summary.toolCount}
|
|
340
|
+
onClose={() => setDeleteOpen(false)}
|
|
341
|
+
onDeleted={() => {
|
|
342
|
+
toast(`Deleted ${group}.`);
|
|
343
|
+
// This page's place just ceased to exist — the index is the
|
|
344
|
+
// honest landing. Reloads follow so the sidebar agrees.
|
|
345
|
+
navigate(pathForGroupsIndex());
|
|
346
|
+
data.reload();
|
|
347
|
+
data.reloadGroups();
|
|
348
|
+
}}
|
|
349
|
+
/>
|
|
350
|
+
)}
|
|
351
|
+
|
|
352
|
+
{removing && (
|
|
353
|
+
<RemoveLibraryItemDialog
|
|
354
|
+
item={removing}
|
|
355
|
+
place={group}
|
|
356
|
+
onClose={() => setRemoving(null)}
|
|
357
|
+
onRemoved={() => {
|
|
358
|
+
toast(`Removed ${removing.name} from ${group}.`);
|
|
359
|
+
// Catalog for the card, group index for the counts.
|
|
360
|
+
data.reload();
|
|
361
|
+
data.reloadGroups();
|
|
362
|
+
}}
|
|
363
|
+
/>
|
|
364
|
+
)}
|
|
365
|
+
|
|
366
|
+
{manageDialog}
|
|
367
|
+
</div>
|
|
368
|
+
);
|
|
369
|
+
}
|
|
370
|
+
|
|
371
|
+
|
|
372
|
+
|
|
373
|
+
|