@bevel-software/platform-core-frontend 0.4.0 → 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 +130 -95
- 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 +114 -138
- 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 +172 -156
- 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 +361 -353
- 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 +104 -104
- 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 +210 -117
- 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 +71 -47
- 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 +153 -132
- package/src/modules/library/components/LibraryLayout.tsx +344 -0
- package/src/modules/library/components/LibraryPage.tsx +138 -254
- 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 +108 -320
- 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 +199 -116
- 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 +313 -276
- package/src/modules/secrets-vault/components/ToolSecretsPanel.tsx +109 -92
- package/src/modules/secrets-vault/components/__tests__/SecretsPage.test.tsx +82 -51
- 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 +131 -108
- package/src/modules/toolbar/components/ExternalAgentAccessPage.tsx +548 -548
- 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 +1292 -1068
- 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 +1312 -906
- 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 +182 -179
- 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 +54 -51
- 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
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
import { Banner, Button } from '../../../shared/components';
|
|
2
|
+
import { cn } from '../../../lib/utils';
|
|
3
|
+
import type { JoinProposal, JoinRequest } from '../services/groups.api';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Somebody asked to join this group — the manager-side face of a join change
|
|
7
|
+
* request.
|
|
8
|
+
*
|
|
9
|
+
* It shows what the request PROPOSES, one row per grant, because that is what
|
|
10
|
+
* accepting acts on: each Accept writes exactly that one grant onto the
|
|
11
|
+
* default branch through the ordinary access path. The request's branch is
|
|
12
|
+
* never merged, so a request naming five people can be answered with two
|
|
13
|
+
* yeses and three ignores, and nothing the branch happens to carry besides
|
|
14
|
+
* the grants can ride in on a click.
|
|
15
|
+
*
|
|
16
|
+
* Naming the verb is not pedantry: a request may propose `write` or `owner`
|
|
17
|
+
* rather than `read`, and "asked to join" would hide that. Whatever the
|
|
18
|
+
* branch asks for is what the row says.
|
|
19
|
+
*
|
|
20
|
+
* Decline rejects the whole request. Manage access is the third path — a
|
|
21
|
+
* manager who wants to do something other than what was proposed opens the
|
|
22
|
+
* dialog, and the request settles itself if that covers it.
|
|
23
|
+
*/
|
|
24
|
+
|
|
25
|
+
export interface AccessRequestsBannerProps {
|
|
26
|
+
group: string;
|
|
27
|
+
/** Repo-relative group folder for `Manage access` (single-element today). */
|
|
28
|
+
folders: string[];
|
|
29
|
+
requests: JoinRequest[];
|
|
30
|
+
onManage(folder: string): void;
|
|
31
|
+
onAccept(request: JoinRequest, proposal: JoinProposal): void;
|
|
32
|
+
onDecline(request: JoinRequest): void;
|
|
33
|
+
className?: string;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
export function AccessRequestsBanner({
|
|
37
|
+
group,
|
|
38
|
+
folders,
|
|
39
|
+
requests,
|
|
40
|
+
onManage,
|
|
41
|
+
onAccept,
|
|
42
|
+
onDecline,
|
|
43
|
+
className,
|
|
44
|
+
}: AccessRequestsBannerProps) {
|
|
45
|
+
if (requests.length === 0) return null;
|
|
46
|
+
|
|
47
|
+
return (
|
|
48
|
+
<Banner role="status" tone="wait" className={cn('mb-4', className)}>
|
|
49
|
+
<p>
|
|
50
|
+
{requests.length === 1
|
|
51
|
+
? `${requests[0].requesterName} asked to join ${group}.`
|
|
52
|
+
: `${requests.length} people asked to join ${group}.`}
|
|
53
|
+
</p>
|
|
54
|
+
|
|
55
|
+
<div className="mt-2 flex flex-col gap-2">
|
|
56
|
+
{requests.map((request) => (
|
|
57
|
+
<div key={request.number} className="flex flex-col gap-1">
|
|
58
|
+
{requests.length > 1 && (
|
|
59
|
+
<span className="text-meta font-semibold text-ink">{request.requesterName}</span>
|
|
60
|
+
)}
|
|
61
|
+
{request.proposals.map((proposal) => (
|
|
62
|
+
<div
|
|
63
|
+
key={`${proposal.verb}:${proposal.id}`}
|
|
64
|
+
className="flex flex-wrap items-center gap-2"
|
|
65
|
+
>
|
|
66
|
+
<span className="min-w-0 flex-1 truncate">
|
|
67
|
+
{proposal.label}: <span className="font-semibold">{proposal.verb}</span>
|
|
68
|
+
</span>
|
|
69
|
+
<Button
|
|
70
|
+
variant="outline"
|
|
71
|
+
size="sm"
|
|
72
|
+
aria-label={`Grant ${proposal.verb} to ${proposal.label}`}
|
|
73
|
+
onClick={() => onAccept(request, proposal)}
|
|
74
|
+
>
|
|
75
|
+
Accept
|
|
76
|
+
</Button>
|
|
77
|
+
</div>
|
|
78
|
+
))}
|
|
79
|
+
<div>
|
|
80
|
+
<Button
|
|
81
|
+
variant="quiet"
|
|
82
|
+
size="sm"
|
|
83
|
+
aria-label={`Decline the request from ${request.requesterName}`}
|
|
84
|
+
onClick={() => onDecline(request)}
|
|
85
|
+
>
|
|
86
|
+
Decline
|
|
87
|
+
</Button>
|
|
88
|
+
</div>
|
|
89
|
+
</div>
|
|
90
|
+
))}
|
|
91
|
+
{folders.map((folder) => (
|
|
92
|
+
<div key={folder}>
|
|
93
|
+
<Button variant="quiet" size="sm" onClick={() => onManage(folder)}>
|
|
94
|
+
Manage access
|
|
95
|
+
</Button>
|
|
96
|
+
</div>
|
|
97
|
+
))}
|
|
98
|
+
</div>
|
|
99
|
+
</Banner>
|
|
100
|
+
);
|
|
101
|
+
}
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
import { Button, Dialog, Surface } from '../../../shared/components';
|
|
2
|
+
import { useAdmin } from '../../admin/state/admin.context';
|
|
3
|
+
import { NewSkillPanel } from './NewSkillPanel';
|
|
4
|
+
import { useLibraryToast } from '../state/toast.context';
|
|
5
|
+
import { COPIED_TOAST, COPY_FAILED_TOAST, copyToClipboard } from '../utils/clipboard';
|
|
6
|
+
|
|
7
|
+
export interface AddToGroupDialogProps {
|
|
8
|
+
/** Group name — the folder segment, already decoded. */
|
|
9
|
+
name: string;
|
|
10
|
+
/** Repo-relative primary folder, e.g. `Groups/GTM`. */
|
|
11
|
+
primaryPath: string;
|
|
12
|
+
/**
|
|
13
|
+
* Whether the caller can write the folder. It changes the prompt's landing
|
|
14
|
+
* clause and, for an admin, whether an empty skill lands directly or goes
|
|
15
|
+
* through review. `null` (verdict not in yet) is treated as "not a writer":
|
|
16
|
+
* the cautious sentence is true either way, the confident one is not.
|
|
17
|
+
*/
|
|
18
|
+
canWrite: boolean | null;
|
|
19
|
+
/** Every skill name already in the catalog. The admin create half rejects collisions. */
|
|
20
|
+
existingSkills: string[];
|
|
21
|
+
onClose(): void;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* "Add a skill or tool to {group}" — the writer's half of the group page.
|
|
26
|
+
*
|
|
27
|
+
* The agent prompt is the path everyone gets. Admins also get the direct
|
|
28
|
+
* starter that creates an empty `SKILL.md`; non-admins do not. A placeholder
|
|
29
|
+
* is useful to an admin who can finish it directly, while a non-admin should
|
|
30
|
+
* send complete drafted content through the ordinary review flow.
|
|
31
|
+
*
|
|
32
|
+
* The prompt is the actual product here. It is copy-pasteable into the agent
|
|
33
|
+
* verbatim and it already knows the group, so nobody has to explain where the
|
|
34
|
+
* skill goes.
|
|
35
|
+
*
|
|
36
|
+
* The add button itself stays consistent for every role. What changes is the
|
|
37
|
+
* safe action inside it: non-admins can copy the prompt, and the prompt's last
|
|
38
|
+
* clause tells the truth about whether the resulting skill lands directly or
|
|
39
|
+
* arrives as a change request.
|
|
40
|
+
*/
|
|
41
|
+
export function AddToGroupDialog({
|
|
42
|
+
name,
|
|
43
|
+
primaryPath,
|
|
44
|
+
canWrite,
|
|
45
|
+
existingSkills,
|
|
46
|
+
onClose,
|
|
47
|
+
}: AddToGroupDialogProps) {
|
|
48
|
+
const { isAdmin } = useAdmin();
|
|
49
|
+
const toast = useLibraryToast();
|
|
50
|
+
|
|
51
|
+
// The only sentence in this dialog that varies by role.
|
|
52
|
+
const landing = canWrite
|
|
53
|
+
? 'I run it, so it goes in directly. No review step.'
|
|
54
|
+
: 'I am not an owner, so send it to the group as a change request for review.';
|
|
55
|
+
const prompt = `Help me build a new skill or tool and add it to the ${name} group at Bevel. ${landing}`;
|
|
56
|
+
|
|
57
|
+
async function copyPrompt() {
|
|
58
|
+
const copied = await copyToClipboard(prompt);
|
|
59
|
+
toast(copied ? COPIED_TOAST : COPY_FAILED_TOAST, copied ? 'neutral' : 'danger');
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
return (
|
|
63
|
+
<Dialog
|
|
64
|
+
open
|
|
65
|
+
onClose={onClose}
|
|
66
|
+
title={`Add a skill or tool to ${name}`}
|
|
67
|
+
footer={
|
|
68
|
+
<>
|
|
69
|
+
<Button variant="quiet" onClick={onClose}>
|
|
70
|
+
Close
|
|
71
|
+
</Button>
|
|
72
|
+
<Button variant="primary" onClick={() => void copyPrompt()}>
|
|
73
|
+
Copy prompt
|
|
74
|
+
</Button>
|
|
75
|
+
</>
|
|
76
|
+
}
|
|
77
|
+
>
|
|
78
|
+
<p className="text-ui text-ink-muted">
|
|
79
|
+
{isAdmin
|
|
80
|
+
? canWrite
|
|
81
|
+
? `Two ways in. Either way it joins ${name}. Everyone in the group gets it the next time their agent connects.`
|
|
82
|
+
: `Two ways in. Either way it goes to ${name} as a change request, and an owner reviews it before it joins.`
|
|
83
|
+
: canWrite
|
|
84
|
+
? `Use the prompt below to have your agent draft the skill and add it to ${name} for everyone in the group.`
|
|
85
|
+
: `Use the prompt below to have your agent draft the skill and send it to ${name} as a change request for an owner to review.`}
|
|
86
|
+
</p>
|
|
87
|
+
|
|
88
|
+
{isAdmin && (
|
|
89
|
+
<>
|
|
90
|
+
<NewSkillPanel
|
|
91
|
+
destination={{ parentPath: primaryPath, canWrite }}
|
|
92
|
+
existingSkills={existingSkills}
|
|
93
|
+
onCreated={onClose}
|
|
94
|
+
/>
|
|
95
|
+
|
|
96
|
+
<div className="my-3.5 flex items-center gap-3">
|
|
97
|
+
<span aria-hidden="true" className="h-px flex-1 bg-line" />
|
|
98
|
+
<span className="text-meta text-ink-faint">or</span>
|
|
99
|
+
<span aria-hidden="true" className="h-px flex-1 bg-line" />
|
|
100
|
+
</div>
|
|
101
|
+
</>
|
|
102
|
+
)}
|
|
103
|
+
|
|
104
|
+
{isAdmin && (
|
|
105
|
+
<p className="text-ui text-ink-muted">
|
|
106
|
+
{`Tell your agent what you need. It drafts the skill and adds it to ${name}.`}
|
|
107
|
+
</p>
|
|
108
|
+
)}
|
|
109
|
+
|
|
110
|
+
<Surface tone="sunken" radius="md" elevation="none" padded className="mt-2.5">
|
|
111
|
+
<p className="font-mono text-detail text-ink">{prompt}</p>
|
|
112
|
+
</Surface>
|
|
113
|
+
</Dialog>
|
|
114
|
+
);
|
|
115
|
+
}
|
|
@@ -1,47 +1,71 @@
|
|
|
1
|
-
import type { PullRequestSummary } from '@bevel-software/platform-shared';
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
1
|
+
import type { PullRequestSummary } from '@bevel-software/platform-shared';
|
|
2
|
+
import { Badge } from '../../../shared/components';
|
|
3
|
+
import { changeAuthorName } from '../../change-requests/utils/author';
|
|
4
|
+
|
|
5
|
+
interface ChangeRequestDockProps {
|
|
6
|
+
crs: PullRequestSummary[];
|
|
7
|
+
onSelect(cr: PullRequestSummary): void;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
/**
|
|
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.
|
|
39
|
+
*/
|
|
40
|
+
export function ChangeRequestDock({ crs, onSelect }: ChangeRequestDockProps) {
|
|
41
|
+
if (crs.length === 0) return null;
|
|
42
|
+
|
|
43
|
+
return (
|
|
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"
|
|
46
|
+
aria-label="Change requests for this skill"
|
|
47
|
+
>
|
|
48
|
+
<div className="flex items-center gap-2 px-4 pb-2.5 pt-3.5 text-label font-semibold uppercase text-ink-muted">
|
|
49
|
+
Change requests
|
|
50
|
+
<Badge tone="wait" size="xs">
|
|
51
|
+
{crs.length}
|
|
52
|
+
</Badge>
|
|
53
|
+
</div>
|
|
54
|
+
<div className="flex flex-col gap-2 overflow-y-auto px-2.5 pb-3">
|
|
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
|
+
))}
|
|
68
|
+
</div>
|
|
69
|
+
</aside>
|
|
70
|
+
);
|
|
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
|
+
}
|