agent-relay 2.0.21 → 2.0.23
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/bin/relay-pty-linux-arm64 +0 -0
- package/dist/src/cli/index.d.ts +3 -3
- package/dist/src/cli/index.js +31 -100
- package/package.json +22 -29
- package/packages/api-types/package.json +1 -1
- package/packages/bridge/package.json +8 -8
- package/packages/cli-tester/package.json +1 -1
- package/packages/cloud/dist/server.js +25 -4
- package/packages/cloud/package.json +6 -6
- package/packages/config/package.json +2 -2
- package/packages/continuity/package.json +1 -1
- package/packages/daemon/dist/orchestrator.js +21 -1
- package/packages/daemon/dist/router.d.ts +5 -0
- package/packages/daemon/dist/router.js +31 -0
- package/packages/daemon/dist/server.d.ts +5 -0
- package/packages/daemon/dist/server.js +131 -1
- package/packages/daemon/package.json +12 -12
- package/packages/hooks/package.json +4 -4
- package/packages/mcp/dist/client.d.ts +15 -0
- package/packages/mcp/dist/client.js +9 -0
- package/packages/mcp/dist/server.js +13 -1
- package/packages/mcp/dist/tools/index.d.ts +2 -0
- package/packages/mcp/dist/tools/index.js +2 -0
- package/packages/mcp/dist/tools/relay-connected.d.ts +17 -0
- package/packages/mcp/dist/tools/relay-connected.js +40 -0
- package/packages/mcp/dist/tools/relay-remove-agent.d.ts +20 -0
- package/packages/mcp/dist/tools/relay-remove-agent.js +50 -0
- package/packages/mcp/package.json +2 -2
- package/packages/memory/package.json +2 -2
- package/packages/policy/package.json +2 -2
- package/packages/protocol/dist/types.d.ts +46 -1
- package/packages/protocol/package.json +1 -1
- package/packages/resiliency/package.json +1 -1
- package/packages/sdk/dist/client.d.ts +22 -1
- package/packages/sdk/dist/client.js +31 -0
- package/packages/sdk/dist/protocol/index.d.ts +1 -1
- package/packages/sdk/dist/protocol/types.d.ts +35 -1
- package/packages/sdk/package.json +2 -2
- package/packages/spawner/package.json +1 -1
- package/packages/state/package.json +1 -1
- package/packages/storage/dist/adapter.d.ts +4 -0
- package/packages/storage/dist/sqlite-adapter.d.ts +10 -0
- package/packages/storage/dist/sqlite-adapter.js +26 -0
- package/packages/storage/package.json +2 -2
- package/packages/telemetry/package.json +1 -1
- package/packages/trajectory/package.json +2 -2
- package/packages/user-directory/package.json +2 -2
- package/packages/utils/dist/update-checker.js +4 -0
- package/packages/utils/package.json +1 -1
- package/packages/wrapper/package.json +6 -6
- package/deploy/workspace/codex.config.toml +0 -20
- package/deploy/workspace/entrypoint-browser.sh +0 -118
- package/deploy/workspace/entrypoint.sh +0 -612
- package/deploy/workspace/gh-credential-relay +0 -90
- package/deploy/workspace/gh-relay +0 -156
- package/deploy/workspace/git-credential-relay +0 -330
- package/deploy/workspace/git-credential-relay.test.sh +0 -230
- package/dist/dashboard/out/404.html +0 -1
- package/dist/dashboard/out/_next/static/7MZPqYkVGw3EGzVBkVmY9/_buildManifest.js +0 -1
- package/dist/dashboard/out/_next/static/7MZPqYkVGw3EGzVBkVmY9/_ssgManifest.js +0 -1
- package/dist/dashboard/out/_next/static/chunks/116-a883fca163f3a5bc.js +0 -1
- package/dist/dashboard/out/_next/static/chunks/117-c8afed19e821a35d.js +0 -2
- package/dist/dashboard/out/_next/static/chunks/282-980c2eb8fff20123.js +0 -1
- package/dist/dashboard/out/_next/static/chunks/320-a6304232cd0ee2ce.js +0 -1
- package/dist/dashboard/out/_next/static/chunks/532-bace199897eeab37.js +0 -9
- package/dist/dashboard/out/_next/static/chunks/631-16b905e5920f9b59.js +0 -1
- package/dist/dashboard/out/_next/static/chunks/648-acb2ff9f77cbfbd3.js +0 -1
- package/dist/dashboard/out/_next/static/chunks/766-2aea80818f7eb0d8.js +0 -1
- package/dist/dashboard/out/_next/static/chunks/83-26d2bde54616ee90.js +0 -1
- package/dist/dashboard/out/_next/static/chunks/847-f1f467060f32afff.js +0 -1
- package/dist/dashboard/out/_next/static/chunks/891-5cb1513eeb97a891.js +0 -1
- package/dist/dashboard/out/_next/static/chunks/app/_not-found/page-60501fddbafba9dc.js +0 -1
- package/dist/dashboard/out/_next/static/chunks/app/app/onboarding/page-9914652442f7e4fb.js +0 -1
- package/dist/dashboard/out/_next/static/chunks/app/app/page-366fb7c078d4e9e0.js +0 -1
- package/dist/dashboard/out/_next/static/chunks/app/cloud/link/page-fa1d5842aa90e8a6.js +0 -1
- package/dist/dashboard/out/_next/static/chunks/app/complete-profile/page-dd64bbdf66b639cd.js +0 -1
- package/dist/dashboard/out/_next/static/chunks/app/connect-repos/page-113060009ef35bc2.js +0 -1
- package/dist/dashboard/out/_next/static/chunks/app/history/page-9965d2483011b846.js +0 -1
- package/dist/dashboard/out/_next/static/chunks/app/layout-6b91e33784c20610.js +0 -1
- package/dist/dashboard/out/_next/static/chunks/app/login/page-435eceb0073be027.js +0 -1
- package/dist/dashboard/out/_next/static/chunks/app/metrics/page-1e37ef8e73940b40.js +0 -1
- package/dist/dashboard/out/_next/static/chunks/app/page-8119d4246743574e.js +0 -1
- package/dist/dashboard/out/_next/static/chunks/app/pricing/page-9db3ebdfa567a7c9.js +0 -1
- package/dist/dashboard/out/_next/static/chunks/app/providers/page-ecb16ffd3b36262b.js +0 -1
- package/dist/dashboard/out/_next/static/chunks/app/providers/setup/[provider]/page-4dbe33f0f7691b7c.js +0 -1
- package/dist/dashboard/out/_next/static/chunks/app/signup/page-c7a0a28341365ae0.js +0 -1
- package/dist/dashboard/out/_next/static/chunks/e868780c-48e5f147c90a3a41.js +0 -18
- package/dist/dashboard/out/_next/static/chunks/fd9d1056-609918ca7b6280bb.js +0 -1
- package/dist/dashboard/out/_next/static/chunks/framework-f66176bb897dc684.js +0 -1
- package/dist/dashboard/out/_next/static/chunks/main-311c3db74dcfadb7.js +0 -1
- package/dist/dashboard/out/_next/static/chunks/main-app-fdbeb09028f57c9f.js +0 -1
- package/dist/dashboard/out/_next/static/chunks/pages/_app-72b849fbd24ac258.js +0 -1
- package/dist/dashboard/out/_next/static/chunks/pages/_error-7ba65e1336b92748.js +0 -1
- package/dist/dashboard/out/_next/static/chunks/polyfills-42372ed130431b0a.js +0 -1
- package/dist/dashboard/out/_next/static/chunks/webpack-1cdd8ed57114d5e1.js +0 -1
- package/dist/dashboard/out/_next/static/css/4034f236dd1a3178.css +0 -1
- package/dist/dashboard/out/_next/static/css/6892f8422896ef7a.css +0 -1
- package/dist/dashboard/out/alt-logos/agent-relay-logo-128.png +0 -0
- package/dist/dashboard/out/alt-logos/agent-relay-logo-256.png +0 -0
- package/dist/dashboard/out/alt-logos/agent-relay-logo-32.png +0 -0
- package/dist/dashboard/out/alt-logos/agent-relay-logo-512.png +0 -0
- package/dist/dashboard/out/alt-logos/agent-relay-logo-64.png +0 -0
- package/dist/dashboard/out/alt-logos/agent-relay-logo.svg +0 -45
- package/dist/dashboard/out/alt-logos/logo.svg +0 -38
- package/dist/dashboard/out/alt-logos/monogram-logo-128.png +0 -0
- package/dist/dashboard/out/alt-logos/monogram-logo-256.png +0 -0
- package/dist/dashboard/out/alt-logos/monogram-logo-32.png +0 -0
- package/dist/dashboard/out/alt-logos/monogram-logo-512.png +0 -0
- package/dist/dashboard/out/alt-logos/monogram-logo-64.png +0 -0
- package/dist/dashboard/out/alt-logos/monogram-logo.svg +0 -38
- package/dist/dashboard/out/app/onboarding.html +0 -1
- package/dist/dashboard/out/app/onboarding.txt +0 -7
- package/dist/dashboard/out/app.html +0 -1
- package/dist/dashboard/out/app.txt +0 -7
- package/dist/dashboard/out/apple-icon.png +0 -0
- package/dist/dashboard/out/cloud/link.html +0 -1
- package/dist/dashboard/out/cloud/link.txt +0 -7
- package/dist/dashboard/out/complete-profile.html +0 -5
- package/dist/dashboard/out/complete-profile.txt +0 -7
- package/dist/dashboard/out/connect-repos.html +0 -1
- package/dist/dashboard/out/connect-repos.txt +0 -7
- package/dist/dashboard/out/history.html +0 -1
- package/dist/dashboard/out/history.txt +0 -7
- package/dist/dashboard/out/index.html +0 -1
- package/dist/dashboard/out/index.txt +0 -7
- package/dist/dashboard/out/login.html +0 -5
- package/dist/dashboard/out/login.txt +0 -7
- package/dist/dashboard/out/metrics.html +0 -1
- package/dist/dashboard/out/metrics.txt +0 -7
- package/dist/dashboard/out/pricing.html +0 -13
- package/dist/dashboard/out/pricing.txt +0 -7
- package/dist/dashboard/out/providers/setup/claude.html +0 -1
- package/dist/dashboard/out/providers/setup/claude.txt +0 -8
- package/dist/dashboard/out/providers/setup/codex.html +0 -1
- package/dist/dashboard/out/providers/setup/codex.txt +0 -8
- package/dist/dashboard/out/providers/setup/cursor.html +0 -1
- package/dist/dashboard/out/providers/setup/cursor.txt +0 -8
- package/dist/dashboard/out/providers.html +0 -1
- package/dist/dashboard/out/providers.txt +0 -7
- package/dist/dashboard/out/signup.html +0 -6
- package/dist/dashboard/out/signup.txt +0 -7
- package/dist/src/dashboard-server/index.d.ts +0 -8
- package/dist/src/dashboard-server/index.js +0 -8
- package/packages/dashboard/README.md +0 -48
- package/packages/dashboard/dist/health-worker-manager.d.ts +0 -62
- package/packages/dashboard/dist/health-worker-manager.js +0 -144
- package/packages/dashboard/dist/health-worker.d.ts +0 -9
- package/packages/dashboard/dist/health-worker.js +0 -79
- package/packages/dashboard/dist/index.d.ts +0 -20
- package/packages/dashboard/dist/index.js +0 -19
- package/packages/dashboard/dist/metrics.d.ts +0 -105
- package/packages/dashboard/dist/metrics.js +0 -193
- package/packages/dashboard/dist/needs-attention.d.ts +0 -24
- package/packages/dashboard/dist/needs-attention.js +0 -78
- package/packages/dashboard/dist/server.d.ts +0 -25
- package/packages/dashboard/dist/server.js +0 -5270
- package/packages/dashboard/dist/start.d.ts +0 -6
- package/packages/dashboard/dist/start.js +0 -13
- package/packages/dashboard/dist/types/threading.d.ts +0 -8
- package/packages/dashboard/dist/types/threading.js +0 -2
- package/packages/dashboard/dist/user-bridge.d.ts +0 -154
- package/packages/dashboard/dist/user-bridge.js +0 -372
- package/packages/dashboard/package.json +0 -65
- package/packages/dashboard/ui/app/app/onboarding/page.tsx +0 -394
- package/packages/dashboard/ui/app/app/page.tsx +0 -667
- package/packages/dashboard/ui/app/apple-icon.png +0 -0
- package/packages/dashboard/ui/app/cloud/link/page.tsx +0 -464
- package/packages/dashboard/ui/app/complete-profile/page.tsx +0 -204
- package/packages/dashboard/ui/app/connect-repos/page.tsx +0 -410
- package/packages/dashboard/ui/app/favicon.png +0 -0
- package/packages/dashboard/ui/app/globals.css +0 -59
- package/packages/dashboard/ui/app/history/page.tsx +0 -658
- package/packages/dashboard/ui/app/layout.tsx +0 -25
- package/packages/dashboard/ui/app/login/page.tsx +0 -424
- package/packages/dashboard/ui/app/metrics/page.tsx +0 -751
- package/packages/dashboard/ui/app/page.tsx +0 -59
- package/packages/dashboard/ui/app/pricing/page.tsx +0 -7
- package/packages/dashboard/ui/app/providers/page.tsx +0 -193
- package/packages/dashboard/ui/app/providers/setup/[provider]/ProviderSetupClient.tsx +0 -148
- package/packages/dashboard/ui/app/providers/setup/[provider]/constants.ts +0 -35
- package/packages/dashboard/ui/app/providers/setup/[provider]/page.tsx +0 -42
- package/packages/dashboard/ui/app/signup/page.tsx +0 -533
- package/packages/dashboard/ui/index.ts +0 -49
- package/packages/dashboard/ui/landing/LandingPage.tsx +0 -713
- package/packages/dashboard/ui/landing/PricingPage.tsx +0 -559
- package/packages/dashboard/ui/landing/index.ts +0 -6
- package/packages/dashboard/ui/landing/styles.css +0 -2850
- package/packages/dashboard/ui/lib/agent-merge.ts +0 -35
- package/packages/dashboard/ui/lib/api.ts +0 -1155
- package/packages/dashboard/ui/lib/cloudApi.ts +0 -877
- package/packages/dashboard/ui/lib/colors.ts +0 -218
- package/packages/dashboard/ui/lib/hierarchy.ts +0 -242
- package/packages/dashboard/ui/lib/stuckDetection.ts +0 -142
- package/packages/dashboard/ui/next-env.d.ts +0 -5
- package/packages/dashboard/ui/next.config.js +0 -41
- package/packages/dashboard/ui/package-lock.json +0 -2882
- package/packages/dashboard/ui/package.json +0 -33
- package/packages/dashboard/ui/postcss.config.js +0 -5
- package/packages/dashboard/ui/react-components/ActivityFeed.tsx +0 -216
- package/packages/dashboard/ui/react-components/AddWorkspaceModal.tsx +0 -170
- package/packages/dashboard/ui/react-components/AgentCard.tsx +0 -587
- package/packages/dashboard/ui/react-components/AgentList.tsx +0 -411
- package/packages/dashboard/ui/react-components/AgentProfilePanel.tsx +0 -564
- package/packages/dashboard/ui/react-components/App.tsx +0 -3033
- package/packages/dashboard/ui/react-components/BillingPanel.tsx +0 -922
- package/packages/dashboard/ui/react-components/BillingResult.tsx +0 -447
- package/packages/dashboard/ui/react-components/BroadcastComposer.tsx +0 -690
- package/packages/dashboard/ui/react-components/ChannelAdminPanel.tsx +0 -773
- package/packages/dashboard/ui/react-components/ChannelBrowser.tsx +0 -385
- package/packages/dashboard/ui/react-components/ChannelChat.tsx +0 -261
- package/packages/dashboard/ui/react-components/ChannelSidebar.tsx +0 -399
- package/packages/dashboard/ui/react-components/CloudSessionProvider.tsx +0 -130
- package/packages/dashboard/ui/react-components/CommandPalette.tsx +0 -815
- package/packages/dashboard/ui/react-components/ConfirmationDialog.tsx +0 -133
- package/packages/dashboard/ui/react-components/ConversationHistory.tsx +0 -518
- package/packages/dashboard/ui/react-components/CoordinatorPanel.tsx +0 -944
- package/packages/dashboard/ui/react-components/DecisionQueue.tsx +0 -717
- package/packages/dashboard/ui/react-components/DirectMessageView.tsx +0 -164
- package/packages/dashboard/ui/react-components/FileAutocomplete.tsx +0 -368
- package/packages/dashboard/ui/react-components/FleetOverview.tsx +0 -278
- package/packages/dashboard/ui/react-components/LogViewer.tsx +0 -310
- package/packages/dashboard/ui/react-components/LogViewerPanel.tsx +0 -482
- package/packages/dashboard/ui/react-components/Logo.tsx +0 -284
- package/packages/dashboard/ui/react-components/MentionAutocomplete.tsx +0 -384
- package/packages/dashboard/ui/react-components/MessageComposer.tsx +0 -457
- package/packages/dashboard/ui/react-components/MessageList.tsx +0 -649
- package/packages/dashboard/ui/react-components/MessageSenderName.tsx +0 -91
- package/packages/dashboard/ui/react-components/MessageStatusIndicator.tsx +0 -142
- package/packages/dashboard/ui/react-components/NewConversationModal.tsx +0 -400
- package/packages/dashboard/ui/react-components/NotificationToast.tsx +0 -488
- package/packages/dashboard/ui/react-components/OnlineUsersIndicator.tsx +0 -164
- package/packages/dashboard/ui/react-components/Pagination.tsx +0 -124
- package/packages/dashboard/ui/react-components/PricingPlans.tsx +0 -386
- package/packages/dashboard/ui/react-components/ProjectList.tsx +0 -625
- package/packages/dashboard/ui/react-components/ProviderAuthFlow.tsx +0 -853
- package/packages/dashboard/ui/react-components/ProviderConnectionList.tsx +0 -378
- package/packages/dashboard/ui/react-components/ProvisioningProgress.tsx +0 -730
- package/packages/dashboard/ui/react-components/RepoAccessPanel.tsx +0 -549
- package/packages/dashboard/ui/react-components/ServerCard.tsx +0 -202
- package/packages/dashboard/ui/react-components/SessionExpiredModal.tsx +0 -128
- package/packages/dashboard/ui/react-components/SpawnModal.tsx +0 -804
- package/packages/dashboard/ui/react-components/TaskAssignmentUI.tsx +0 -375
- package/packages/dashboard/ui/react-components/TerminalProviderSetup.tsx +0 -608
- package/packages/dashboard/ui/react-components/ThemeProvider.tsx +0 -325
- package/packages/dashboard/ui/react-components/ThinkingIndicator.tsx +0 -231
- package/packages/dashboard/ui/react-components/ThreadList.tsx +0 -198
- package/packages/dashboard/ui/react-components/ThreadPanel.tsx +0 -346
- package/packages/dashboard/ui/react-components/TrajectoryViewer.tsx +0 -698
- package/packages/dashboard/ui/react-components/TypingIndicator.tsx +0 -69
- package/packages/dashboard/ui/react-components/UsageBanner.tsx +0 -231
- package/packages/dashboard/ui/react-components/UserProfilePanel.tsx +0 -233
- package/packages/dashboard/ui/react-components/WorkspaceContext.tsx +0 -107
- package/packages/dashboard/ui/react-components/WorkspaceSelector.tsx +0 -234
- package/packages/dashboard/ui/react-components/WorkspaceStatusIndicator.tsx +0 -370
- package/packages/dashboard/ui/react-components/XTermInteractive.tsx +0 -510
- package/packages/dashboard/ui/react-components/XTermLogViewer.tsx +0 -719
- package/packages/dashboard/ui/react-components/channels/ChannelDialogs.tsx +0 -1411
- package/packages/dashboard/ui/react-components/channels/ChannelHeader.tsx +0 -317
- package/packages/dashboard/ui/react-components/channels/ChannelMessageList.tsx +0 -463
- package/packages/dashboard/ui/react-components/channels/ChannelViewV1.tsx +0 -146
- package/packages/dashboard/ui/react-components/channels/MessageInput.tsx +0 -288
- package/packages/dashboard/ui/react-components/channels/SearchInput.tsx +0 -172
- package/packages/dashboard/ui/react-components/channels/SearchResults.tsx +0 -336
- package/packages/dashboard/ui/react-components/channels/api.ts +0 -697
- package/packages/dashboard/ui/react-components/channels/index.ts +0 -76
- package/packages/dashboard/ui/react-components/channels/mockApi.ts +0 -344
- package/packages/dashboard/ui/react-components/channels/types.ts +0 -566
- package/packages/dashboard/ui/react-components/hooks/index.ts +0 -57
- package/packages/dashboard/ui/react-components/hooks/useAgentLogs.ts +0 -394
- package/packages/dashboard/ui/react-components/hooks/useAgents.ts +0 -127
- package/packages/dashboard/ui/react-components/hooks/useBroadcastDedup.ts +0 -86
- package/packages/dashboard/ui/react-components/hooks/useChannelAdmin.ts +0 -329
- package/packages/dashboard/ui/react-components/hooks/useChannelBrowser.ts +0 -239
- package/packages/dashboard/ui/react-components/hooks/useChannelCommands.ts +0 -138
- package/packages/dashboard/ui/react-components/hooks/useChannels.ts +0 -328
- package/packages/dashboard/ui/react-components/hooks/useDebounce.ts +0 -29
- package/packages/dashboard/ui/react-components/hooks/useDirectMessage.ts +0 -141
- package/packages/dashboard/ui/react-components/hooks/useMessages.ts +0 -309
- package/packages/dashboard/ui/react-components/hooks/useOrchestrator.ts +0 -364
- package/packages/dashboard/ui/react-components/hooks/usePinnedAgents.ts +0 -140
- package/packages/dashboard/ui/react-components/hooks/usePresence.ts +0 -340
- package/packages/dashboard/ui/react-components/hooks/useRecentRepos.ts +0 -130
- package/packages/dashboard/ui/react-components/hooks/useSession.ts +0 -209
- package/packages/dashboard/ui/react-components/hooks/useTrajectory.ts +0 -265
- package/packages/dashboard/ui/react-components/hooks/useWebSocket.ts +0 -169
- package/packages/dashboard/ui/react-components/hooks/useWorkspaceMembers.ts +0 -120
- package/packages/dashboard/ui/react-components/hooks/useWorkspaceRepos.ts +0 -73
- package/packages/dashboard/ui/react-components/hooks/useWorkspaceStatus.ts +0 -237
- package/packages/dashboard/ui/react-components/index.ts +0 -81
- package/packages/dashboard/ui/react-components/layout/Header.tsx +0 -355
- package/packages/dashboard/ui/react-components/layout/RepoContextHeader.tsx +0 -361
- package/packages/dashboard/ui/react-components/layout/Sidebar.archive.test.tsx +0 -126
- package/packages/dashboard/ui/react-components/layout/Sidebar.test.tsx +0 -691
- package/packages/dashboard/ui/react-components/layout/Sidebar.tsx +0 -930
- package/packages/dashboard/ui/react-components/layout/index.ts +0 -7
- package/packages/dashboard/ui/react-components/settings/BillingSettingsPanel.tsx +0 -564
- package/packages/dashboard/ui/react-components/settings/SettingsPage.tsx +0 -544
- package/packages/dashboard/ui/react-components/settings/TeamSettingsPanel.tsx +0 -560
- package/packages/dashboard/ui/react-components/settings/WorkspaceSettingsPanel.tsx +0 -1386
- package/packages/dashboard/ui/react-components/settings/index.ts +0 -11
- package/packages/dashboard/ui/react-components/settings/types.ts +0 -53
- package/packages/dashboard/ui/react-components/utils/messageFormatting.tsx +0 -370
- package/packages/dashboard/ui/tailwind.config.js +0 -148
- package/packages/dashboard/ui/types/index.ts +0 -304
- package/packages/dashboard/ui/types/threading.ts +0 -7
- package/packages/dashboard/ui-dist/404.html +0 -1
- package/packages/dashboard/ui-dist/_next/static/7MZPqYkVGw3EGzVBkVmY9/_buildManifest.js +0 -1
- package/packages/dashboard/ui-dist/_next/static/7MZPqYkVGw3EGzVBkVmY9/_ssgManifest.js +0 -1
- package/packages/dashboard/ui-dist/_next/static/chunks/116-a883fca163f3a5bc.js +0 -1
- package/packages/dashboard/ui-dist/_next/static/chunks/117-c8afed19e821a35d.js +0 -2
- package/packages/dashboard/ui-dist/_next/static/chunks/282-980c2eb8fff20123.js +0 -1
- package/packages/dashboard/ui-dist/_next/static/chunks/320-a6304232cd0ee2ce.js +0 -1
- package/packages/dashboard/ui-dist/_next/static/chunks/532-bace199897eeab37.js +0 -9
- package/packages/dashboard/ui-dist/_next/static/chunks/631-16b905e5920f9b59.js +0 -1
- package/packages/dashboard/ui-dist/_next/static/chunks/648-acb2ff9f77cbfbd3.js +0 -1
- package/packages/dashboard/ui-dist/_next/static/chunks/766-2aea80818f7eb0d8.js +0 -1
- package/packages/dashboard/ui-dist/_next/static/chunks/83-26d2bde54616ee90.js +0 -1
- package/packages/dashboard/ui-dist/_next/static/chunks/847-f1f467060f32afff.js +0 -1
- package/packages/dashboard/ui-dist/_next/static/chunks/891-5cb1513eeb97a891.js +0 -1
- package/packages/dashboard/ui-dist/_next/static/chunks/app/_not-found/page-60501fddbafba9dc.js +0 -1
- package/packages/dashboard/ui-dist/_next/static/chunks/app/app/onboarding/page-9914652442f7e4fb.js +0 -1
- package/packages/dashboard/ui-dist/_next/static/chunks/app/app/page-366fb7c078d4e9e0.js +0 -1
- package/packages/dashboard/ui-dist/_next/static/chunks/app/cloud/link/page-fa1d5842aa90e8a6.js +0 -1
- package/packages/dashboard/ui-dist/_next/static/chunks/app/complete-profile/page-dd64bbdf66b639cd.js +0 -1
- package/packages/dashboard/ui-dist/_next/static/chunks/app/connect-repos/page-113060009ef35bc2.js +0 -1
- package/packages/dashboard/ui-dist/_next/static/chunks/app/history/page-9965d2483011b846.js +0 -1
- package/packages/dashboard/ui-dist/_next/static/chunks/app/layout-6b91e33784c20610.js +0 -1
- package/packages/dashboard/ui-dist/_next/static/chunks/app/login/page-435eceb0073be027.js +0 -1
- package/packages/dashboard/ui-dist/_next/static/chunks/app/metrics/page-1e37ef8e73940b40.js +0 -1
- package/packages/dashboard/ui-dist/_next/static/chunks/app/page-8119d4246743574e.js +0 -1
- package/packages/dashboard/ui-dist/_next/static/chunks/app/pricing/page-9db3ebdfa567a7c9.js +0 -1
- package/packages/dashboard/ui-dist/_next/static/chunks/app/providers/page-ecb16ffd3b36262b.js +0 -1
- package/packages/dashboard/ui-dist/_next/static/chunks/app/providers/setup/[provider]/page-4dbe33f0f7691b7c.js +0 -1
- package/packages/dashboard/ui-dist/_next/static/chunks/app/signup/page-c7a0a28341365ae0.js +0 -1
- package/packages/dashboard/ui-dist/_next/static/chunks/e868780c-48e5f147c90a3a41.js +0 -18
- package/packages/dashboard/ui-dist/_next/static/chunks/fd9d1056-609918ca7b6280bb.js +0 -1
- package/packages/dashboard/ui-dist/_next/static/chunks/framework-f66176bb897dc684.js +0 -1
- package/packages/dashboard/ui-dist/_next/static/chunks/main-311c3db74dcfadb7.js +0 -1
- package/packages/dashboard/ui-dist/_next/static/chunks/main-app-fdbeb09028f57c9f.js +0 -1
- package/packages/dashboard/ui-dist/_next/static/chunks/pages/_app-72b849fbd24ac258.js +0 -1
- package/packages/dashboard/ui-dist/_next/static/chunks/pages/_error-7ba65e1336b92748.js +0 -1
- package/packages/dashboard/ui-dist/_next/static/chunks/polyfills-42372ed130431b0a.js +0 -1
- package/packages/dashboard/ui-dist/_next/static/chunks/webpack-1cdd8ed57114d5e1.js +0 -1
- package/packages/dashboard/ui-dist/_next/static/css/4034f236dd1a3178.css +0 -1
- package/packages/dashboard/ui-dist/_next/static/css/6892f8422896ef7a.css +0 -1
- package/packages/dashboard/ui-dist/_next/static/iJ3Uiz3IrqUJL7IxKZHiV/_buildManifest.js +0 -1
- package/packages/dashboard/ui-dist/_next/static/iJ3Uiz3IrqUJL7IxKZHiV/_ssgManifest.js +0 -1
- package/packages/dashboard/ui-dist/_next/static/l-jd878zUJ_IlraqEWMZc/_buildManifest.js +0 -1
- package/packages/dashboard/ui-dist/_next/static/l-jd878zUJ_IlraqEWMZc/_ssgManifest.js +0 -1
- package/packages/dashboard/ui-dist/alt-logos/agent-relay-logo-128.png +0 -0
- package/packages/dashboard/ui-dist/alt-logos/agent-relay-logo-256.png +0 -0
- package/packages/dashboard/ui-dist/alt-logos/agent-relay-logo-32.png +0 -0
- package/packages/dashboard/ui-dist/alt-logos/agent-relay-logo-512.png +0 -0
- package/packages/dashboard/ui-dist/alt-logos/agent-relay-logo-64.png +0 -0
- package/packages/dashboard/ui-dist/alt-logos/agent-relay-logo.svg +0 -45
- package/packages/dashboard/ui-dist/alt-logos/logo.svg +0 -38
- package/packages/dashboard/ui-dist/alt-logos/monogram-logo-128.png +0 -0
- package/packages/dashboard/ui-dist/alt-logos/monogram-logo-256.png +0 -0
- package/packages/dashboard/ui-dist/alt-logos/monogram-logo-32.png +0 -0
- package/packages/dashboard/ui-dist/alt-logos/monogram-logo-512.png +0 -0
- package/packages/dashboard/ui-dist/alt-logos/monogram-logo-64.png +0 -0
- package/packages/dashboard/ui-dist/alt-logos/monogram-logo.svg +0 -38
- package/packages/dashboard/ui-dist/app/onboarding.html +0 -1
- package/packages/dashboard/ui-dist/app/onboarding.txt +0 -7
- package/packages/dashboard/ui-dist/app.html +0 -1
- package/packages/dashboard/ui-dist/app.txt +0 -7
- package/packages/dashboard/ui-dist/apple-icon.png +0 -0
- package/packages/dashboard/ui-dist/cloud/link.html +0 -1
- package/packages/dashboard/ui-dist/cloud/link.txt +0 -7
- package/packages/dashboard/ui-dist/complete-profile.html +0 -5
- package/packages/dashboard/ui-dist/complete-profile.txt +0 -7
- package/packages/dashboard/ui-dist/connect-repos.html +0 -1
- package/packages/dashboard/ui-dist/connect-repos.txt +0 -7
- package/packages/dashboard/ui-dist/history.html +0 -1
- package/packages/dashboard/ui-dist/history.txt +0 -7
- package/packages/dashboard/ui-dist/index.html +0 -1
- package/packages/dashboard/ui-dist/index.txt +0 -7
- package/packages/dashboard/ui-dist/login.html +0 -5
- package/packages/dashboard/ui-dist/login.txt +0 -7
- package/packages/dashboard/ui-dist/metrics.html +0 -1
- package/packages/dashboard/ui-dist/metrics.txt +0 -7
- package/packages/dashboard/ui-dist/pricing.html +0 -13
- package/packages/dashboard/ui-dist/pricing.txt +0 -7
- package/packages/dashboard/ui-dist/providers/setup/claude.html +0 -1
- package/packages/dashboard/ui-dist/providers/setup/claude.txt +0 -8
- package/packages/dashboard/ui-dist/providers/setup/codex.html +0 -1
- package/packages/dashboard/ui-dist/providers/setup/codex.txt +0 -8
- package/packages/dashboard/ui-dist/providers/setup/cursor.html +0 -1
- package/packages/dashboard/ui-dist/providers/setup/cursor.txt +0 -8
- package/packages/dashboard/ui-dist/providers.html +0 -1
- package/packages/dashboard/ui-dist/providers.txt +0 -7
- package/packages/dashboard/ui-dist/signup.html +0 -6
- package/packages/dashboard/ui-dist/signup.txt +0 -7
- package/packages/dashboard-server/dist/health-worker-manager.d.ts +0 -62
- package/packages/dashboard-server/dist/health-worker-manager.js +0 -144
- package/packages/dashboard-server/dist/health-worker.d.ts +0 -9
- package/packages/dashboard-server/dist/health-worker.js +0 -79
- package/packages/dashboard-server/dist/index.d.ts +0 -18
- package/packages/dashboard-server/dist/index.js +0 -17
- package/packages/dashboard-server/dist/metrics.d.ts +0 -105
- package/packages/dashboard-server/dist/metrics.js +0 -193
- package/packages/dashboard-server/dist/needs-attention.d.ts +0 -24
- package/packages/dashboard-server/dist/needs-attention.js +0 -78
- package/packages/dashboard-server/dist/server.d.ts +0 -25
- package/packages/dashboard-server/dist/server.js +0 -5158
- package/packages/dashboard-server/dist/start.d.ts +0 -6
- package/packages/dashboard-server/dist/start.js +0 -13
- package/packages/dashboard-server/dist/types/threading.d.ts +0 -8
- package/packages/dashboard-server/dist/types/threading.js +0 -2
- package/packages/dashboard-server/dist/user-bridge.d.ts +0 -158
- package/packages/dashboard-server/dist/user-bridge.js +0 -390
- package/packages/dashboard-server/package.json +0 -55
|
@@ -1,1411 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Channel Dialogs
|
|
3
|
-
*
|
|
4
|
-
* Confirmation dialogs for channel actions:
|
|
5
|
-
* - Archive channel
|
|
6
|
-
* - Delete channel
|
|
7
|
-
* - Leave channel
|
|
8
|
-
* - Create channel modal
|
|
9
|
-
*/
|
|
10
|
-
|
|
11
|
-
import React, { useState, useCallback, useEffect } from 'react';
|
|
12
|
-
import type { Channel, ChannelVisibility, CreateChannelRequest } from './types';
|
|
13
|
-
import { getAvailableMembers, type AvailableMember } from './api';
|
|
14
|
-
|
|
15
|
-
// =============================================================================
|
|
16
|
-
// Archive Channel Dialog
|
|
17
|
-
// =============================================================================
|
|
18
|
-
|
|
19
|
-
export interface ArchiveChannelDialogProps {
|
|
20
|
-
channel: Channel;
|
|
21
|
-
isOpen: boolean;
|
|
22
|
-
onClose: () => void;
|
|
23
|
-
onConfirm: () => void;
|
|
24
|
-
isLoading?: boolean;
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
export function ArchiveChannelDialog({
|
|
28
|
-
channel,
|
|
29
|
-
isOpen,
|
|
30
|
-
onClose,
|
|
31
|
-
onConfirm,
|
|
32
|
-
isLoading = false,
|
|
33
|
-
}: ArchiveChannelDialogProps) {
|
|
34
|
-
if (!isOpen) return null;
|
|
35
|
-
|
|
36
|
-
const isUnarchiving = channel.status === 'archived';
|
|
37
|
-
|
|
38
|
-
return (
|
|
39
|
-
<Dialog onClose={onClose}>
|
|
40
|
-
<div className="p-6 max-w-md">
|
|
41
|
-
<div className="flex items-center gap-3 mb-4">
|
|
42
|
-
<div className={`
|
|
43
|
-
w-10 h-10 rounded-full flex items-center justify-center
|
|
44
|
-
${isUnarchiving ? 'bg-success/10' : 'bg-warning/10'}
|
|
45
|
-
`}>
|
|
46
|
-
{isUnarchiving ? (
|
|
47
|
-
<UnarchiveIcon className="w-5 h-5 text-success" />
|
|
48
|
-
) : (
|
|
49
|
-
<ArchiveIcon className="w-5 h-5 text-warning" />
|
|
50
|
-
)}
|
|
51
|
-
</div>
|
|
52
|
-
<div>
|
|
53
|
-
<h2 className="text-lg font-semibold text-text-primary">
|
|
54
|
-
{isUnarchiving ? 'Unarchive' : 'Archive'} #{channel.name}?
|
|
55
|
-
</h2>
|
|
56
|
-
</div>
|
|
57
|
-
</div>
|
|
58
|
-
|
|
59
|
-
<p className="text-sm text-text-secondary mb-6">
|
|
60
|
-
{isUnarchiving ? (
|
|
61
|
-
<>
|
|
62
|
-
This will restore the channel and make it visible to all members again.
|
|
63
|
-
Messages will be preserved.
|
|
64
|
-
</>
|
|
65
|
-
) : (
|
|
66
|
-
<>
|
|
67
|
-
Archiving this channel will move it to the Archived section. Members can
|
|
68
|
-
still view message history, but no new messages can be sent. You can
|
|
69
|
-
unarchive it later.
|
|
70
|
-
</>
|
|
71
|
-
)}
|
|
72
|
-
</p>
|
|
73
|
-
|
|
74
|
-
<div className="flex justify-end gap-3">
|
|
75
|
-
<button
|
|
76
|
-
onClick={onClose}
|
|
77
|
-
disabled={isLoading}
|
|
78
|
-
className="px-4 py-2 text-sm font-medium text-text-secondary bg-bg-tertiary hover:bg-bg-hover rounded-lg transition-colors disabled:opacity-50"
|
|
79
|
-
>
|
|
80
|
-
Cancel
|
|
81
|
-
</button>
|
|
82
|
-
<button
|
|
83
|
-
onClick={onConfirm}
|
|
84
|
-
disabled={isLoading}
|
|
85
|
-
className={`
|
|
86
|
-
px-4 py-2 text-sm font-medium rounded-lg transition-colors disabled:opacity-50 flex items-center gap-2
|
|
87
|
-
${isUnarchiving
|
|
88
|
-
? 'bg-success/20 text-success hover:bg-success/30'
|
|
89
|
-
: 'bg-warning/20 text-warning hover:bg-warning/30'}
|
|
90
|
-
`}
|
|
91
|
-
>
|
|
92
|
-
{isLoading && <LoadingSpinner className="w-4 h-4" />}
|
|
93
|
-
{isUnarchiving ? 'Unarchive' : 'Archive'}
|
|
94
|
-
</button>
|
|
95
|
-
</div>
|
|
96
|
-
</div>
|
|
97
|
-
</Dialog>
|
|
98
|
-
);
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
// =============================================================================
|
|
102
|
-
// Delete Channel Dialog
|
|
103
|
-
// =============================================================================
|
|
104
|
-
|
|
105
|
-
export interface DeleteChannelDialogProps {
|
|
106
|
-
channel: Channel;
|
|
107
|
-
isOpen: boolean;
|
|
108
|
-
onClose: () => void;
|
|
109
|
-
onConfirm: () => void;
|
|
110
|
-
isLoading?: boolean;
|
|
111
|
-
}
|
|
112
|
-
|
|
113
|
-
export function DeleteChannelDialog({
|
|
114
|
-
channel,
|
|
115
|
-
isOpen,
|
|
116
|
-
onClose,
|
|
117
|
-
onConfirm,
|
|
118
|
-
isLoading = false,
|
|
119
|
-
}: DeleteChannelDialogProps) {
|
|
120
|
-
const [confirmText, setConfirmText] = useState('');
|
|
121
|
-
|
|
122
|
-
if (!isOpen) return null;
|
|
123
|
-
|
|
124
|
-
const canDelete = confirmText === channel.name;
|
|
125
|
-
|
|
126
|
-
return (
|
|
127
|
-
<Dialog onClose={onClose}>
|
|
128
|
-
<div className="p-6 max-w-md">
|
|
129
|
-
<div className="flex items-center gap-3 mb-4">
|
|
130
|
-
<div className="w-10 h-10 rounded-full bg-red-500/10 flex items-center justify-center">
|
|
131
|
-
<TrashIcon className="w-5 h-5 text-red-400" />
|
|
132
|
-
</div>
|
|
133
|
-
<div>
|
|
134
|
-
<h2 className="text-lg font-semibold text-text-primary">
|
|
135
|
-
Delete #{channel.name}?
|
|
136
|
-
</h2>
|
|
137
|
-
</div>
|
|
138
|
-
</div>
|
|
139
|
-
|
|
140
|
-
<div className="bg-red-500/10 border border-red-500/20 rounded-lg p-3 mb-4">
|
|
141
|
-
<p className="text-sm text-red-400 font-medium flex items-center gap-2">
|
|
142
|
-
<WarningIcon className="w-4 h-4" />
|
|
143
|
-
This action cannot be undone
|
|
144
|
-
</p>
|
|
145
|
-
</div>
|
|
146
|
-
|
|
147
|
-
<p className="text-sm text-text-secondary mb-4">
|
|
148
|
-
Deleting this channel will permanently remove all messages and files.
|
|
149
|
-
All {channel.memberCount} members will lose access.
|
|
150
|
-
</p>
|
|
151
|
-
|
|
152
|
-
<div className="mb-6">
|
|
153
|
-
<label className="block text-sm text-text-muted mb-2">
|
|
154
|
-
Type <span className="font-mono text-text-primary">{channel.name}</span> to confirm:
|
|
155
|
-
</label>
|
|
156
|
-
<input
|
|
157
|
-
type="text"
|
|
158
|
-
value={confirmText}
|
|
159
|
-
onChange={(e) => setConfirmText(e.target.value)}
|
|
160
|
-
placeholder={channel.name}
|
|
161
|
-
className="w-full px-3 py-2 bg-bg-tertiary border border-border-subtle rounded-lg text-text-primary text-sm focus:outline-none focus:border-red-500/50"
|
|
162
|
-
/>
|
|
163
|
-
</div>
|
|
164
|
-
|
|
165
|
-
<div className="flex justify-end gap-3">
|
|
166
|
-
<button
|
|
167
|
-
onClick={onClose}
|
|
168
|
-
disabled={isLoading}
|
|
169
|
-
className="px-4 py-2 text-sm font-medium text-text-secondary bg-bg-tertiary hover:bg-bg-hover rounded-lg transition-colors disabled:opacity-50"
|
|
170
|
-
>
|
|
171
|
-
Cancel
|
|
172
|
-
</button>
|
|
173
|
-
<button
|
|
174
|
-
onClick={onConfirm}
|
|
175
|
-
disabled={!canDelete || isLoading}
|
|
176
|
-
className="px-4 py-2 text-sm font-medium bg-red-500/20 text-red-400 hover:bg-red-500/30 rounded-lg transition-colors disabled:opacity-50 disabled:cursor-not-allowed flex items-center gap-2"
|
|
177
|
-
>
|
|
178
|
-
{isLoading && <LoadingSpinner className="w-4 h-4" />}
|
|
179
|
-
Delete Channel
|
|
180
|
-
</button>
|
|
181
|
-
</div>
|
|
182
|
-
</div>
|
|
183
|
-
</Dialog>
|
|
184
|
-
);
|
|
185
|
-
}
|
|
186
|
-
|
|
187
|
-
// =============================================================================
|
|
188
|
-
// Leave Channel Dialog
|
|
189
|
-
// =============================================================================
|
|
190
|
-
|
|
191
|
-
export interface LeaveChannelDialogProps {
|
|
192
|
-
channel: Channel;
|
|
193
|
-
isOpen: boolean;
|
|
194
|
-
onClose: () => void;
|
|
195
|
-
onConfirm: () => void;
|
|
196
|
-
isLoading?: boolean;
|
|
197
|
-
}
|
|
198
|
-
|
|
199
|
-
export function LeaveChannelDialog({
|
|
200
|
-
channel,
|
|
201
|
-
isOpen,
|
|
202
|
-
onClose,
|
|
203
|
-
onConfirm,
|
|
204
|
-
isLoading = false,
|
|
205
|
-
}: LeaveChannelDialogProps) {
|
|
206
|
-
if (!isOpen) return null;
|
|
207
|
-
|
|
208
|
-
return (
|
|
209
|
-
<Dialog onClose={onClose}>
|
|
210
|
-
<div className="p-6 max-w-md">
|
|
211
|
-
<div className="flex items-center gap-3 mb-4">
|
|
212
|
-
<div className="w-10 h-10 rounded-full bg-accent-cyan/10 flex items-center justify-center">
|
|
213
|
-
<LeaveIcon className="w-5 h-5 text-accent-cyan" />
|
|
214
|
-
</div>
|
|
215
|
-
<div>
|
|
216
|
-
<h2 className="text-lg font-semibold text-text-primary">
|
|
217
|
-
Leave #{channel.name}?
|
|
218
|
-
</h2>
|
|
219
|
-
</div>
|
|
220
|
-
</div>
|
|
221
|
-
|
|
222
|
-
<p className="text-sm text-text-secondary mb-6">
|
|
223
|
-
You'll no longer receive messages from this channel. You can rejoin at
|
|
224
|
-
any time if the channel is public.
|
|
225
|
-
</p>
|
|
226
|
-
|
|
227
|
-
<div className="flex justify-end gap-3">
|
|
228
|
-
<button
|
|
229
|
-
onClick={onClose}
|
|
230
|
-
disabled={isLoading}
|
|
231
|
-
className="px-4 py-2 text-sm font-medium text-text-secondary bg-bg-tertiary hover:bg-bg-hover rounded-lg transition-colors disabled:opacity-50"
|
|
232
|
-
>
|
|
233
|
-
Cancel
|
|
234
|
-
</button>
|
|
235
|
-
<button
|
|
236
|
-
onClick={onConfirm}
|
|
237
|
-
disabled={isLoading}
|
|
238
|
-
className="px-4 py-2 text-sm font-medium bg-accent-cyan/20 text-accent-cyan hover:bg-accent-cyan/30 rounded-lg transition-colors disabled:opacity-50 flex items-center gap-2"
|
|
239
|
-
>
|
|
240
|
-
{isLoading && <LoadingSpinner className="w-4 h-4" />}
|
|
241
|
-
Leave Channel
|
|
242
|
-
</button>
|
|
243
|
-
</div>
|
|
244
|
-
</div>
|
|
245
|
-
</Dialog>
|
|
246
|
-
);
|
|
247
|
-
}
|
|
248
|
-
|
|
249
|
-
// =============================================================================
|
|
250
|
-
// Create Channel Modal
|
|
251
|
-
// =============================================================================
|
|
252
|
-
|
|
253
|
-
export interface CreateChannelModalProps {
|
|
254
|
-
isOpen: boolean;
|
|
255
|
-
onClose: () => void;
|
|
256
|
-
onCreate: (request: CreateChannelRequest) => void;
|
|
257
|
-
isLoading?: boolean;
|
|
258
|
-
existingChannels?: string[];
|
|
259
|
-
/** Available agents/users for invite suggestions (legacy - merged with fetched data) */
|
|
260
|
-
availableMembers?: string[];
|
|
261
|
-
/** Workspace ID for fetching available members */
|
|
262
|
-
workspaceId?: string;
|
|
263
|
-
}
|
|
264
|
-
|
|
265
|
-
export function CreateChannelModal({
|
|
266
|
-
isOpen,
|
|
267
|
-
onClose,
|
|
268
|
-
onCreate,
|
|
269
|
-
isLoading = false,
|
|
270
|
-
existingChannels = [],
|
|
271
|
-
availableMembers: legacyAvailableMembers = [],
|
|
272
|
-
workspaceId,
|
|
273
|
-
}: CreateChannelModalProps) {
|
|
274
|
-
const [name, setName] = useState('');
|
|
275
|
-
const [description, setDescription] = useState('');
|
|
276
|
-
const [visibility, setVisibility] = useState<ChannelVisibility>('public');
|
|
277
|
-
const [inviteInput, setInviteInput] = useState('');
|
|
278
|
-
const [selectedMembers, setSelectedMembers] = useState<Array<{ id: string; type: 'user' | 'agent' }>>([]);
|
|
279
|
-
const [fetchedMembers, setFetchedMembers] = useState<AvailableMember[]>([]);
|
|
280
|
-
const [fetchedAgents, setFetchedAgents] = useState<AvailableMember[]>([]);
|
|
281
|
-
const [isFetching, setIsFetching] = useState(false);
|
|
282
|
-
|
|
283
|
-
// Fetch available members when modal opens
|
|
284
|
-
useEffect(() => {
|
|
285
|
-
if (isOpen) {
|
|
286
|
-
setIsFetching(true);
|
|
287
|
-
getAvailableMembers(workspaceId)
|
|
288
|
-
.then(({ members, agents }) => {
|
|
289
|
-
setFetchedMembers(members);
|
|
290
|
-
setFetchedAgents(agents);
|
|
291
|
-
})
|
|
292
|
-
.catch((err) => {
|
|
293
|
-
console.error('[CreateChannelModal] Failed to fetch available members:', err);
|
|
294
|
-
})
|
|
295
|
-
.finally(() => {
|
|
296
|
-
setIsFetching(false);
|
|
297
|
-
});
|
|
298
|
-
}
|
|
299
|
-
}, [isOpen, workspaceId]);
|
|
300
|
-
|
|
301
|
-
// Combine fetched data with legacy prop for backwards compatibility
|
|
302
|
-
const allMembers: AvailableMember[] = [
|
|
303
|
-
...fetchedMembers,
|
|
304
|
-
...fetchedAgents,
|
|
305
|
-
// Add legacy members as agents (for backwards compatibility)
|
|
306
|
-
...legacyAvailableMembers
|
|
307
|
-
.filter(name => !fetchedAgents.some(a => a.id === name) && !fetchedMembers.some(m => m.id === name))
|
|
308
|
-
.map(name => ({ id: name, displayName: name, type: 'agent' as const })),
|
|
309
|
-
];
|
|
310
|
-
|
|
311
|
-
const handleClose = useCallback(() => {
|
|
312
|
-
setName('');
|
|
313
|
-
setDescription('');
|
|
314
|
-
setVisibility('public');
|
|
315
|
-
setInviteInput('');
|
|
316
|
-
setSelectedMembers([]);
|
|
317
|
-
onClose();
|
|
318
|
-
}, [onClose]);
|
|
319
|
-
|
|
320
|
-
const handleAddMember = useCallback((member: AvailableMember) => {
|
|
321
|
-
if (!selectedMembers.some(m => m.id === member.id)) {
|
|
322
|
-
setSelectedMembers(prev => [...prev, { id: member.id, type: member.type }]);
|
|
323
|
-
setInviteInput('');
|
|
324
|
-
}
|
|
325
|
-
}, [selectedMembers]);
|
|
326
|
-
|
|
327
|
-
const handleRemoveMember = useCallback((memberId: string) => {
|
|
328
|
-
setSelectedMembers(prev => prev.filter(m => m.id !== memberId));
|
|
329
|
-
}, []);
|
|
330
|
-
|
|
331
|
-
const handleSubmit = useCallback((e: React.FormEvent) => {
|
|
332
|
-
e.preventDefault();
|
|
333
|
-
if (!name.trim()) return;
|
|
334
|
-
|
|
335
|
-
onCreate({
|
|
336
|
-
name: name.trim().toLowerCase().replace(/\s+/g, '-'),
|
|
337
|
-
description: description.trim() || undefined,
|
|
338
|
-
visibility,
|
|
339
|
-
members: selectedMembers.length > 0 ? selectedMembers : undefined,
|
|
340
|
-
});
|
|
341
|
-
}, [name, description, visibility, selectedMembers, onCreate]);
|
|
342
|
-
|
|
343
|
-
// Filter members for suggestions
|
|
344
|
-
const suggestions = allMembers.filter(m =>
|
|
345
|
-
(m.displayName?.toLowerCase().includes(inviteInput.toLowerCase()) ||
|
|
346
|
-
m.id.toLowerCase().includes(inviteInput.toLowerCase())) &&
|
|
347
|
-
!selectedMembers.some(sm => sm.id === m.id)
|
|
348
|
-
).slice(0, 8);
|
|
349
|
-
|
|
350
|
-
if (!isOpen) return null;
|
|
351
|
-
|
|
352
|
-
// Validate channel name
|
|
353
|
-
const normalizedName = name.trim().toLowerCase().replace(/\s+/g, '-');
|
|
354
|
-
const nameExists = existingChannels.includes(`#${normalizedName}`);
|
|
355
|
-
const isValidName = normalizedName.length >= 2 && normalizedName.length <= 80 && /^[a-z0-9-]+$/.test(normalizedName);
|
|
356
|
-
const canCreate = name.trim() && isValidName && !nameExists;
|
|
357
|
-
|
|
358
|
-
return (
|
|
359
|
-
<Dialog onClose={handleClose}>
|
|
360
|
-
<form onSubmit={handleSubmit} className="p-6 w-[400px] max-w-full">
|
|
361
|
-
<h2 className="text-lg font-semibold text-text-primary mb-6">
|
|
362
|
-
Create a channel
|
|
363
|
-
</h2>
|
|
364
|
-
|
|
365
|
-
{/* Channel Name */}
|
|
366
|
-
<div className="mb-4">
|
|
367
|
-
<label className="block text-sm font-medium text-text-primary mb-1.5">
|
|
368
|
-
Channel name
|
|
369
|
-
</label>
|
|
370
|
-
<div className="relative">
|
|
371
|
-
<span className="absolute left-3 top-1/2 -translate-y-1/2 text-text-muted">#</span>
|
|
372
|
-
<input
|
|
373
|
-
type="text"
|
|
374
|
-
value={name}
|
|
375
|
-
onChange={(e) => setName(e.target.value)}
|
|
376
|
-
placeholder="e.g., engineering"
|
|
377
|
-
className="w-full pl-7 pr-3 py-2 bg-bg-tertiary border border-border-subtle rounded-lg text-text-primary text-sm focus:outline-none focus:border-accent-cyan/50"
|
|
378
|
-
autoFocus
|
|
379
|
-
/>
|
|
380
|
-
</div>
|
|
381
|
-
{name && !isValidName && (
|
|
382
|
-
<p className="mt-1 text-xs text-red-400">
|
|
383
|
-
Channel names must be 2-80 characters, lowercase letters, numbers, and hyphens only
|
|
384
|
-
</p>
|
|
385
|
-
)}
|
|
386
|
-
{nameExists && (
|
|
387
|
-
<p className="mt-1 text-xs text-red-400">
|
|
388
|
-
A channel with this name already exists
|
|
389
|
-
</p>
|
|
390
|
-
)}
|
|
391
|
-
</div>
|
|
392
|
-
|
|
393
|
-
{/* Description */}
|
|
394
|
-
<div className="mb-4">
|
|
395
|
-
<label className="block text-sm font-medium text-text-primary mb-1.5">
|
|
396
|
-
Description <span className="text-text-muted font-normal">(optional)</span>
|
|
397
|
-
</label>
|
|
398
|
-
<textarea
|
|
399
|
-
value={description}
|
|
400
|
-
onChange={(e) => setDescription(e.target.value)}
|
|
401
|
-
placeholder="What's this channel about?"
|
|
402
|
-
rows={2}
|
|
403
|
-
className="w-full px-3 py-2 bg-bg-tertiary border border-border-subtle rounded-lg text-text-primary text-sm focus:outline-none focus:border-accent-cyan/50 resize-none"
|
|
404
|
-
/>
|
|
405
|
-
</div>
|
|
406
|
-
|
|
407
|
-
{/* Invite Members */}
|
|
408
|
-
<div className="mb-4">
|
|
409
|
-
<label className="block text-sm font-medium text-text-primary mb-1.5">
|
|
410
|
-
Invite members <span className="text-text-muted font-normal">(optional)</span>
|
|
411
|
-
{isFetching && <span className="ml-2 text-text-muted text-xs">Loading...</span>}
|
|
412
|
-
</label>
|
|
413
|
-
<div className="relative">
|
|
414
|
-
<input
|
|
415
|
-
type="text"
|
|
416
|
-
value={inviteInput}
|
|
417
|
-
onChange={(e) => setInviteInput(e.target.value)}
|
|
418
|
-
placeholder={allMembers.length > 0 ? "Type agent or user name..." : "No members available"}
|
|
419
|
-
className="w-full px-3 py-2 bg-bg-tertiary border border-border-subtle rounded-lg text-text-primary text-sm focus:outline-none focus:border-accent-cyan/50"
|
|
420
|
-
/>
|
|
421
|
-
{/* Suggestions dropdown */}
|
|
422
|
-
{inviteInput && suggestions.length > 0 && (
|
|
423
|
-
<div className="absolute z-10 w-full mt-1 bg-bg-secondary border border-border-subtle rounded-lg shadow-lg max-h-48 overflow-y-auto">
|
|
424
|
-
{suggestions.map(member => (
|
|
425
|
-
<button
|
|
426
|
-
key={member.id}
|
|
427
|
-
type="button"
|
|
428
|
-
onClick={() => handleAddMember(member)}
|
|
429
|
-
className="w-full px-3 py-2 text-left text-sm text-text-primary hover:bg-bg-hover transition-colors flex items-center justify-between"
|
|
430
|
-
>
|
|
431
|
-
<span>{member.displayName || member.id}</span>
|
|
432
|
-
<span className={`text-xs px-1.5 py-0.5 rounded ${
|
|
433
|
-
member.type === 'agent'
|
|
434
|
-
? 'bg-purple-500/20 text-purple-400'
|
|
435
|
-
: 'bg-accent-cyan/20 text-accent-cyan'
|
|
436
|
-
}`}>
|
|
437
|
-
{member.type === 'agent' ? 'Agent' : 'User'}
|
|
438
|
-
</span>
|
|
439
|
-
</button>
|
|
440
|
-
))}
|
|
441
|
-
</div>
|
|
442
|
-
)}
|
|
443
|
-
{/* Show all members if no input and we have members */}
|
|
444
|
-
{!inviteInput && allMembers.length > 0 && (
|
|
445
|
-
<div className="mt-2 text-xs text-text-muted">
|
|
446
|
-
{fetchedMembers.length > 0 && (
|
|
447
|
-
<span>{fetchedMembers.length} user{fetchedMembers.length !== 1 ? 's' : ''}</span>
|
|
448
|
-
)}
|
|
449
|
-
{fetchedMembers.length > 0 && fetchedAgents.length > 0 && <span>, </span>}
|
|
450
|
-
{fetchedAgents.length > 0 && (
|
|
451
|
-
<span>{fetchedAgents.length} agent{fetchedAgents.length !== 1 ? 's' : ''}</span>
|
|
452
|
-
)}
|
|
453
|
-
<span> available</span>
|
|
454
|
-
</div>
|
|
455
|
-
)}
|
|
456
|
-
</div>
|
|
457
|
-
{/* Selected members with type badges */}
|
|
458
|
-
{selectedMembers.length > 0 && (
|
|
459
|
-
<div className="flex flex-wrap gap-1.5 mt-2">
|
|
460
|
-
{selectedMembers.map(member => (
|
|
461
|
-
<span
|
|
462
|
-
key={member.id}
|
|
463
|
-
className={`inline-flex items-center gap-1 px-2 py-1 text-xs rounded-full ${
|
|
464
|
-
member.type === 'agent'
|
|
465
|
-
? 'bg-purple-500/10 text-purple-400'
|
|
466
|
-
: 'bg-accent-cyan/10 text-accent-cyan'
|
|
467
|
-
}`}
|
|
468
|
-
>
|
|
469
|
-
{member.id}
|
|
470
|
-
<span className="text-[10px] opacity-70">
|
|
471
|
-
({member.type === 'agent' ? 'Agent' : 'User'})
|
|
472
|
-
</span>
|
|
473
|
-
<button
|
|
474
|
-
type="button"
|
|
475
|
-
onClick={() => handleRemoveMember(member.id)}
|
|
476
|
-
className="hover:text-red-400 transition-colors"
|
|
477
|
-
>
|
|
478
|
-
<XIcon className="w-3 h-3" />
|
|
479
|
-
</button>
|
|
480
|
-
</span>
|
|
481
|
-
))}
|
|
482
|
-
</div>
|
|
483
|
-
)}
|
|
484
|
-
</div>
|
|
485
|
-
|
|
486
|
-
{/* Visibility */}
|
|
487
|
-
<div className="mb-6">
|
|
488
|
-
<label className="block text-sm font-medium text-text-primary mb-2">
|
|
489
|
-
Visibility
|
|
490
|
-
</label>
|
|
491
|
-
<div className="space-y-2">
|
|
492
|
-
<label className={`
|
|
493
|
-
flex items-start gap-3 p-3 rounded-lg border cursor-pointer transition-colors
|
|
494
|
-
${visibility === 'public'
|
|
495
|
-
? 'border-accent-cyan/30 bg-accent-cyan/5'
|
|
496
|
-
: 'border-border-subtle hover:bg-bg-hover'}
|
|
497
|
-
`}>
|
|
498
|
-
<input
|
|
499
|
-
type="radio"
|
|
500
|
-
name="visibility"
|
|
501
|
-
value="public"
|
|
502
|
-
checked={visibility === 'public'}
|
|
503
|
-
onChange={() => setVisibility('public')}
|
|
504
|
-
className="mt-1"
|
|
505
|
-
/>
|
|
506
|
-
<div>
|
|
507
|
-
<div className="flex items-center gap-2">
|
|
508
|
-
<HashIcon className="w-4 h-4 text-text-primary" />
|
|
509
|
-
<span className="text-sm font-medium text-text-primary">Public</span>
|
|
510
|
-
</div>
|
|
511
|
-
<p className="text-xs text-text-muted mt-0.5">
|
|
512
|
-
Anyone can join and view messages
|
|
513
|
-
</p>
|
|
514
|
-
</div>
|
|
515
|
-
</label>
|
|
516
|
-
|
|
517
|
-
<label className={`
|
|
518
|
-
flex items-start gap-3 p-3 rounded-lg border cursor-pointer transition-colors
|
|
519
|
-
${visibility === 'private'
|
|
520
|
-
? 'border-accent-cyan/30 bg-accent-cyan/5'
|
|
521
|
-
: 'border-border-subtle hover:bg-bg-hover'}
|
|
522
|
-
`}>
|
|
523
|
-
<input
|
|
524
|
-
type="radio"
|
|
525
|
-
name="visibility"
|
|
526
|
-
value="private"
|
|
527
|
-
checked={visibility === 'private'}
|
|
528
|
-
onChange={() => setVisibility('private')}
|
|
529
|
-
className="mt-1"
|
|
530
|
-
/>
|
|
531
|
-
<div>
|
|
532
|
-
<div className="flex items-center gap-2">
|
|
533
|
-
<LockIcon className="w-4 h-4 text-text-primary" />
|
|
534
|
-
<span className="text-sm font-medium text-text-primary">Private</span>
|
|
535
|
-
</div>
|
|
536
|
-
<p className="text-xs text-text-muted mt-0.5">
|
|
537
|
-
Only invited members can join
|
|
538
|
-
</p>
|
|
539
|
-
</div>
|
|
540
|
-
</label>
|
|
541
|
-
</div>
|
|
542
|
-
</div>
|
|
543
|
-
|
|
544
|
-
{/* Actions */}
|
|
545
|
-
<div className="flex justify-end gap-3">
|
|
546
|
-
<button
|
|
547
|
-
type="button"
|
|
548
|
-
onClick={handleClose}
|
|
549
|
-
disabled={isLoading}
|
|
550
|
-
className="px-4 py-2 text-sm font-medium text-text-secondary bg-bg-tertiary hover:bg-bg-hover rounded-lg transition-colors disabled:opacity-50"
|
|
551
|
-
>
|
|
552
|
-
Cancel
|
|
553
|
-
</button>
|
|
554
|
-
<button
|
|
555
|
-
type="submit"
|
|
556
|
-
disabled={!canCreate || isLoading}
|
|
557
|
-
className="px-4 py-2 text-sm font-medium bg-accent-cyan text-bg-deep hover:bg-accent-cyan/90 rounded-lg transition-colors disabled:opacity-50 disabled:cursor-not-allowed flex items-center gap-2"
|
|
558
|
-
>
|
|
559
|
-
{isLoading && <LoadingSpinner className="w-4 h-4" />}
|
|
560
|
-
Create Channel
|
|
561
|
-
</button>
|
|
562
|
-
</div>
|
|
563
|
-
</form>
|
|
564
|
-
</Dialog>
|
|
565
|
-
);
|
|
566
|
-
}
|
|
567
|
-
|
|
568
|
-
// =============================================================================
|
|
569
|
-
// Invite to Channel Modal
|
|
570
|
-
// =============================================================================
|
|
571
|
-
|
|
572
|
-
export interface InviteToChannelModalProps {
|
|
573
|
-
isOpen: boolean;
|
|
574
|
-
channelName: string;
|
|
575
|
-
onClose: () => void;
|
|
576
|
-
onInvite: (members: string[]) => void;
|
|
577
|
-
isLoading?: boolean;
|
|
578
|
-
availableMembers?: string[];
|
|
579
|
-
}
|
|
580
|
-
|
|
581
|
-
export function InviteToChannelModal({
|
|
582
|
-
isOpen,
|
|
583
|
-
channelName,
|
|
584
|
-
onClose,
|
|
585
|
-
onInvite,
|
|
586
|
-
isLoading = false,
|
|
587
|
-
availableMembers = [],
|
|
588
|
-
}: InviteToChannelModalProps) {
|
|
589
|
-
const [inviteInput, setInviteInput] = useState('');
|
|
590
|
-
const [selectedMembers, setSelectedMembers] = useState<string[]>([]);
|
|
591
|
-
|
|
592
|
-
const handleClose = useCallback(() => {
|
|
593
|
-
setInviteInput('');
|
|
594
|
-
setSelectedMembers([]);
|
|
595
|
-
onClose();
|
|
596
|
-
}, [onClose]);
|
|
597
|
-
|
|
598
|
-
const handleAddMember = useCallback((member: string) => {
|
|
599
|
-
const normalized = member.trim();
|
|
600
|
-
if (normalized && !selectedMembers.includes(normalized)) {
|
|
601
|
-
setSelectedMembers(prev => [...prev, normalized]);
|
|
602
|
-
setInviteInput('');
|
|
603
|
-
}
|
|
604
|
-
}, [selectedMembers]);
|
|
605
|
-
|
|
606
|
-
const handleRemoveMember = useCallback((member: string) => {
|
|
607
|
-
setSelectedMembers(prev => prev.filter(m => m !== member));
|
|
608
|
-
}, []);
|
|
609
|
-
|
|
610
|
-
const handleSubmit = useCallback((e: React.FormEvent) => {
|
|
611
|
-
e.preventDefault();
|
|
612
|
-
if (selectedMembers.length === 0) return;
|
|
613
|
-
onInvite(selectedMembers);
|
|
614
|
-
}, [selectedMembers, onInvite]);
|
|
615
|
-
|
|
616
|
-
// Filter available members for suggestions
|
|
617
|
-
const suggestions = availableMembers.filter(m =>
|
|
618
|
-
m.toLowerCase().includes(inviteInput.toLowerCase()) &&
|
|
619
|
-
!selectedMembers.includes(m)
|
|
620
|
-
).slice(0, 5);
|
|
621
|
-
|
|
622
|
-
if (!isOpen) return null;
|
|
623
|
-
|
|
624
|
-
return (
|
|
625
|
-
<Dialog onClose={handleClose}>
|
|
626
|
-
<form onSubmit={handleSubmit} className="p-6 w-[400px] max-w-full">
|
|
627
|
-
<h2 className="text-lg font-semibold text-text-primary mb-2">
|
|
628
|
-
Invite to #{channelName}
|
|
629
|
-
</h2>
|
|
630
|
-
<p className="text-sm text-text-muted mb-6">
|
|
631
|
-
Add agents or users to this channel
|
|
632
|
-
</p>
|
|
633
|
-
|
|
634
|
-
{/* Invite Input */}
|
|
635
|
-
<div className="mb-4">
|
|
636
|
-
<label className="block text-sm font-medium text-text-primary mb-1.5">
|
|
637
|
-
Members to invite
|
|
638
|
-
</label>
|
|
639
|
-
<div className="relative">
|
|
640
|
-
<input
|
|
641
|
-
type="text"
|
|
642
|
-
value={inviteInput}
|
|
643
|
-
onChange={(e) => setInviteInput(e.target.value)}
|
|
644
|
-
onKeyDown={(e) => {
|
|
645
|
-
if (e.key === 'Enter' && inviteInput.trim()) {
|
|
646
|
-
e.preventDefault();
|
|
647
|
-
handleAddMember(inviteInput);
|
|
648
|
-
}
|
|
649
|
-
}}
|
|
650
|
-
placeholder="Type agent or user name..."
|
|
651
|
-
className="w-full px-3 py-2 bg-bg-tertiary border border-border-subtle rounded-lg text-text-primary text-sm focus:outline-none focus:border-accent-cyan/50"
|
|
652
|
-
autoFocus
|
|
653
|
-
/>
|
|
654
|
-
{/* Suggestions dropdown */}
|
|
655
|
-
{inviteInput && suggestions.length > 0 && (
|
|
656
|
-
<div className="absolute z-10 w-full mt-1 bg-bg-secondary border border-border-subtle rounded-lg shadow-lg max-h-40 overflow-y-auto">
|
|
657
|
-
{suggestions.map(member => (
|
|
658
|
-
<button
|
|
659
|
-
key={member}
|
|
660
|
-
type="button"
|
|
661
|
-
onClick={() => handleAddMember(member)}
|
|
662
|
-
className="w-full px-3 py-2 text-left text-sm text-text-primary hover:bg-bg-hover transition-colors"
|
|
663
|
-
>
|
|
664
|
-
{member}
|
|
665
|
-
</button>
|
|
666
|
-
))}
|
|
667
|
-
</div>
|
|
668
|
-
)}
|
|
669
|
-
</div>
|
|
670
|
-
{/* Selected members */}
|
|
671
|
-
{selectedMembers.length > 0 && (
|
|
672
|
-
<div className="flex flex-wrap gap-1.5 mt-2">
|
|
673
|
-
{selectedMembers.map(member => (
|
|
674
|
-
<span
|
|
675
|
-
key={member}
|
|
676
|
-
className="inline-flex items-center gap-1 px-2 py-1 bg-accent-cyan/10 text-accent-cyan text-xs rounded-full"
|
|
677
|
-
>
|
|
678
|
-
{member}
|
|
679
|
-
<button
|
|
680
|
-
type="button"
|
|
681
|
-
onClick={() => handleRemoveMember(member)}
|
|
682
|
-
className="hover:text-red-400 transition-colors"
|
|
683
|
-
>
|
|
684
|
-
<XIcon className="w-3 h-3" />
|
|
685
|
-
</button>
|
|
686
|
-
</span>
|
|
687
|
-
))}
|
|
688
|
-
</div>
|
|
689
|
-
)}
|
|
690
|
-
</div>
|
|
691
|
-
|
|
692
|
-
{/* Actions */}
|
|
693
|
-
<div className="flex justify-end gap-3">
|
|
694
|
-
<button
|
|
695
|
-
type="button"
|
|
696
|
-
onClick={handleClose}
|
|
697
|
-
disabled={isLoading}
|
|
698
|
-
className="px-4 py-2 text-sm font-medium text-text-secondary bg-bg-tertiary hover:bg-bg-hover rounded-lg transition-colors disabled:opacity-50"
|
|
699
|
-
>
|
|
700
|
-
Cancel
|
|
701
|
-
</button>
|
|
702
|
-
<button
|
|
703
|
-
type="submit"
|
|
704
|
-
disabled={selectedMembers.length === 0 || isLoading}
|
|
705
|
-
className="px-4 py-2 text-sm font-medium bg-accent-cyan text-bg-deep hover:bg-accent-cyan/90 rounded-lg transition-colors disabled:opacity-50 disabled:cursor-not-allowed flex items-center gap-2"
|
|
706
|
-
>
|
|
707
|
-
{isLoading && <LoadingSpinner className="w-4 h-4" />}
|
|
708
|
-
Invite {selectedMembers.length > 0 ? `(${selectedMembers.length})` : ''}
|
|
709
|
-
</button>
|
|
710
|
-
</div>
|
|
711
|
-
</form>
|
|
712
|
-
</Dialog>
|
|
713
|
-
);
|
|
714
|
-
}
|
|
715
|
-
|
|
716
|
-
// =============================================================================
|
|
717
|
-
// Base Dialog Component
|
|
718
|
-
// =============================================================================
|
|
719
|
-
|
|
720
|
-
function Dialog({
|
|
721
|
-
children,
|
|
722
|
-
onClose,
|
|
723
|
-
}: {
|
|
724
|
-
children: React.ReactNode;
|
|
725
|
-
onClose: () => void;
|
|
726
|
-
}) {
|
|
727
|
-
return (
|
|
728
|
-
<div
|
|
729
|
-
className="fixed inset-0 z-50 flex items-center justify-center"
|
|
730
|
-
onClick={onClose}
|
|
731
|
-
>
|
|
732
|
-
{/* Backdrop */}
|
|
733
|
-
<div className="absolute inset-0 bg-black/60 backdrop-blur-sm" />
|
|
734
|
-
|
|
735
|
-
{/* Content */}
|
|
736
|
-
<div
|
|
737
|
-
className="relative bg-bg-elevated border border-border-subtle rounded-xl shadow-2xl animate-in fade-in zoom-in-95 duration-150"
|
|
738
|
-
onClick={(e) => e.stopPropagation()}
|
|
739
|
-
>
|
|
740
|
-
{children}
|
|
741
|
-
</div>
|
|
742
|
-
</div>
|
|
743
|
-
);
|
|
744
|
-
}
|
|
745
|
-
|
|
746
|
-
// =============================================================================
|
|
747
|
-
// Icons
|
|
748
|
-
// =============================================================================
|
|
749
|
-
|
|
750
|
-
function LoadingSpinner({ className }: { className?: string }) {
|
|
751
|
-
return (
|
|
752
|
-
<svg className={`animate-spin ${className}`} viewBox="0 0 24 24" fill="none">
|
|
753
|
-
<circle className="opacity-25" cx="12" cy="12" r="10" stroke="currentColor" strokeWidth="4" />
|
|
754
|
-
<path className="opacity-75" fill="currentColor" d="M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4z" />
|
|
755
|
-
</svg>
|
|
756
|
-
);
|
|
757
|
-
}
|
|
758
|
-
|
|
759
|
-
function ArchiveIcon({ className }: { className?: string }) {
|
|
760
|
-
return (
|
|
761
|
-
<svg className={className} viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round">
|
|
762
|
-
<polyline points="21 8 21 21 3 21 3 8" />
|
|
763
|
-
<rect x="1" y="3" width="22" height="5" />
|
|
764
|
-
<line x1="10" y1="12" x2="14" y2="12" />
|
|
765
|
-
</svg>
|
|
766
|
-
);
|
|
767
|
-
}
|
|
768
|
-
|
|
769
|
-
function UnarchiveIcon({ className }: { className?: string }) {
|
|
770
|
-
return (
|
|
771
|
-
<svg className={className} viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round">
|
|
772
|
-
<polyline points="21 8 21 21 3 21 3 8" />
|
|
773
|
-
<rect x="1" y="3" width="22" height="5" />
|
|
774
|
-
<path d="M12 12v6" />
|
|
775
|
-
<path d="M9 15l3-3 3 3" />
|
|
776
|
-
</svg>
|
|
777
|
-
);
|
|
778
|
-
}
|
|
779
|
-
|
|
780
|
-
function TrashIcon({ className }: { className?: string }) {
|
|
781
|
-
return (
|
|
782
|
-
<svg className={className} viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round">
|
|
783
|
-
<polyline points="3 6 5 6 21 6" />
|
|
784
|
-
<path d="M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6m3 0V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2" />
|
|
785
|
-
<line x1="10" y1="11" x2="10" y2="17" />
|
|
786
|
-
<line x1="14" y1="11" x2="14" y2="17" />
|
|
787
|
-
</svg>
|
|
788
|
-
);
|
|
789
|
-
}
|
|
790
|
-
|
|
791
|
-
function WarningIcon({ className }: { className?: string }) {
|
|
792
|
-
return (
|
|
793
|
-
<svg className={className} viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round">
|
|
794
|
-
<path d="M10.29 3.86L1.82 18a2 2 0 0 0 1.71 3h16.94a2 2 0 0 0 1.71-3L13.71 3.86a2 2 0 0 0-3.42 0z" />
|
|
795
|
-
<line x1="12" y1="9" x2="12" y2="13" />
|
|
796
|
-
<line x1="12" y1="17" x2="12.01" y2="17" />
|
|
797
|
-
</svg>
|
|
798
|
-
);
|
|
799
|
-
}
|
|
800
|
-
|
|
801
|
-
function LeaveIcon({ className }: { className?: string }) {
|
|
802
|
-
return (
|
|
803
|
-
<svg className={className} viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round">
|
|
804
|
-
<path d="M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4" />
|
|
805
|
-
<polyline points="16 17 21 12 16 7" />
|
|
806
|
-
<line x1="21" y1="12" x2="9" y2="12" />
|
|
807
|
-
</svg>
|
|
808
|
-
);
|
|
809
|
-
}
|
|
810
|
-
|
|
811
|
-
function HashIcon({ className }: { className?: string }) {
|
|
812
|
-
return (
|
|
813
|
-
<svg className={className} viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round">
|
|
814
|
-
<line x1="4" y1="9" x2="20" y2="9" />
|
|
815
|
-
<line x1="4" y1="15" x2="20" y2="15" />
|
|
816
|
-
<line x1="10" y1="3" x2="8" y2="21" />
|
|
817
|
-
<line x1="16" y1="3" x2="14" y2="21" />
|
|
818
|
-
</svg>
|
|
819
|
-
);
|
|
820
|
-
}
|
|
821
|
-
|
|
822
|
-
function LockIcon({ className }: { className?: string }) {
|
|
823
|
-
return (
|
|
824
|
-
<svg className={className} viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round">
|
|
825
|
-
<rect x="3" y="11" width="18" height="11" rx="2" ry="2" />
|
|
826
|
-
<path d="M7 11V7a5 5 0 0 1 10 0v4" />
|
|
827
|
-
</svg>
|
|
828
|
-
);
|
|
829
|
-
}
|
|
830
|
-
|
|
831
|
-
function SettingsIcon({ className }: { className?: string }) {
|
|
832
|
-
return (
|
|
833
|
-
<svg className={className} viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round">
|
|
834
|
-
<circle cx="12" cy="12" r="3" />
|
|
835
|
-
<path d="M19.4 15a1.65 1.65 0 0 0 .33 1.82l.06.06a2 2 0 0 1 0 2.83 2 2 0 0 1-2.83 0l-.06-.06a1.65 1.65 0 0 0-1.82-.33 1.65 1.65 0 0 0-1 1.51V21a2 2 0 0 1-2 2 2 2 0 0 1-2-2v-.09A1.65 1.65 0 0 0 9 19.4a1.65 1.65 0 0 0-1.82.33l-.06.06a2 2 0 0 1-2.83 0 2 2 0 0 1 0-2.83l.06-.06a1.65 1.65 0 0 0 .33-1.82 1.65 1.65 0 0 0-1.51-1H3a2 2 0 0 1-2-2 2 2 0 0 1 2-2h.09A1.65 1.65 0 0 0 4.6 9a1.65 1.65 0 0 0-.33-1.82l-.06-.06a2 2 0 0 1 0-2.83 2 2 0 0 1 2.83 0l.06.06a1.65 1.65 0 0 0 1.82.33H9a1.65 1.65 0 0 0 1-1.51V3a2 2 0 0 1 2-2 2 2 0 0 1 2 2v.09a1.65 1.65 0 0 0 1 1.51 1.65 1.65 0 0 0 1.82-.33l.06-.06a2 2 0 0 1 2.83 0 2 2 0 0 1 0 2.83l-.06.06a1.65 1.65 0 0 0-.33 1.82V9a1.65 1.65 0 0 0 1.51 1H21a2 2 0 0 1 2 2 2 2 0 0 1-2 2h-.09a1.65 1.65 0 0 0-1.51 1z" />
|
|
836
|
-
</svg>
|
|
837
|
-
);
|
|
838
|
-
}
|
|
839
|
-
|
|
840
|
-
function UserPlusIcon({ className }: { className?: string }) {
|
|
841
|
-
return (
|
|
842
|
-
<svg className={className} viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round">
|
|
843
|
-
<path d="M16 21v-2a4 4 0 0 0-4-4H5a4 4 0 0 0-4 4v2" />
|
|
844
|
-
<circle cx="8.5" cy="7" r="4" />
|
|
845
|
-
<line x1="20" y1="8" x2="20" y2="14" />
|
|
846
|
-
<line x1="23" y1="11" x2="17" y2="11" />
|
|
847
|
-
</svg>
|
|
848
|
-
);
|
|
849
|
-
}
|
|
850
|
-
|
|
851
|
-
function UserMinusIcon({ className }: { className?: string }) {
|
|
852
|
-
return (
|
|
853
|
-
<svg className={className} viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round">
|
|
854
|
-
<path d="M16 21v-2a4 4 0 0 0-4-4H5a4 4 0 0 0-4 4v2" />
|
|
855
|
-
<circle cx="8.5" cy="7" r="4" />
|
|
856
|
-
<line x1="23" y1="11" x2="17" y2="11" />
|
|
857
|
-
</svg>
|
|
858
|
-
);
|
|
859
|
-
}
|
|
860
|
-
|
|
861
|
-
function XIcon({ className }: { className?: string }) {
|
|
862
|
-
return (
|
|
863
|
-
<svg className={className} viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round">
|
|
864
|
-
<line x1="18" y1="6" x2="6" y2="18" />
|
|
865
|
-
<line x1="6" y1="6" x2="18" y2="18" />
|
|
866
|
-
</svg>
|
|
867
|
-
);
|
|
868
|
-
}
|
|
869
|
-
|
|
870
|
-
// =============================================================================
|
|
871
|
-
// Channel Settings Modal (Task 10)
|
|
872
|
-
// =============================================================================
|
|
873
|
-
|
|
874
|
-
export interface ChannelSettingsModalProps {
|
|
875
|
-
channel: Channel;
|
|
876
|
-
isOpen: boolean;
|
|
877
|
-
onClose: () => void;
|
|
878
|
-
onSave: (updates: { name?: string; description?: string; isPrivate?: boolean }) => void;
|
|
879
|
-
isLoading?: boolean;
|
|
880
|
-
error?: string;
|
|
881
|
-
existingChannelNames?: string[];
|
|
882
|
-
}
|
|
883
|
-
|
|
884
|
-
export function ChannelSettingsModal({
|
|
885
|
-
channel,
|
|
886
|
-
isOpen,
|
|
887
|
-
onClose,
|
|
888
|
-
onSave,
|
|
889
|
-
isLoading = false,
|
|
890
|
-
error,
|
|
891
|
-
existingChannelNames = [],
|
|
892
|
-
}: ChannelSettingsModalProps) {
|
|
893
|
-
const [name, setName] = useState(channel.name);
|
|
894
|
-
const [description, setDescription] = useState(channel.description || '');
|
|
895
|
-
const [isPrivate, setIsPrivate] = useState(channel.visibility === 'private');
|
|
896
|
-
|
|
897
|
-
// Reset form when channel changes
|
|
898
|
-
React.useEffect(() => {
|
|
899
|
-
setName(channel.name);
|
|
900
|
-
setDescription(channel.description || '');
|
|
901
|
-
setIsPrivate(channel.visibility === 'private');
|
|
902
|
-
}, [channel]);
|
|
903
|
-
|
|
904
|
-
const handleClose = useCallback(() => {
|
|
905
|
-
setName(channel.name);
|
|
906
|
-
setDescription(channel.description || '');
|
|
907
|
-
setIsPrivate(channel.visibility === 'private');
|
|
908
|
-
onClose();
|
|
909
|
-
}, [channel, onClose]);
|
|
910
|
-
|
|
911
|
-
const handleSubmit = useCallback((e: React.FormEvent) => {
|
|
912
|
-
e.preventDefault();
|
|
913
|
-
|
|
914
|
-
// Build changes object (only include changed fields)
|
|
915
|
-
const changes: { name?: string; description?: string; isPrivate?: boolean } = {};
|
|
916
|
-
const normalizedName = name.trim().toLowerCase().replace(/\s+/g, '-');
|
|
917
|
-
|
|
918
|
-
if (normalizedName !== channel.name) {
|
|
919
|
-
changes.name = normalizedName;
|
|
920
|
-
}
|
|
921
|
-
if (description.trim() !== (channel.description || '')) {
|
|
922
|
-
changes.description = description.trim();
|
|
923
|
-
}
|
|
924
|
-
if (isPrivate !== (channel.visibility === 'private')) {
|
|
925
|
-
changes.isPrivate = isPrivate;
|
|
926
|
-
}
|
|
927
|
-
|
|
928
|
-
if (Object.keys(changes).length > 0) {
|
|
929
|
-
onSave(changes);
|
|
930
|
-
}
|
|
931
|
-
}, [name, description, isPrivate, channel, onSave]);
|
|
932
|
-
|
|
933
|
-
if (!isOpen) return null;
|
|
934
|
-
|
|
935
|
-
// Validate channel name
|
|
936
|
-
const normalizedName = name.trim().toLowerCase().replace(/\s+/g, '-');
|
|
937
|
-
const nameChanged = normalizedName !== channel.name;
|
|
938
|
-
const nameExists = nameChanged && existingChannelNames.includes(normalizedName);
|
|
939
|
-
const isValidName = normalizedName.length >= 2 && normalizedName.length <= 80 && /^[a-z0-9-]+$/.test(normalizedName);
|
|
940
|
-
|
|
941
|
-
// Check if form has changes
|
|
942
|
-
const hasChanges = nameChanged ||
|
|
943
|
-
description.trim() !== (channel.description || '') ||
|
|
944
|
-
isPrivate !== (channel.visibility === 'private');
|
|
945
|
-
|
|
946
|
-
const canSave = hasChanges && isValidName && !nameExists;
|
|
947
|
-
|
|
948
|
-
return (
|
|
949
|
-
<Dialog onClose={handleClose}>
|
|
950
|
-
<form onSubmit={handleSubmit} className="p-6 w-[400px] max-w-full">
|
|
951
|
-
<div className="flex items-center gap-3 mb-6">
|
|
952
|
-
<div className="w-10 h-10 rounded-full bg-accent-cyan/10 flex items-center justify-center">
|
|
953
|
-
<SettingsIcon className="w-5 h-5 text-accent-cyan" />
|
|
954
|
-
</div>
|
|
955
|
-
<h2 className="text-lg font-semibold text-text-primary">
|
|
956
|
-
Channel Settings
|
|
957
|
-
</h2>
|
|
958
|
-
</div>
|
|
959
|
-
|
|
960
|
-
{error && (
|
|
961
|
-
<div className="mb-4 p-3 bg-red-500/10 border border-red-500/20 rounded-lg">
|
|
962
|
-
<p className="text-sm text-red-400">{error}</p>
|
|
963
|
-
</div>
|
|
964
|
-
)}
|
|
965
|
-
|
|
966
|
-
{/* Channel Name */}
|
|
967
|
-
<div className="mb-4">
|
|
968
|
-
<label className="block text-sm font-medium text-text-primary mb-1.5">
|
|
969
|
-
Channel name
|
|
970
|
-
</label>
|
|
971
|
-
<div className="relative">
|
|
972
|
-
<span className="absolute left-3 top-1/2 -translate-y-1/2 text-text-muted">#</span>
|
|
973
|
-
<input
|
|
974
|
-
type="text"
|
|
975
|
-
value={name}
|
|
976
|
-
onChange={(e) => setName(e.target.value)}
|
|
977
|
-
className="w-full pl-7 pr-3 py-2 bg-bg-tertiary border border-border-subtle rounded-lg text-text-primary text-sm focus:outline-none focus:border-accent-cyan/50"
|
|
978
|
-
/>
|
|
979
|
-
</div>
|
|
980
|
-
{name && !isValidName && (
|
|
981
|
-
<p className="mt-1 text-xs text-red-400">
|
|
982
|
-
Channel names must be 2-80 characters, lowercase letters, numbers, and hyphens only
|
|
983
|
-
</p>
|
|
984
|
-
)}
|
|
985
|
-
{nameExists && (
|
|
986
|
-
<p className="mt-1 text-xs text-red-400">
|
|
987
|
-
A channel with this name already exists
|
|
988
|
-
</p>
|
|
989
|
-
)}
|
|
990
|
-
</div>
|
|
991
|
-
|
|
992
|
-
{/* Description */}
|
|
993
|
-
<div className="mb-4">
|
|
994
|
-
<label className="block text-sm font-medium text-text-primary mb-1.5">
|
|
995
|
-
Description <span className="text-text-muted font-normal">(optional)</span>
|
|
996
|
-
</label>
|
|
997
|
-
<textarea
|
|
998
|
-
value={description}
|
|
999
|
-
onChange={(e) => setDescription(e.target.value)}
|
|
1000
|
-
placeholder="What's this channel about?"
|
|
1001
|
-
rows={2}
|
|
1002
|
-
className="w-full px-3 py-2 bg-bg-tertiary border border-border-subtle rounded-lg text-text-primary text-sm focus:outline-none focus:border-accent-cyan/50 resize-none"
|
|
1003
|
-
/>
|
|
1004
|
-
</div>
|
|
1005
|
-
|
|
1006
|
-
{/* Visibility */}
|
|
1007
|
-
<div className="mb-6">
|
|
1008
|
-
<label className="block text-sm font-medium text-text-primary mb-2">
|
|
1009
|
-
Visibility
|
|
1010
|
-
</label>
|
|
1011
|
-
<div className="space-y-2">
|
|
1012
|
-
<label className="flex items-start gap-3 p-3 bg-bg-tertiary rounded-lg cursor-pointer hover:bg-bg-hover transition-colors">
|
|
1013
|
-
<input
|
|
1014
|
-
type="radio"
|
|
1015
|
-
name="visibility"
|
|
1016
|
-
checked={!isPrivate}
|
|
1017
|
-
onChange={() => setIsPrivate(false)}
|
|
1018
|
-
className="mt-0.5"
|
|
1019
|
-
/>
|
|
1020
|
-
<div>
|
|
1021
|
-
<div className="flex items-center gap-2 text-sm font-medium text-text-primary">
|
|
1022
|
-
<HashIcon className="w-4 h-4" />
|
|
1023
|
-
Public
|
|
1024
|
-
</div>
|
|
1025
|
-
<p className="text-xs text-text-muted mt-0.5">
|
|
1026
|
-
Anyone in the workspace can view and join
|
|
1027
|
-
</p>
|
|
1028
|
-
</div>
|
|
1029
|
-
</label>
|
|
1030
|
-
<label className="flex items-start gap-3 p-3 bg-bg-tertiary rounded-lg cursor-pointer hover:bg-bg-hover transition-colors">
|
|
1031
|
-
<input
|
|
1032
|
-
type="radio"
|
|
1033
|
-
name="visibility"
|
|
1034
|
-
checked={isPrivate}
|
|
1035
|
-
onChange={() => setIsPrivate(true)}
|
|
1036
|
-
className="mt-0.5"
|
|
1037
|
-
/>
|
|
1038
|
-
<div>
|
|
1039
|
-
<div className="flex items-center gap-2 text-sm font-medium text-text-primary">
|
|
1040
|
-
<LockIcon className="w-4 h-4" />
|
|
1041
|
-
Private
|
|
1042
|
-
</div>
|
|
1043
|
-
<p className="text-xs text-text-muted mt-0.5">
|
|
1044
|
-
Only invited members can view and join
|
|
1045
|
-
</p>
|
|
1046
|
-
</div>
|
|
1047
|
-
</label>
|
|
1048
|
-
</div>
|
|
1049
|
-
</div>
|
|
1050
|
-
|
|
1051
|
-
{/* Actions */}
|
|
1052
|
-
<div className="flex justify-end gap-3">
|
|
1053
|
-
<button
|
|
1054
|
-
type="button"
|
|
1055
|
-
onClick={handleClose}
|
|
1056
|
-
disabled={isLoading}
|
|
1057
|
-
className="px-4 py-2 text-sm font-medium text-text-secondary bg-bg-tertiary hover:bg-bg-hover rounded-lg transition-colors disabled:opacity-50"
|
|
1058
|
-
>
|
|
1059
|
-
Cancel
|
|
1060
|
-
</button>
|
|
1061
|
-
<button
|
|
1062
|
-
type="submit"
|
|
1063
|
-
disabled={!canSave || isLoading}
|
|
1064
|
-
className="px-4 py-2 text-sm font-medium bg-accent-cyan text-bg-deep hover:bg-accent-cyan/90 rounded-lg transition-colors disabled:opacity-50 disabled:cursor-not-allowed flex items-center gap-2"
|
|
1065
|
-
>
|
|
1066
|
-
{isLoading && <LoadingSpinner className="w-4 h-4" />}
|
|
1067
|
-
Save Changes
|
|
1068
|
-
</button>
|
|
1069
|
-
</div>
|
|
1070
|
-
</form>
|
|
1071
|
-
</Dialog>
|
|
1072
|
-
);
|
|
1073
|
-
}
|
|
1074
|
-
|
|
1075
|
-
// =============================================================================
|
|
1076
|
-
// Member Management Panel (Task 10)
|
|
1077
|
-
// =============================================================================
|
|
1078
|
-
|
|
1079
|
-
export interface MemberManagementPanelProps {
|
|
1080
|
-
channel: Channel;
|
|
1081
|
-
members: ChannelMember[];
|
|
1082
|
-
isOpen: boolean;
|
|
1083
|
-
onClose: () => void;
|
|
1084
|
-
onAddMember: (memberId: string, memberType: 'user' | 'agent', role: 'admin' | 'member' | 'read_only') => void;
|
|
1085
|
-
onRemoveMember: (memberId: string, memberType: 'user' | 'agent') => void;
|
|
1086
|
-
onUpdateRole: (memberId: string, memberType: 'user' | 'agent', role: 'admin' | 'member' | 'read_only') => void;
|
|
1087
|
-
currentUserId?: string;
|
|
1088
|
-
isLoading?: boolean;
|
|
1089
|
-
availableUsers?: { id: string; name: string }[];
|
|
1090
|
-
availableAgents?: { name: string }[];
|
|
1091
|
-
/** Workspace ID for fetching available members (cloud mode) */
|
|
1092
|
-
workspaceId?: string;
|
|
1093
|
-
}
|
|
1094
|
-
|
|
1095
|
-
export function MemberManagementPanel({
|
|
1096
|
-
channel,
|
|
1097
|
-
members,
|
|
1098
|
-
isOpen,
|
|
1099
|
-
onClose,
|
|
1100
|
-
onAddMember,
|
|
1101
|
-
onRemoveMember,
|
|
1102
|
-
onUpdateRole,
|
|
1103
|
-
currentUserId,
|
|
1104
|
-
isLoading = false,
|
|
1105
|
-
availableUsers: propAvailableUsers = [],
|
|
1106
|
-
availableAgents: propAvailableAgents = [],
|
|
1107
|
-
workspaceId,
|
|
1108
|
-
}: MemberManagementPanelProps) {
|
|
1109
|
-
const [showAddMember, setShowAddMember] = useState(false);
|
|
1110
|
-
const [addMemberType, setAddMemberType] = useState<'user' | 'agent'>('user');
|
|
1111
|
-
const [selectedMemberId, setSelectedMemberId] = useState('');
|
|
1112
|
-
const [selectedRole, setSelectedRole] = useState<'admin' | 'member' | 'read_only'>('member');
|
|
1113
|
-
const [fetchedUsers, setFetchedUsers] = useState<AvailableMember[]>([]);
|
|
1114
|
-
const [fetchedAgents, setFetchedAgents] = useState<AvailableMember[]>([]);
|
|
1115
|
-
const [isFetching, setIsFetching] = useState(false);
|
|
1116
|
-
|
|
1117
|
-
// Fetch available members when modal opens
|
|
1118
|
-
useEffect(() => {
|
|
1119
|
-
if (isOpen) {
|
|
1120
|
-
setIsFetching(true);
|
|
1121
|
-
getAvailableMembers(workspaceId)
|
|
1122
|
-
.then(({ members: users, agents }) => {
|
|
1123
|
-
setFetchedUsers(users);
|
|
1124
|
-
setFetchedAgents(agents);
|
|
1125
|
-
})
|
|
1126
|
-
.catch((err) => {
|
|
1127
|
-
console.error('[MemberManagementPanel] Failed to fetch available members:', err);
|
|
1128
|
-
})
|
|
1129
|
-
.finally(() => {
|
|
1130
|
-
setIsFetching(false);
|
|
1131
|
-
});
|
|
1132
|
-
}
|
|
1133
|
-
}, [isOpen, workspaceId]);
|
|
1134
|
-
|
|
1135
|
-
// Combine fetched data with props for backwards compatibility
|
|
1136
|
-
const availableUsers = fetchedUsers.length > 0
|
|
1137
|
-
? fetchedUsers.map(u => ({ id: u.id, name: u.displayName || u.id }))
|
|
1138
|
-
: propAvailableUsers;
|
|
1139
|
-
const availableAgents = fetchedAgents.length > 0
|
|
1140
|
-
? fetchedAgents.map(a => ({ name: a.displayName || a.id }))
|
|
1141
|
-
: propAvailableAgents;
|
|
1142
|
-
|
|
1143
|
-
if (!isOpen) return null;
|
|
1144
|
-
|
|
1145
|
-
// Separate users and agents
|
|
1146
|
-
const userMembers = members.filter(m => m.entityType === 'user');
|
|
1147
|
-
const agentMembers = members.filter(m => m.entityType === 'agent');
|
|
1148
|
-
|
|
1149
|
-
// Get current user's role
|
|
1150
|
-
const currentMember = members.find(m => m.id === currentUserId);
|
|
1151
|
-
const canManageMembers = currentMember?.role === 'owner' || currentMember?.role === 'admin';
|
|
1152
|
-
|
|
1153
|
-
// Count admins to prevent removing the last one
|
|
1154
|
-
const adminCount = members.filter(m => m.role === 'owner' || m.role === 'admin').length;
|
|
1155
|
-
|
|
1156
|
-
// Filter out already added members from available lists
|
|
1157
|
-
const memberIds = new Set(members.map(m => m.id));
|
|
1158
|
-
const filteredUsers = availableUsers.filter(u => !memberIds.has(u.id));
|
|
1159
|
-
const filteredAgents = availableAgents.filter(a => !members.some(m => m.displayName === a.name && m.entityType === 'agent'));
|
|
1160
|
-
|
|
1161
|
-
const handleAddMember = () => {
|
|
1162
|
-
if (!selectedMemberId) return;
|
|
1163
|
-
onAddMember(selectedMemberId, addMemberType, selectedRole);
|
|
1164
|
-
setSelectedMemberId('');
|
|
1165
|
-
setShowAddMember(false);
|
|
1166
|
-
};
|
|
1167
|
-
|
|
1168
|
-
const canRemoveMember = (member: ChannelMember) => {
|
|
1169
|
-
// Cannot remove owner
|
|
1170
|
-
if (member.role === 'owner') return false;
|
|
1171
|
-
// Cannot remove last admin
|
|
1172
|
-
if ((member.role === 'admin') && adminCount <= 1) return false;
|
|
1173
|
-
// Cannot remove self (use leave channel instead)
|
|
1174
|
-
if (member.id === currentUserId) return false;
|
|
1175
|
-
return canManageMembers;
|
|
1176
|
-
};
|
|
1177
|
-
|
|
1178
|
-
const canChangeRole = (member: ChannelMember) => {
|
|
1179
|
-
// Cannot change owner's role
|
|
1180
|
-
if (member.role === 'owner') return false;
|
|
1181
|
-
// Cannot demote last admin
|
|
1182
|
-
if ((member.role === 'admin') && adminCount <= 1) return false;
|
|
1183
|
-
return canManageMembers;
|
|
1184
|
-
};
|
|
1185
|
-
|
|
1186
|
-
return (
|
|
1187
|
-
<Dialog onClose={onClose}>
|
|
1188
|
-
<div className="p-6 w-[500px] max-w-full max-h-[80vh] overflow-hidden flex flex-col">
|
|
1189
|
-
<div className="flex items-center justify-between mb-4">
|
|
1190
|
-
<div className="flex items-center gap-3">
|
|
1191
|
-
<div className="w-10 h-10 rounded-full bg-accent-cyan/10 flex items-center justify-center">
|
|
1192
|
-
<UserPlusIcon className="w-5 h-5 text-accent-cyan" />
|
|
1193
|
-
</div>
|
|
1194
|
-
<div>
|
|
1195
|
-
<h2 className="text-lg font-semibold text-text-primary">
|
|
1196
|
-
Members
|
|
1197
|
-
</h2>
|
|
1198
|
-
<p className="text-sm text-text-muted">
|
|
1199
|
-
#{channel.name} · {members.length} {members.length === 1 ? 'member' : 'members'}
|
|
1200
|
-
</p>
|
|
1201
|
-
</div>
|
|
1202
|
-
</div>
|
|
1203
|
-
{canManageMembers && (
|
|
1204
|
-
<button
|
|
1205
|
-
onClick={() => setShowAddMember(!showAddMember)}
|
|
1206
|
-
className="px-3 py-1.5 text-sm font-medium bg-accent-cyan/20 text-accent-cyan hover:bg-accent-cyan/30 rounded-lg transition-colors"
|
|
1207
|
-
>
|
|
1208
|
-
{showAddMember ? 'Cancel' : 'Add Member'}
|
|
1209
|
-
</button>
|
|
1210
|
-
)}
|
|
1211
|
-
</div>
|
|
1212
|
-
|
|
1213
|
-
{/* Add Member Form */}
|
|
1214
|
-
{showAddMember && canManageMembers && (
|
|
1215
|
-
<div className="mb-4 p-4 bg-bg-tertiary rounded-lg border border-border-subtle">
|
|
1216
|
-
<div className="flex gap-2 mb-3">
|
|
1217
|
-
<button
|
|
1218
|
-
onClick={() => setAddMemberType('user')}
|
|
1219
|
-
className={`px-3 py-1.5 text-sm rounded-lg transition-colors ${
|
|
1220
|
-
addMemberType === 'user'
|
|
1221
|
-
? 'bg-accent-cyan text-bg-deep'
|
|
1222
|
-
: 'bg-bg-hover text-text-secondary hover:text-text-primary'
|
|
1223
|
-
}`}
|
|
1224
|
-
>
|
|
1225
|
-
User
|
|
1226
|
-
</button>
|
|
1227
|
-
<button
|
|
1228
|
-
onClick={() => setAddMemberType('agent')}
|
|
1229
|
-
className={`px-3 py-1.5 text-sm rounded-lg transition-colors ${
|
|
1230
|
-
addMemberType === 'agent'
|
|
1231
|
-
? 'bg-accent-cyan text-bg-deep'
|
|
1232
|
-
: 'bg-bg-hover text-text-secondary hover:text-text-primary'
|
|
1233
|
-
}`}
|
|
1234
|
-
>
|
|
1235
|
-
Agent
|
|
1236
|
-
</button>
|
|
1237
|
-
</div>
|
|
1238
|
-
|
|
1239
|
-
<div className="flex gap-2 mb-3">
|
|
1240
|
-
<select
|
|
1241
|
-
value={selectedMemberId}
|
|
1242
|
-
onChange={(e) => setSelectedMemberId(e.target.value)}
|
|
1243
|
-
className="flex-1 px-3 py-2 bg-bg-deep border border-border-subtle rounded-lg text-text-primary text-sm focus:outline-none focus:border-accent-cyan/50"
|
|
1244
|
-
disabled={isFetching}
|
|
1245
|
-
>
|
|
1246
|
-
<option value="">
|
|
1247
|
-
{isFetching ? 'Loading...' : `Select ${addMemberType}...`}
|
|
1248
|
-
</option>
|
|
1249
|
-
{addMemberType === 'user'
|
|
1250
|
-
? filteredUsers.map(u => (
|
|
1251
|
-
<option key={u.id} value={u.id}>{u.name}</option>
|
|
1252
|
-
))
|
|
1253
|
-
: filteredAgents.map(a => (
|
|
1254
|
-
<option key={a.name} value={a.name}>{a.name}</option>
|
|
1255
|
-
))}
|
|
1256
|
-
</select>
|
|
1257
|
-
<select
|
|
1258
|
-
value={selectedRole}
|
|
1259
|
-
onChange={(e) => setSelectedRole(e.target.value as 'admin' | 'member' | 'read_only')}
|
|
1260
|
-
className="px-3 py-2 bg-bg-deep border border-border-subtle rounded-lg text-text-primary text-sm focus:outline-none focus:border-accent-cyan/50"
|
|
1261
|
-
>
|
|
1262
|
-
<option value="member">Member</option>
|
|
1263
|
-
<option value="admin">Admin</option>
|
|
1264
|
-
<option value="read_only">Read Only</option>
|
|
1265
|
-
</select>
|
|
1266
|
-
</div>
|
|
1267
|
-
|
|
1268
|
-
<button
|
|
1269
|
-
onClick={handleAddMember}
|
|
1270
|
-
disabled={!selectedMemberId || isLoading}
|
|
1271
|
-
className="w-full px-3 py-2 text-sm font-medium bg-accent-cyan text-bg-deep hover:bg-accent-cyan/90 rounded-lg transition-colors disabled:opacity-50 disabled:cursor-not-allowed"
|
|
1272
|
-
>
|
|
1273
|
-
Add {addMemberType === 'user' ? 'User' : 'Agent'}
|
|
1274
|
-
</button>
|
|
1275
|
-
</div>
|
|
1276
|
-
)}
|
|
1277
|
-
|
|
1278
|
-
{/* Members List */}
|
|
1279
|
-
<div className="flex-1 overflow-y-auto space-y-4">
|
|
1280
|
-
{/* Users */}
|
|
1281
|
-
{userMembers.length > 0 && (
|
|
1282
|
-
<div>
|
|
1283
|
-
<h3 className="text-xs font-medium text-text-muted uppercase mb-2">Users ({userMembers.length})</h3>
|
|
1284
|
-
<div className="space-y-1">
|
|
1285
|
-
{userMembers.map((member) => (
|
|
1286
|
-
<MemberRow
|
|
1287
|
-
key={member.id}
|
|
1288
|
-
member={member}
|
|
1289
|
-
canChangeRole={canChangeRole(member)}
|
|
1290
|
-
canRemove={canRemoveMember(member)}
|
|
1291
|
-
onChangeRole={(role) => onUpdateRole(member.id, 'user', role)}
|
|
1292
|
-
onRemove={() => onRemoveMember(member.id, 'user')}
|
|
1293
|
-
isCurrentUser={member.id === currentUserId}
|
|
1294
|
-
/>
|
|
1295
|
-
))}
|
|
1296
|
-
</div>
|
|
1297
|
-
</div>
|
|
1298
|
-
)}
|
|
1299
|
-
|
|
1300
|
-
{/* Agents */}
|
|
1301
|
-
{agentMembers.length > 0 && (
|
|
1302
|
-
<div>
|
|
1303
|
-
<h3 className="text-xs font-medium text-text-muted uppercase mb-2">Agents ({agentMembers.length})</h3>
|
|
1304
|
-
<div className="space-y-1">
|
|
1305
|
-
{agentMembers.map((member) => (
|
|
1306
|
-
<MemberRow
|
|
1307
|
-
key={member.id}
|
|
1308
|
-
member={member}
|
|
1309
|
-
canChangeRole={canChangeRole(member)}
|
|
1310
|
-
canRemove={canRemoveMember(member)}
|
|
1311
|
-
onChangeRole={(role) => onUpdateRole(member.id, 'agent', role)}
|
|
1312
|
-
onRemove={() => onRemoveMember(member.id, 'agent')}
|
|
1313
|
-
isAgent
|
|
1314
|
-
/>
|
|
1315
|
-
))}
|
|
1316
|
-
</div>
|
|
1317
|
-
</div>
|
|
1318
|
-
)}
|
|
1319
|
-
</div>
|
|
1320
|
-
|
|
1321
|
-
{/* Footer */}
|
|
1322
|
-
<div className="mt-4 pt-4 border-t border-border-subtle">
|
|
1323
|
-
<button
|
|
1324
|
-
onClick={onClose}
|
|
1325
|
-
className="w-full px-4 py-2 text-sm font-medium text-text-secondary bg-bg-tertiary hover:bg-bg-hover rounded-lg transition-colors"
|
|
1326
|
-
>
|
|
1327
|
-
Done
|
|
1328
|
-
</button>
|
|
1329
|
-
</div>
|
|
1330
|
-
</div>
|
|
1331
|
-
</Dialog>
|
|
1332
|
-
);
|
|
1333
|
-
}
|
|
1334
|
-
|
|
1335
|
-
function MemberRow({
|
|
1336
|
-
member,
|
|
1337
|
-
canChangeRole,
|
|
1338
|
-
canRemove,
|
|
1339
|
-
onChangeRole,
|
|
1340
|
-
onRemove,
|
|
1341
|
-
isCurrentUser,
|
|
1342
|
-
isAgent,
|
|
1343
|
-
}: {
|
|
1344
|
-
member: ChannelMember;
|
|
1345
|
-
canChangeRole: boolean;
|
|
1346
|
-
canRemove: boolean;
|
|
1347
|
-
onChangeRole: (role: 'admin' | 'member' | 'read_only') => void;
|
|
1348
|
-
onRemove: () => void;
|
|
1349
|
-
isCurrentUser?: boolean;
|
|
1350
|
-
isAgent?: boolean;
|
|
1351
|
-
}) {
|
|
1352
|
-
return (
|
|
1353
|
-
<div className="flex items-center justify-between p-2 rounded-lg hover:bg-bg-tertiary group">
|
|
1354
|
-
<div className="flex items-center gap-3">
|
|
1355
|
-
<div className={`w-8 h-8 rounded-full flex items-center justify-center text-xs font-medium ${
|
|
1356
|
-
isAgent ? 'bg-purple-500/20 text-purple-400' : 'bg-accent-cyan/20 text-accent-cyan'
|
|
1357
|
-
}`}>
|
|
1358
|
-
{(member.displayName || member.id)[0].toUpperCase()}
|
|
1359
|
-
</div>
|
|
1360
|
-
<div>
|
|
1361
|
-
<div className="flex items-center gap-2">
|
|
1362
|
-
<span className="text-sm font-medium text-text-primary">
|
|
1363
|
-
{member.displayName || member.id}
|
|
1364
|
-
</span>
|
|
1365
|
-
{isCurrentUser && (
|
|
1366
|
-
<span className="text-xs text-text-muted">(you)</span>
|
|
1367
|
-
)}
|
|
1368
|
-
{isAgent && (
|
|
1369
|
-
<span className="text-xs px-1.5 py-0.5 bg-purple-500/20 text-purple-400 rounded">
|
|
1370
|
-
Agent
|
|
1371
|
-
</span>
|
|
1372
|
-
)}
|
|
1373
|
-
</div>
|
|
1374
|
-
<span className={`text-xs capitalize ${
|
|
1375
|
-
member.role === 'owner' ? 'text-yellow-400' :
|
|
1376
|
-
member.role === 'admin' ? 'text-accent-cyan' :
|
|
1377
|
-
'text-text-muted'
|
|
1378
|
-
}`}>
|
|
1379
|
-
{member.role}
|
|
1380
|
-
</span>
|
|
1381
|
-
</div>
|
|
1382
|
-
</div>
|
|
1383
|
-
|
|
1384
|
-
<div className="flex items-center gap-2 opacity-0 group-hover:opacity-100 transition-opacity">
|
|
1385
|
-
{canChangeRole && (
|
|
1386
|
-
<select
|
|
1387
|
-
value={member.role === 'owner' ? 'admin' : member.role}
|
|
1388
|
-
onChange={(e) => onChangeRole(e.target.value as 'admin' | 'member' | 'read_only')}
|
|
1389
|
-
className="px-2 py-1 text-xs bg-bg-tertiary border border-border-subtle rounded text-text-primary focus:outline-none focus:border-accent-cyan/50"
|
|
1390
|
-
>
|
|
1391
|
-
<option value="admin">Admin</option>
|
|
1392
|
-
<option value="member">Member</option>
|
|
1393
|
-
<option value="read_only">Read Only</option>
|
|
1394
|
-
</select>
|
|
1395
|
-
)}
|
|
1396
|
-
{canRemove && (
|
|
1397
|
-
<button
|
|
1398
|
-
onClick={onRemove}
|
|
1399
|
-
className="p-1.5 text-red-400 hover:bg-red-500/20 rounded transition-colors"
|
|
1400
|
-
title="Remove member"
|
|
1401
|
-
>
|
|
1402
|
-
<UserMinusIcon className="w-4 h-4" />
|
|
1403
|
-
</button>
|
|
1404
|
-
)}
|
|
1405
|
-
</div>
|
|
1406
|
-
</div>
|
|
1407
|
-
);
|
|
1408
|
-
}
|
|
1409
|
-
|
|
1410
|
-
// Type import for Channel and ChannelMember
|
|
1411
|
-
import type { ChannelMember } from './types';
|