@agent-relay/dashboard 2.0.80 → 2.0.82

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.
Files changed (244) hide show
  1. package/out/404.html +1 -1
  2. package/out/_next/static/chunks/{118-4c8241b0218335de.js → 118-ae2b650136a5a5fc.js} +1 -1
  3. package/out/_next/static/chunks/407-0c82986cf79c8ecb.js +1 -0
  4. package/out/_next/static/chunks/app/app/[[...slug]]/{page-1e81c047cff17212.js → page-f7eca1b66fb4249b.js} +1 -1
  5. package/out/_next/static/chunks/app/{page-6892fe2dd07fb48b.js → page-0ee604f7070d14c0.js} +1 -1
  6. package/out/_next/static/css/8968d98ed4c4d33f.css +1 -0
  7. package/out/about.html +2 -2
  8. package/out/about.txt +1 -1
  9. package/out/app/onboarding.html +1 -1
  10. package/out/app/onboarding.txt +1 -1
  11. package/out/app.html +1 -1
  12. package/out/app.txt +2 -2
  13. package/out/blog/go-to-bed-wake-up-to-a-finished-product.html +2 -2
  14. package/out/blog/go-to-bed-wake-up-to-a-finished-product.txt +1 -1
  15. package/out/blog/let-them-cook-multi-agent-orchestration.html +2 -2
  16. package/out/blog/let-them-cook-multi-agent-orchestration.txt +2 -2
  17. package/out/blog.html +2 -2
  18. package/out/blog.txt +1 -1
  19. package/out/careers.html +2 -2
  20. package/out/careers.txt +1 -1
  21. package/out/changelog.html +2 -2
  22. package/out/changelog.txt +1 -1
  23. package/out/cloud/link.html +1 -1
  24. package/out/cloud/link.txt +2 -2
  25. package/out/complete-profile.html +2 -2
  26. package/out/complete-profile.txt +1 -1
  27. package/out/connect-repos.html +1 -1
  28. package/out/connect-repos.txt +1 -1
  29. package/out/contact.html +2 -2
  30. package/out/contact.txt +1 -1
  31. package/out/docs.html +2 -2
  32. package/out/docs.txt +1 -1
  33. package/out/history.html +1 -1
  34. package/out/history.txt +2 -2
  35. package/out/index.html +1 -1
  36. package/out/index.txt +2 -2
  37. package/out/login.html +2 -2
  38. package/out/login.txt +1 -1
  39. package/out/metrics.html +1 -1
  40. package/out/metrics.txt +2 -2
  41. package/out/pricing.html +2 -2
  42. package/out/pricing.txt +1 -1
  43. package/out/privacy.html +2 -2
  44. package/out/privacy.txt +1 -1
  45. package/out/providers/setup/claude.html +1 -1
  46. package/out/providers/setup/claude.txt +1 -1
  47. package/out/providers/setup/codex.html +1 -1
  48. package/out/providers/setup/codex.txt +1 -1
  49. package/out/providers/setup/cursor.html +1 -1
  50. package/out/providers/setup/cursor.txt +1 -1
  51. package/out/providers.html +1 -1
  52. package/out/providers.txt +1 -1
  53. package/out/security.html +2 -2
  54. package/out/security.txt +1 -1
  55. package/out/signup.html +2 -2
  56. package/out/signup.txt +1 -1
  57. package/out/terms.html +2 -2
  58. package/out/terms.txt +1 -1
  59. package/package.json +7 -1
  60. package/src/app/about/page.tsx +7 -0
  61. package/src/app/app/[[...slug]]/DashboardPageClient.tsx +853 -0
  62. package/src/app/app/[[...slug]]/page.tsx +23 -0
  63. package/src/app/app/onboarding/page.tsx +394 -0
  64. package/src/app/apple-icon.png +0 -0
  65. package/src/app/blog/go-to-bed-wake-up-to-a-finished-product/page.tsx +88 -0
  66. package/src/app/blog/let-them-cook-multi-agent-orchestration/page.tsx +93 -0
  67. package/src/app/blog/page.tsx +15 -0
  68. package/src/app/careers/page.tsx +7 -0
  69. package/src/app/changelog/page.tsx +7 -0
  70. package/src/app/cloud/link/page.tsx +464 -0
  71. package/src/app/complete-profile/page.tsx +204 -0
  72. package/src/app/connect-repos/page.tsx +410 -0
  73. package/src/app/contact/page.tsx +7 -0
  74. package/src/app/docs/page.tsx +7 -0
  75. package/src/app/favicon.png +0 -0
  76. package/src/app/globals.css +200 -0
  77. package/src/app/history/page.tsx +658 -0
  78. package/src/app/layout.tsx +25 -0
  79. package/src/app/login/page.tsx +424 -0
  80. package/src/app/metrics/page.tsx +781 -0
  81. package/src/app/page.tsx +59 -0
  82. package/src/app/pricing/page.tsx +7 -0
  83. package/src/app/privacy/page.tsx +7 -0
  84. package/src/app/providers/page.tsx +193 -0
  85. package/src/app/providers/setup/[provider]/ProviderSetupClient.tsx +197 -0
  86. package/src/app/providers/setup/[provider]/constants.ts +35 -0
  87. package/src/app/providers/setup/[provider]/page.tsx +42 -0
  88. package/src/app/security/page.tsx +7 -0
  89. package/src/app/signup/page.tsx +533 -0
  90. package/src/app/terms/page.tsx +7 -0
  91. package/src/components/ActivityFeed.tsx +216 -0
  92. package/src/components/AddWorkspaceModal.tsx +170 -0
  93. package/src/components/AgentCard.test.tsx +134 -0
  94. package/src/components/AgentCard.tsx +585 -0
  95. package/src/components/AgentList.test.tsx +147 -0
  96. package/src/components/AgentList.tsx +419 -0
  97. package/src/components/AgentLogPreview.tsx +173 -0
  98. package/src/components/AgentProfilePanel.tsx +569 -0
  99. package/src/components/App.tsx +3424 -0
  100. package/src/components/BillingPanel.tsx +922 -0
  101. package/src/components/BillingResult.tsx +447 -0
  102. package/src/components/BroadcastComposer.tsx +690 -0
  103. package/src/components/ChannelAdminPanel.tsx +773 -0
  104. package/src/components/ChannelBrowser.tsx +385 -0
  105. package/src/components/ChannelChat.tsx +261 -0
  106. package/src/components/ChannelSidebar.tsx +399 -0
  107. package/src/components/CloudSessionProvider.tsx +130 -0
  108. package/src/components/CommandPalette.tsx +815 -0
  109. package/src/components/ConfirmationDialog.tsx +133 -0
  110. package/src/components/ConversationHistory.tsx +518 -0
  111. package/src/components/CoordinatorPanel.tsx +956 -0
  112. package/src/components/DecisionQueue.tsx +717 -0
  113. package/src/components/DirectMessageView.tsx +164 -0
  114. package/src/components/FileAutocomplete.tsx +368 -0
  115. package/src/components/FleetOverview.tsx +278 -0
  116. package/src/components/LogViewer.tsx +310 -0
  117. package/src/components/LogViewerPanel.tsx +482 -0
  118. package/src/components/Logo.tsx +284 -0
  119. package/src/components/MentionAutocomplete.tsx +384 -0
  120. package/src/components/MessageComposer.tsx +473 -0
  121. package/src/components/MessageList.tsx +725 -0
  122. package/src/components/MessageSenderName.tsx +91 -0
  123. package/src/components/MessageStatusIndicator.tsx +142 -0
  124. package/src/components/NewConversationModal.tsx +400 -0
  125. package/src/components/NotificationToast.tsx +488 -0
  126. package/src/components/OnlineUsersIndicator.tsx +164 -0
  127. package/src/components/Pagination.tsx +124 -0
  128. package/src/components/PricingPlans.tsx +386 -0
  129. package/src/components/ProjectList.tsx +711 -0
  130. package/src/components/ProviderAuthFlow.tsx +343 -0
  131. package/src/components/ProviderConnectionList.tsx +375 -0
  132. package/src/components/ProvisioningProgress.tsx +730 -0
  133. package/src/components/ReactionChips.tsx +70 -0
  134. package/src/components/ReactionPicker.tsx +121 -0
  135. package/src/components/RepoAccessPanel.tsx +787 -0
  136. package/src/components/RepositoriesPanel.tsx +901 -0
  137. package/src/components/ServerCard.tsx +202 -0
  138. package/src/components/SessionExpiredModal.tsx +128 -0
  139. package/src/components/SpawnModal.test.tsx +190 -0
  140. package/src/components/SpawnModal.tsx +1001 -0
  141. package/src/components/TaskAssignmentUI.tsx +375 -0
  142. package/src/components/TerminalProviderSetup.tsx +517 -0
  143. package/src/components/ThemeProvider.tsx +159 -0
  144. package/src/components/ThinkingIndicator.tsx +231 -0
  145. package/src/components/ThreadList.tsx +198 -0
  146. package/src/components/ThreadPanel.tsx +405 -0
  147. package/src/components/TrajectoryViewer.tsx +698 -0
  148. package/src/components/TypingIndicator.tsx +69 -0
  149. package/src/components/UsageBanner.tsx +231 -0
  150. package/src/components/UserProfilePanel.tsx +233 -0
  151. package/src/components/WorkspaceContext.tsx +95 -0
  152. package/src/components/WorkspaceSelector.tsx +234 -0
  153. package/src/components/WorkspaceStatusIndicator.tsx +396 -0
  154. package/src/components/XTermInteractive.tsx +516 -0
  155. package/src/components/XTermLogViewer.tsx +719 -0
  156. package/src/components/channels/ChannelDialogs.tsx +1411 -0
  157. package/src/components/channels/ChannelHeader.tsx +317 -0
  158. package/src/components/channels/ChannelMessageList.tsx +463 -0
  159. package/src/components/channels/ChannelViewV1.tsx +146 -0
  160. package/src/components/channels/MessageInput.tsx +302 -0
  161. package/src/components/channels/SearchInput.tsx +172 -0
  162. package/src/components/channels/SearchResults.tsx +336 -0
  163. package/src/components/channels/api.test.ts +1527 -0
  164. package/src/components/channels/api.ts +703 -0
  165. package/src/components/channels/index.ts +76 -0
  166. package/src/components/channels/mockApi.ts +344 -0
  167. package/src/components/channels/types.ts +566 -0
  168. package/src/components/hooks/index.ts +58 -0
  169. package/src/components/hooks/useAgentLogs.ts +504 -0
  170. package/src/components/hooks/useAgents.ts +127 -0
  171. package/src/components/hooks/useBroadcastDedup.test.ts +371 -0
  172. package/src/components/hooks/useBroadcastDedup.ts +86 -0
  173. package/src/components/hooks/useChannelAdmin.ts +329 -0
  174. package/src/components/hooks/useChannelBrowser.ts +239 -0
  175. package/src/components/hooks/useChannelCommands.ts +138 -0
  176. package/src/components/hooks/useChannels.ts +367 -0
  177. package/src/components/hooks/useDebounce.ts +29 -0
  178. package/src/components/hooks/useDirectMessage.test.ts +952 -0
  179. package/src/components/hooks/useDirectMessage.ts +141 -0
  180. package/src/components/hooks/useMessages.ts +310 -0
  181. package/src/components/hooks/useOrchestrator.test.ts +165 -0
  182. package/src/components/hooks/useOrchestrator.ts +424 -0
  183. package/src/components/hooks/usePinnedAgents.test.ts +356 -0
  184. package/src/components/hooks/usePinnedAgents.ts +140 -0
  185. package/src/components/hooks/usePresence.test.ts +245 -0
  186. package/src/components/hooks/usePresence.ts +377 -0
  187. package/src/components/hooks/useRecentRepos.ts +130 -0
  188. package/src/components/hooks/useSession.ts +209 -0
  189. package/src/components/hooks/useThread.ts +138 -0
  190. package/src/components/hooks/useTrajectory.ts +265 -0
  191. package/src/components/hooks/useWebSocket.ts +290 -0
  192. package/src/components/hooks/useWorkspaceMembers.ts +132 -0
  193. package/src/components/hooks/useWorkspaceRepos.ts +73 -0
  194. package/src/components/hooks/useWorkspaceStatus.ts +237 -0
  195. package/src/components/index.ts +81 -0
  196. package/src/components/layout/Header.tsx +311 -0
  197. package/src/components/layout/RepoContextHeader.tsx +361 -0
  198. package/src/components/layout/Sidebar.archive.test.tsx +126 -0
  199. package/src/components/layout/Sidebar.test.tsx +691 -0
  200. package/src/components/layout/Sidebar.tsx +900 -0
  201. package/src/components/layout/index.ts +7 -0
  202. package/src/components/settings/BillingSettingsPanel.tsx +564 -0
  203. package/src/components/settings/SettingsPage.tsx +683 -0
  204. package/src/components/settings/TeamSettingsPanel.tsx +560 -0
  205. package/src/components/settings/WorkspaceSettingsPanel.tsx +1368 -0
  206. package/src/components/settings/index.ts +11 -0
  207. package/src/components/settings/types.ts +79 -0
  208. package/src/components/utils/messageFormatting.test.tsx +331 -0
  209. package/src/components/utils/messageFormatting.tsx +597 -0
  210. package/src/index.ts +63 -0
  211. package/src/landing/AboutPage.tsx +77 -0
  212. package/src/landing/BlogContent.tsx +187 -0
  213. package/src/landing/BlogPage.tsx +47 -0
  214. package/src/landing/CareersPage.tsx +53 -0
  215. package/src/landing/ChangelogPage.tsx +33 -0
  216. package/src/landing/ContactPage.tsx +41 -0
  217. package/src/landing/DocsPage.tsx +43 -0
  218. package/src/landing/LandingPage.tsx +702 -0
  219. package/src/landing/PricingPage.tsx +549 -0
  220. package/src/landing/PrivacyPage.tsx +117 -0
  221. package/src/landing/SecurityPage.tsx +42 -0
  222. package/src/landing/StaticPage.tsx +165 -0
  223. package/src/landing/TermsPage.tsx +125 -0
  224. package/src/landing/blogData.ts +312 -0
  225. package/src/landing/index.ts +18 -0
  226. package/src/landing/styles.css +3673 -0
  227. package/src/lib/agent-merge.test.ts +43 -0
  228. package/src/lib/agent-merge.ts +35 -0
  229. package/src/lib/api.ts +1294 -0
  230. package/src/lib/cloudApi.ts +893 -0
  231. package/src/lib/colors.test.ts +175 -0
  232. package/src/lib/colors.ts +218 -0
  233. package/src/lib/config.ts +109 -0
  234. package/src/lib/hierarchy.ts +242 -0
  235. package/src/lib/stuckDetection.ts +142 -0
  236. package/src/lib/useUrlRouting.ts +190 -0
  237. package/src/types/index.ts +317 -0
  238. package/src/types/threading.ts +7 -0
  239. package/out/_next/static/chunks/285-dc644487a8d6500d.js +0 -1
  240. package/out/_next/static/css/4c58d9cf493aa626.css +0 -1
  241. /package/out/_next/static/{AqelRhy1vr2nBUcU0Iqcp → IxfA6RZu4trcsEMYlkQra}/_buildManifest.js +0 -0
  242. /package/out/_next/static/{AqelRhy1vr2nBUcU0Iqcp → IxfA6RZu4trcsEMYlkQra}/_ssgManifest.js +0 -0
  243. /package/out/_next/static/chunks/{528-d375bc8b46912d2c.js → 528-f5f676996d613c25.js} +0 -0
  244. /package/out/_next/static/chunks/app/blog/let-them-cook-multi-agent-orchestration/{page-a58308f43557b908.js → page-b194f207fbd91862.js} +0 -0
@@ -0,0 +1,683 @@
1
+ /**
2
+ * Unified Settings Page
3
+ *
4
+ * Full-page settings view with tabbed navigation for:
5
+ * - Dashboard Settings (personal preferences)
6
+ * - Workspace Settings (repos, providers, domains)
7
+ * - Team Settings (members, invitations)
8
+ * - Billing Settings (subscription, plans)
9
+ *
10
+ * Design: Mission Control theme - deep space aesthetic with cyan/purple accents
11
+ */
12
+
13
+ import React, { useState, useEffect, useCallback } from 'react';
14
+ import { cloudApi, getCsrfToken } from '../../lib/cloudApi';
15
+ import { WorkspaceSettingsPanel } from './WorkspaceSettingsPanel';
16
+ import { TeamSettingsPanel } from './TeamSettingsPanel';
17
+ import { BillingSettingsPanel } from './BillingSettingsPanel';
18
+ import type { Settings, CliType } from './types';
19
+ import { CLAUDE_MODEL_OPTIONS, CURSOR_MODEL_OPTIONS, CODEX_MODEL_OPTIONS, GEMINI_MODEL_OPTIONS } from '../SpawnModal';
20
+
21
+ export interface SettingsPageProps {
22
+ /** Current user ID for team membership checks */
23
+ currentUserId?: string;
24
+ /** Initial tab to show */
25
+ initialTab?: 'dashboard' | 'workspace' | 'team' | 'billing';
26
+ /** Callback when settings page is closed */
27
+ onClose?: () => void;
28
+ /** Current dashboard settings */
29
+ settings: Settings;
30
+ /** Update dashboard settings */
31
+ onUpdateSettings: (updater: (prev: Settings) => Settings) => void;
32
+ /** Active workspace ID from parent (synced with App.tsx) */
33
+ activeWorkspaceId?: string | null;
34
+ /** Callback when repos are added/removed in workspace settings */
35
+ onReposChanged?: () => void;
36
+ }
37
+
38
+ interface WorkspaceSummary {
39
+ id: string;
40
+ name: string;
41
+ status: string;
42
+ }
43
+
44
+ export function SettingsPage({
45
+ currentUserId,
46
+ initialTab = 'dashboard',
47
+ onClose,
48
+ settings,
49
+ onUpdateSettings,
50
+ activeWorkspaceId,
51
+ onReposChanged,
52
+ }: SettingsPageProps) {
53
+ const [activeTab, setActiveTab] = useState<'dashboard' | 'workspace' | 'team' | 'billing'>(initialTab);
54
+ const [workspaces, setWorkspaces] = useState<WorkspaceSummary[]>([]);
55
+ // Initialize with activeWorkspaceId from parent if provided
56
+ const [selectedWorkspaceId, setSelectedWorkspaceId] = useState<string | null>(activeWorkspaceId ?? null);
57
+ const [isLoadingWorkspaces, setIsLoadingWorkspaces] = useState(true);
58
+
59
+ // Sync selectedWorkspaceId when activeWorkspaceId prop changes
60
+ useEffect(() => {
61
+ if (activeWorkspaceId) {
62
+ setSelectedWorkspaceId(activeWorkspaceId);
63
+ }
64
+ }, [activeWorkspaceId]);
65
+
66
+ // Load workspaces
67
+ useEffect(() => {
68
+ async function loadWorkspaces() {
69
+ setIsLoadingWorkspaces(true);
70
+ const result = await cloudApi.getWorkspaceSummary();
71
+ if (result.success && result.data.workspaces.length > 0) {
72
+ setWorkspaces(result.data.workspaces);
73
+ // Only auto-select first workspace if no workspace is selected
74
+ // (either from prop or previous user selection)
75
+ if (!selectedWorkspaceId) {
76
+ setSelectedWorkspaceId(result.data.workspaces[0].id);
77
+ }
78
+ }
79
+ setIsLoadingWorkspaces(false);
80
+ }
81
+ loadWorkspaces();
82
+ }, [selectedWorkspaceId]);
83
+
84
+ const updateSettings = useCallback((updater: (prev: Settings) => Settings) => {
85
+ onUpdateSettings(updater);
86
+ }, [onUpdateSettings]);
87
+
88
+ const updateNotifications = useCallback((updates: Partial<Settings['notifications']>) => {
89
+ updateSettings((prev) => {
90
+ const nextNotifications = { ...prev.notifications, ...updates };
91
+ return {
92
+ ...prev,
93
+ notifications: {
94
+ ...nextNotifications,
95
+ enabled: nextNotifications.sound || nextNotifications.desktop || nextNotifications.mentionsOnly,
96
+ },
97
+ };
98
+ });
99
+ }, [updateSettings]);
100
+
101
+ const tabs = [
102
+ { id: 'dashboard', label: 'Dashboard', icon: <DashboardIcon /> },
103
+ { id: 'workspace', label: 'Workspace', icon: <WorkspaceIcon /> },
104
+ { id: 'team', label: 'Team', icon: <TeamIcon /> },
105
+ { id: 'billing', label: 'Billing', icon: <BillingIcon /> },
106
+ ] as const;
107
+
108
+ return (
109
+ <div className="fixed inset-0 z-[1100] bg-bg-deep">
110
+ {/* Background Pattern */}
111
+ <div className="absolute inset-0 opacity-30">
112
+ <div className="absolute inset-0 bg-[radial-gradient(ellipse_at_top_right,_rgba(0,217,255,0.08)_0%,_transparent_50%)]" />
113
+ <div className="absolute inset-0 bg-[radial-gradient(ellipse_at_bottom_left,_rgba(168,85,247,0.06)_0%,_transparent_50%)]" />
114
+ </div>
115
+
116
+ <div className="relative h-full flex flex-col">
117
+ {/* Header */}
118
+ <header className="h-14 md:h-16 px-4 md:px-6 flex items-center justify-between border-b border-border-subtle bg-bg-secondary/80 backdrop-blur-sm">
119
+ <div className="flex items-center gap-3 md:gap-4">
120
+ <div className="w-8 h-8 md:w-10 md:h-10 rounded-xl bg-gradient-to-br from-accent-cyan to-accent-purple flex items-center justify-center shadow-lg shadow-accent-cyan/20">
121
+ <SettingsIcon className="text-white w-4 h-4 md:w-[18px] md:h-[18px]" />
122
+ </div>
123
+ <div>
124
+ <h1 className="text-base md:text-lg font-bold text-text-primary tracking-tight">Settings</h1>
125
+ <p className="text-[10px] md:text-xs text-text-muted hidden sm:block">Manage your workspace and preferences</p>
126
+ </div>
127
+ </div>
128
+
129
+ <button
130
+ onClick={onClose}
131
+ className="w-9 h-9 md:w-10 md:h-10 rounded-lg bg-bg-tertiary border border-border-subtle flex items-center justify-center text-text-muted hover:text-text-primary hover:bg-bg-hover transition-colors"
132
+ >
133
+ <CloseIcon />
134
+ </button>
135
+ </header>
136
+
137
+ {/* Tab Navigation - Always visible, horizontally scrollable on mobile */}
138
+ <div className="border-b border-border-subtle bg-bg-secondary/50">
139
+ <div
140
+ className="flex sm:justify-center overflow-x-auto scrollbar-hide scroll-smooth snap-x snap-mandatory touch-pan-x"
141
+ style={{ WebkitOverflowScrolling: 'touch' }}
142
+ >
143
+ {tabs.map((tab) => (
144
+ <button
145
+ key={tab.id}
146
+ onClick={() => setActiveTab(tab.id)}
147
+ className={`flex items-center gap-2 px-4 sm:px-6 py-3 text-sm font-medium transition-all whitespace-nowrap shrink-0 snap-start ${
148
+ activeTab === tab.id
149
+ ? 'text-accent-cyan border-b-2 border-accent-cyan bg-accent-cyan/5'
150
+ : 'text-text-muted border-b-2 border-transparent hover:text-text-secondary'
151
+ }`}
152
+ >
153
+ <span className={activeTab === tab.id ? 'text-accent-cyan' : 'text-text-muted'}>
154
+ {tab.icon}
155
+ </span>
156
+ {tab.label}
157
+ </button>
158
+ ))}
159
+ </div>
160
+ </div>
161
+
162
+ {/* Workspace Selector - Shows when workspace/team tabs active */}
163
+ {(activeTab === 'workspace' || activeTab === 'team') && workspaces.length > 0 && (
164
+ <div className="px-4 py-2 border-b border-border-subtle bg-bg-tertiary/50">
165
+ <div className="flex items-center gap-2">
166
+ <div
167
+ className={`w-2 h-2 rounded-full shrink-0 ${
168
+ workspaces.find(ws => ws.id === selectedWorkspaceId)?.status === 'running'
169
+ ? 'bg-success'
170
+ : workspaces.find(ws => ws.id === selectedWorkspaceId)?.status === 'stopped'
171
+ ? 'bg-amber-400'
172
+ : 'bg-text-muted'
173
+ }`}
174
+ />
175
+ {workspaces.length === 1 ? (
176
+ <span className="text-sm text-text-primary">{workspaces[0].name}</span>
177
+ ) : (
178
+ <select
179
+ value={selectedWorkspaceId || ''}
180
+ onChange={(e) => setSelectedWorkspaceId(e.target.value)}
181
+ className="flex-1 px-3 py-2 bg-bg-card border border-border-subtle rounded-lg text-sm text-text-primary focus:outline-none focus:border-accent-cyan"
182
+ >
183
+ {workspaces.map((ws) => (
184
+ <option key={ws.id} value={ws.id}>{ws.name}</option>
185
+ ))}
186
+ </select>
187
+ )}
188
+ </div>
189
+ </div>
190
+ )}
191
+
192
+ {/* Content */}
193
+ <div className="flex-1 overflow-hidden">
194
+ {/* Main Content */}
195
+ <main className="h-full w-full overflow-y-auto">
196
+ <div className="w-full max-w-4xl mx-auto p-4 md:p-8">
197
+ {/* Dashboard Settings */}
198
+ {activeTab === 'dashboard' && (
199
+ <div className="space-y-8">
200
+ <PageHeader
201
+ title="Dashboard Settings"
202
+ subtitle="Customize your dashboard experience"
203
+ />
204
+
205
+ {/* Appearance */}
206
+ <SettingsSection title="Appearance" icon={<PaletteIcon />}>
207
+ <SettingRow
208
+ label="Theme"
209
+ description="Choose your preferred color scheme"
210
+ >
211
+ <select
212
+ value={settings.theme}
213
+ onChange={(e) => updateSettings((prev) => ({
214
+ ...prev,
215
+ theme: e.target.value as Settings['theme'],
216
+ }))}
217
+ className="px-4 py-2 bg-bg-tertiary border border-border-subtle rounded-lg text-sm text-text-primary focus:outline-none focus:border-accent-cyan"
218
+ >
219
+ <option value="dark">Dark</option>
220
+ <option value="light">Light</option>
221
+ <option value="system">System</option>
222
+ </select>
223
+ </SettingRow>
224
+
225
+ <SettingRow
226
+ label="Compact Mode"
227
+ description="Reduce spacing and show more content"
228
+ >
229
+ <Toggle
230
+ checked={settings.display.compactMode}
231
+ onChange={(v) => updateSettings((prev) => ({
232
+ ...prev,
233
+ display: {
234
+ ...prev.display,
235
+ compactMode: v,
236
+ },
237
+ }))}
238
+ />
239
+ </SettingRow>
240
+
241
+ <SettingRow
242
+ label="Show Timestamps"
243
+ description="Display timestamps on messages"
244
+ >
245
+ <Toggle
246
+ checked={settings.display.showTimestamps}
247
+ onChange={(v) => updateSettings((prev) => ({
248
+ ...prev,
249
+ display: {
250
+ ...prev.display,
251
+ showTimestamps: v,
252
+ },
253
+ }))}
254
+ />
255
+ </SettingRow>
256
+ </SettingsSection>
257
+
258
+ {/* Notifications */}
259
+ <SettingsSection title="Notifications" icon={<BellIcon />}>
260
+ <SettingRow
261
+ label="Sound Effects"
262
+ description="Play sounds for new messages"
263
+ >
264
+ <Toggle
265
+ checked={settings.notifications.sound}
266
+ onChange={(v) => updateNotifications({ sound: v })}
267
+ />
268
+ </SettingRow>
269
+
270
+ <SettingRow
271
+ label="Browser Notifications"
272
+ description="Show desktop notifications"
273
+ >
274
+ <Toggle
275
+ checked={settings.notifications.desktop}
276
+ onChange={(v) => updateNotifications({ desktop: v })}
277
+ />
278
+ </SettingRow>
279
+ </SettingsSection>
280
+
281
+ {/* Behavior */}
282
+ <SettingsSection title="Behavior" icon={<SettingsIcon />}>
283
+ <SettingRow
284
+ label="Auto-scroll Messages"
285
+ description="Automatically scroll to new messages"
286
+ >
287
+ <Toggle
288
+ checked={settings.messages.autoScroll}
289
+ onChange={(v) => updateSettings((prev) => ({
290
+ ...prev,
291
+ messages: {
292
+ ...prev.messages,
293
+ autoScroll: v,
294
+ },
295
+ }))}
296
+ />
297
+ </SettingRow>
298
+ </SettingsSection>
299
+
300
+ {/* Agent Defaults */}
301
+ <SettingsSection title="Agent Defaults" icon={<RocketIcon />}>
302
+ <SettingRow
303
+ label="Default Agent Type"
304
+ description="Pre-select an agent type when spawning"
305
+ >
306
+ <select
307
+ value={settings.agentDefaults?.defaultCliType ?? ''}
308
+ onChange={(e) => updateSettings((prev) => ({
309
+ ...prev,
310
+ agentDefaults: {
311
+ ...prev.agentDefaults,
312
+ defaultCliType: e.target.value === '' ? null : e.target.value as CliType,
313
+ },
314
+ }))}
315
+ className="px-4 py-2 bg-bg-tertiary border border-border-subtle rounded-lg text-sm text-text-primary focus:outline-none focus:border-accent-cyan"
316
+ >
317
+ <option value="">None (show all templates)</option>
318
+ <option value="claude">Claude</option>
319
+ <option value="codex">Codex</option>
320
+ <option value="gemini">Gemini</option>
321
+ <option value="cursor">Cursor</option>
322
+ <option value="custom">Custom</option>
323
+ </select>
324
+ </SettingRow>
325
+
326
+ <SettingRow
327
+ label="Default Claude Model"
328
+ description="Default model when spawning Claude agents"
329
+ >
330
+ <select
331
+ value={settings.agentDefaults?.defaultModels?.claude ?? 'sonnet'}
332
+ onChange={(e) => updateSettings((prev) => ({
333
+ ...prev,
334
+ agentDefaults: {
335
+ ...prev.agentDefaults,
336
+ defaultModels: {
337
+ ...prev.agentDefaults?.defaultModels,
338
+ claude: e.target.value,
339
+ },
340
+ },
341
+ }))}
342
+ className="px-4 py-2 bg-bg-tertiary border border-border-subtle rounded-lg text-sm text-text-primary focus:outline-none focus:border-accent-cyan"
343
+ >
344
+ {CLAUDE_MODEL_OPTIONS.map((model) => (
345
+ <option key={model.value} value={model.value}>{model.label}</option>
346
+ ))}
347
+ </select>
348
+ </SettingRow>
349
+
350
+ <SettingRow
351
+ label="Default Cursor Model"
352
+ description="Default model when spawning Cursor agents"
353
+ >
354
+ <select
355
+ value={settings.agentDefaults?.defaultModels?.cursor ?? 'opus-4.5-thinking'}
356
+ onChange={(e) => updateSettings((prev) => ({
357
+ ...prev,
358
+ agentDefaults: {
359
+ ...prev.agentDefaults,
360
+ defaultModels: {
361
+ ...prev.agentDefaults?.defaultModels,
362
+ cursor: e.target.value,
363
+ },
364
+ },
365
+ }))}
366
+ className="px-4 py-2 bg-bg-tertiary border border-border-subtle rounded-lg text-sm text-text-primary focus:outline-none focus:border-accent-cyan"
367
+ >
368
+ {CURSOR_MODEL_OPTIONS.map((model) => (
369
+ <option key={model.value} value={model.value}>{model.label}</option>
370
+ ))}
371
+ </select>
372
+ </SettingRow>
373
+
374
+ <SettingRow
375
+ label="Default Codex Model"
376
+ description="Default model when spawning Codex agents"
377
+ >
378
+ <select
379
+ value={settings.agentDefaults?.defaultModels?.codex ?? 'gpt-5.2-codex'}
380
+ onChange={(e) => updateSettings((prev) => ({
381
+ ...prev,
382
+ agentDefaults: {
383
+ ...prev.agentDefaults,
384
+ defaultModels: {
385
+ ...prev.agentDefaults?.defaultModels,
386
+ codex: e.target.value,
387
+ },
388
+ },
389
+ }))}
390
+ className="px-4 py-2 bg-bg-tertiary border border-border-subtle rounded-lg text-sm text-text-primary focus:outline-none focus:border-accent-cyan"
391
+ >
392
+ {CODEX_MODEL_OPTIONS.map((model) => (
393
+ <option key={model.value} value={model.value}>{model.label}</option>
394
+ ))}
395
+ </select>
396
+ </SettingRow>
397
+
398
+ <SettingRow
399
+ label="Default Gemini Model"
400
+ description="Default model when spawning Gemini agents"
401
+ >
402
+ <select
403
+ value={settings.agentDefaults?.defaultModels?.gemini ?? 'gemini-2.5-pro'}
404
+ onChange={(e) => updateSettings((prev) => ({
405
+ ...prev,
406
+ agentDefaults: {
407
+ ...prev.agentDefaults,
408
+ defaultModels: {
409
+ ...prev.agentDefaults?.defaultModels,
410
+ gemini: e.target.value,
411
+ },
412
+ },
413
+ }))}
414
+ className="px-4 py-2 bg-bg-tertiary border border-border-subtle rounded-lg text-sm text-text-primary focus:outline-none focus:border-accent-cyan"
415
+ >
416
+ {GEMINI_MODEL_OPTIONS.map((model) => (
417
+ <option key={model.value} value={model.value}>{model.label}</option>
418
+ ))}
419
+ </select>
420
+ </SettingRow>
421
+ </SettingsSection>
422
+ </div>
423
+ )}
424
+
425
+ {/* Workspace Settings */}
426
+ {activeTab === 'workspace' && (
427
+ <>
428
+ {isLoadingWorkspaces ? (
429
+ <div className="flex items-center justify-center h-64">
430
+ <div className="relative">
431
+ <div className="w-12 h-12 rounded-full border-2 border-accent-cyan/20 border-t-accent-cyan animate-spin" />
432
+ </div>
433
+ <span className="ml-4 text-text-muted">Loading workspaces...</span>
434
+ </div>
435
+ ) : selectedWorkspaceId ? (
436
+ <WorkspaceSettingsPanel
437
+ workspaceId={selectedWorkspaceId}
438
+ csrfToken={getCsrfToken() || undefined}
439
+ onClose={onClose}
440
+ onReposChanged={onReposChanged}
441
+ />
442
+ ) : (
443
+ <EmptyState
444
+ icon={<WorkspaceIcon />}
445
+ title="No Workspace"
446
+ description="Create a workspace to get started with Agent Relay."
447
+ action={
448
+ <button className="px-6 py-3 bg-accent-cyan text-bg-deep font-semibold rounded-lg hover:bg-accent-cyan/90 transition-colors">
449
+ Create Workspace
450
+ </button>
451
+ }
452
+ />
453
+ )}
454
+ </>
455
+ )}
456
+
457
+ {/* Team Settings */}
458
+ {activeTab === 'team' && (
459
+ <>
460
+ {selectedWorkspaceId ? (
461
+ <div className="space-y-8">
462
+ <PageHeader
463
+ title="Team Settings"
464
+ subtitle="Manage workspace members and permissions"
465
+ />
466
+ <TeamSettingsPanel
467
+ workspaceId={selectedWorkspaceId}
468
+ currentUserId={currentUserId}
469
+ />
470
+ </div>
471
+ ) : (
472
+ <EmptyState
473
+ icon={<TeamIcon />}
474
+ title="No Workspace Selected"
475
+ description="Select a workspace to manage team members."
476
+ />
477
+ )}
478
+ </>
479
+ )}
480
+
481
+ {/* Billing Settings */}
482
+ {activeTab === 'billing' && (
483
+ <div className="space-y-8">
484
+ <PageHeader
485
+ title="Billing & Subscription"
486
+ subtitle="Manage your plan and payment methods"
487
+ />
488
+ <BillingSettingsPanel />
489
+ </div>
490
+ )}
491
+ </div>
492
+ </main>
493
+ </div>
494
+ </div>
495
+ </div>
496
+ );
497
+ }
498
+
499
+ // Utility Components
500
+ function PageHeader({ title, subtitle }: { title: string; subtitle: string }) {
501
+ return (
502
+ <div className="mb-6 sm:mb-8">
503
+ <h2 className="text-xl sm:text-2xl font-bold text-text-primary">{title}</h2>
504
+ <p className="text-sm text-text-muted mt-1">{subtitle}</p>
505
+ </div>
506
+ );
507
+ }
508
+
509
+ function SettingsSection({
510
+ title,
511
+ icon,
512
+ children,
513
+ }: {
514
+ title: string;
515
+ icon: React.ReactNode;
516
+ children: React.ReactNode;
517
+ }) {
518
+ return (
519
+ <div className="bg-bg-tertiary rounded-xl border border-border-subtle overflow-hidden">
520
+ <div className="px-4 sm:px-6 py-3 sm:py-4 border-b border-border-subtle bg-bg-secondary/50 flex items-center gap-3">
521
+ <span className="text-accent-cyan">{icon}</span>
522
+ <h3 className="text-sm font-semibold text-text-primary uppercase tracking-wide">{title}</h3>
523
+ </div>
524
+ <div className="divide-y divide-border-subtle">{children}</div>
525
+ </div>
526
+ );
527
+ }
528
+
529
+ function SettingRow({
530
+ label,
531
+ description,
532
+ children,
533
+ }: {
534
+ label: string;
535
+ description: string;
536
+ children: React.ReactNode;
537
+ }) {
538
+ return (
539
+ <div className="px-4 sm:px-6 py-3 sm:py-4 flex items-center justify-between">
540
+ <div>
541
+ <p className="text-sm font-medium text-text-primary">{label}</p>
542
+ <p className="text-xs text-text-muted mt-0.5">{description}</p>
543
+ </div>
544
+ {children}
545
+ </div>
546
+ );
547
+ }
548
+
549
+ function Toggle({
550
+ checked,
551
+ onChange,
552
+ }: {
553
+ checked: boolean;
554
+ onChange: (value: boolean) => void;
555
+ }) {
556
+ return (
557
+ <button
558
+ onClick={() => onChange(!checked)}
559
+ className={`relative w-12 h-6 rounded-full transition-colors ${
560
+ checked ? 'bg-accent-cyan' : 'bg-bg-hover'
561
+ }`}
562
+ >
563
+ <span
564
+ className={`absolute top-1 w-4 h-4 bg-white rounded-full shadow transition-transform ${
565
+ checked ? 'translate-x-7' : 'translate-x-1'
566
+ }`}
567
+ />
568
+ </button>
569
+ );
570
+ }
571
+
572
+ function EmptyState({
573
+ icon,
574
+ title,
575
+ description,
576
+ action,
577
+ }: {
578
+ icon: React.ReactNode;
579
+ title: string;
580
+ description: string;
581
+ action?: React.ReactNode;
582
+ }) {
583
+ return (
584
+ <div className="flex flex-col items-center justify-center h-64 text-center">
585
+ <div className="w-16 h-16 rounded-2xl bg-bg-tertiary flex items-center justify-center text-text-muted mb-4">
586
+ {icon}
587
+ </div>
588
+ <h3 className="text-lg font-semibold text-text-primary mb-2">{title}</h3>
589
+ <p className="text-sm text-text-muted max-w-sm mb-6">{description}</p>
590
+ {action}
591
+ </div>
592
+ );
593
+ }
594
+
595
+ // Icons
596
+ function SettingsIcon({ className = '' }: { className?: string }) {
597
+ return (
598
+ <svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round" className={className}>
599
+ <circle cx="12" cy="12" r="3" />
600
+ <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" />
601
+ </svg>
602
+ );
603
+ }
604
+
605
+ function DashboardIcon() {
606
+ return (
607
+ <svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round">
608
+ <rect x="3" y="3" width="7" height="9" />
609
+ <rect x="14" y="3" width="7" height="5" />
610
+ <rect x="14" y="12" width="7" height="9" />
611
+ <rect x="3" y="16" width="7" height="5" />
612
+ </svg>
613
+ );
614
+ }
615
+
616
+ function WorkspaceIcon() {
617
+ return (
618
+ <svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round">
619
+ <path d="M22 19a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h5l2 3h9a2 2 0 0 1 2 2z" />
620
+ </svg>
621
+ );
622
+ }
623
+
624
+ function TeamIcon() {
625
+ return (
626
+ <svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round">
627
+ <path d="M17 21v-2a4 4 0 0 0-4-4H5a4 4 0 0 0-4 4v2" />
628
+ <circle cx="9" cy="7" r="4" />
629
+ <path d="M23 21v-2a4 4 0 0 0-3-3.87" />
630
+ <path d="M16 3.13a4 4 0 0 1 0 7.75" />
631
+ </svg>
632
+ );
633
+ }
634
+
635
+ function BillingIcon() {
636
+ return (
637
+ <svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round">
638
+ <rect x="1" y="4" width="22" height="16" rx="2" ry="2" />
639
+ <line x1="1" y1="10" x2="23" y2="10" />
640
+ </svg>
641
+ );
642
+ }
643
+
644
+ function CloseIcon() {
645
+ return (
646
+ <svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round">
647
+ <line x1="18" y1="6" x2="6" y2="18" />
648
+ <line x1="6" y1="6" x2="18" y2="18" />
649
+ </svg>
650
+ );
651
+ }
652
+
653
+ function PaletteIcon() {
654
+ return (
655
+ <svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round">
656
+ <circle cx="13.5" cy="6.5" r="2.5" />
657
+ <circle cx="19" cy="13.5" r="2.5" />
658
+ <circle cx="6" cy="12" r="2.5" />
659
+ <circle cx="11" cy="19" r="2.5" />
660
+ <path d="M12 2C6.5 2 2 6.5 2 12s4.5 10 10 10c.926 0 1.648-.746 1.648-1.688 0-.437-.18-.835-.437-1.125-.29-.289-.438-.652-.438-1.125a1.64 1.64 0 0 1 1.668-1.668h1.996c3.051 0 5.555-2.503 5.555-5.555C21.965 6.012 17.461 2 12 2z" />
661
+ </svg>
662
+ );
663
+ }
664
+
665
+ function BellIcon() {
666
+ return (
667
+ <svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round">
668
+ <path d="M18 8A6 6 0 0 0 6 8c0 7-3 9-3 9h18s-3-2-3-9" />
669
+ <path d="M13.73 21a2 2 0 0 1-3.46 0" />
670
+ </svg>
671
+ );
672
+ }
673
+
674
+ function RocketIcon() {
675
+ return (
676
+ <svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round">
677
+ <path d="M4.5 16.5c-1.5 1.26-2 5-2 5s3.74-.5 5-2c.71-.84.7-2.13-.09-2.91a2.18 2.18 0 0 0-2.91-.09z" />
678
+ <path d="m12 15-3-3a22 22 0 0 1 2-3.95A12.88 12.88 0 0 1 22 2c0 2.72-.78 7.5-6 11a22.35 22.35 0 0 1-4 2z" />
679
+ <path d="M9 12H4s.55-3.03 2-4c1.62-1.08 5 0 5 0" />
680
+ <path d="M12 15v5s3.03-.55 4-2c1.08-1.62 0-5 0-5" />
681
+ </svg>
682
+ );
683
+ }