@grackle-ai/web-components 0.107.2

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 (279) hide show
  1. package/.rush/temp/3ae72563f781afd72723475938136f113846603e.untar.log +10 -0
  2. package/.rush/temp/bc1d5bf9201ce71abeaeaddd096deb9b0805d703.untar.log +10 -0
  3. package/.rush/temp/operation/_phase_build/all.log +18 -0
  4. package/.rush/temp/operation/_phase_build/log-chunks.jsonl +18 -0
  5. package/.rush/temp/operation/_phase_build/state.json +3 -0
  6. package/.rush/temp/operation/_phase_test/all.log +121 -0
  7. package/.rush/temp/operation/_phase_test/log-chunks.jsonl +121 -0
  8. package/.rush/temp/operation/_phase_test/state.json +3 -0
  9. package/.rush/temp/shrinkwrap-deps.json +938 -0
  10. package/.storybook/main.ts +22 -0
  11. package/.storybook/preview.tsx +30 -0
  12. package/config/rig.json +4 -0
  13. package/config/rush-project.json +12 -0
  14. package/dist/index.css +1 -0
  15. package/dist/index.js +39221 -0
  16. package/eslint.config.cjs +5 -0
  17. package/package.json +83 -0
  18. package/rush-logs/web-components._phase_build.cache.log +4 -0
  19. package/rush-logs/web-components._phase_test.cache.log +4 -0
  20. package/src/components/chat/ChatInput.module.scss +81 -0
  21. package/src/components/chat/ChatInput.stories.tsx +91 -0
  22. package/src/components/chat/ChatInput.tsx +168 -0
  23. package/src/components/chat/index.ts +6 -0
  24. package/src/components/dag/DagView.module.scss +149 -0
  25. package/src/components/dag/DagView.stories.tsx +125 -0
  26. package/src/components/dag/DagView.tsx +109 -0
  27. package/src/components/dag/TaskNode.stories.tsx +133 -0
  28. package/src/components/dag/TaskNode.tsx +40 -0
  29. package/src/components/dag/useDagLayout.ts +139 -0
  30. package/src/components/display/Breadcrumbs.module.scss +71 -0
  31. package/src/components/display/Breadcrumbs.stories.tsx +80 -0
  32. package/src/components/display/Breadcrumbs.tsx +46 -0
  33. package/src/components/display/Button.module.scss +110 -0
  34. package/src/components/display/Button.stories.tsx +88 -0
  35. package/src/components/display/Button.tsx +40 -0
  36. package/src/components/display/ConfirmDialog.module.scss +67 -0
  37. package/src/components/display/ConfirmDialog.stories.tsx +81 -0
  38. package/src/components/display/ConfirmDialog.tsx +88 -0
  39. package/src/components/display/CopyButton.module.scss +41 -0
  40. package/src/components/display/CopyButton.stories.tsx +78 -0
  41. package/src/components/display/CopyButton.tsx +64 -0
  42. package/src/components/display/DemoBanner.module.scss +37 -0
  43. package/src/components/display/DemoBanner.stories.tsx +40 -0
  44. package/src/components/display/DemoBanner.tsx +23 -0
  45. package/src/components/display/EventHoverRow.module.scss +102 -0
  46. package/src/components/display/EventHoverRow.stories.tsx +99 -0
  47. package/src/components/display/EventHoverRow.tsx +154 -0
  48. package/src/components/display/EventRenderer.module.scss +272 -0
  49. package/src/components/display/EventRenderer.stories.tsx +186 -0
  50. package/src/components/display/EventRenderer.tsx +271 -0
  51. package/src/components/display/EventStream.module.scss +93 -0
  52. package/src/components/display/EventStream.stories.tsx +249 -0
  53. package/src/components/display/EventStream.tsx +369 -0
  54. package/src/components/display/FloatingActionBar.module.scss +107 -0
  55. package/src/components/display/FloatingActionBar.stories.tsx +122 -0
  56. package/src/components/display/FloatingActionBar.tsx +119 -0
  57. package/src/components/display/SessionAttemptSelector.module.scss +50 -0
  58. package/src/components/display/SessionAttemptSelector.stories.tsx +78 -0
  59. package/src/components/display/SessionAttemptSelector.tsx +49 -0
  60. package/src/components/display/SessionPicker.module.scss +200 -0
  61. package/src/components/display/SessionPicker.stories.tsx +169 -0
  62. package/src/components/display/SessionPicker.tsx +214 -0
  63. package/src/components/display/Skeleton.module.scss +58 -0
  64. package/src/components/display/Skeleton.stories.tsx +94 -0
  65. package/src/components/display/Skeleton.tsx +127 -0
  66. package/src/components/display/Spinner.module.scss +41 -0
  67. package/src/components/display/Spinner.stories.tsx +66 -0
  68. package/src/components/display/Spinner.tsx +32 -0
  69. package/src/components/display/SplashScreen.module.scss +20 -0
  70. package/src/components/display/SplashScreen.stories.tsx +26 -0
  71. package/src/components/display/SplashScreen.tsx +16 -0
  72. package/src/components/display/SplitButton.module.scss +166 -0
  73. package/src/components/display/SplitButton.stories.tsx +95 -0
  74. package/src/components/display/SplitButton.tsx +128 -0
  75. package/src/components/display/Tooltip.module.scss +84 -0
  76. package/src/components/display/Tooltip.stories.tsx +240 -0
  77. package/src/components/display/Tooltip.tsx +184 -0
  78. package/src/components/display/extractText.test.tsx +48 -0
  79. package/src/components/display/index.ts +20 -0
  80. package/src/components/editable/EditableCheckbox.stories.tsx +54 -0
  81. package/src/components/editable/EditableCheckbox.tsx +39 -0
  82. package/src/components/editable/EditableField.module.scss +135 -0
  83. package/src/components/editable/EditableSelect.tsx +164 -0
  84. package/src/components/editable/EditableTextArea.stories.tsx +50 -0
  85. package/src/components/editable/EditableTextArea.tsx +148 -0
  86. package/src/components/editable/EditableTextField.stories.tsx +62 -0
  87. package/src/components/editable/EditableTextField.tsx +153 -0
  88. package/src/components/editable/EnvironmentSelect.module.scss +17 -0
  89. package/src/components/editable/EnvironmentSelect.stories.tsx +61 -0
  90. package/src/components/editable/EnvironmentSelect.tsx +87 -0
  91. package/src/components/editable/index.ts +13 -0
  92. package/src/components/editable/useEditableField.test.tsx +233 -0
  93. package/src/components/editable/useEditableField.ts +173 -0
  94. package/src/components/index.ts +20 -0
  95. package/src/components/knowledge/KnowledgeDetailPanel.module.scss +162 -0
  96. package/src/components/knowledge/KnowledgeDetailPanel.stories.tsx +208 -0
  97. package/src/components/knowledge/KnowledgeDetailPanel.tsx +122 -0
  98. package/src/components/knowledge/KnowledgeGraph.module.scss +110 -0
  99. package/src/components/knowledge/KnowledgeGraph.stories.tsx +180 -0
  100. package/src/components/knowledge/KnowledgeGraph.tsx +455 -0
  101. package/src/components/knowledge/KnowledgeNav.module.scss +130 -0
  102. package/src/components/knowledge/KnowledgeNav.stories.tsx +108 -0
  103. package/src/components/knowledge/KnowledgeNav.tsx +138 -0
  104. package/src/components/knowledge/index.ts +3 -0
  105. package/src/components/layout/AppNav.module.scss +82 -0
  106. package/src/components/layout/AppNav.stories.tsx +115 -0
  107. package/src/components/layout/AppNav.tsx +133 -0
  108. package/src/components/layout/BottomStatusBar.module.scss +58 -0
  109. package/src/components/layout/BottomStatusBar.stories.tsx +35 -0
  110. package/src/components/layout/BottomStatusBar.tsx +206 -0
  111. package/src/components/layout/Sidebar.module.scss +60 -0
  112. package/src/components/layout/Sidebar.stories.tsx +46 -0
  113. package/src/components/layout/Sidebar.tsx +84 -0
  114. package/src/components/layout/StatusBar.module.scss +108 -0
  115. package/src/components/layout/StatusBar.stories.tsx +119 -0
  116. package/src/components/layout/StatusBar.tsx +70 -0
  117. package/src/components/layout/index.ts +9 -0
  118. package/src/components/lists/EnvironmentNav.module.scss +118 -0
  119. package/src/components/lists/EnvironmentNav.stories.tsx +121 -0
  120. package/src/components/lists/EnvironmentNav.tsx +133 -0
  121. package/src/components/lists/FindingsNav.module.scss +126 -0
  122. package/src/components/lists/FindingsNav.tsx +146 -0
  123. package/src/components/lists/TaskList.module.scss +206 -0
  124. package/src/components/lists/TaskList.stories.tsx +401 -0
  125. package/src/components/lists/TaskList.tsx +509 -0
  126. package/src/components/lists/index.ts +6 -0
  127. package/src/components/lists/listHelpers.tsx +130 -0
  128. package/src/components/notifications/Callout.module.scss +83 -0
  129. package/src/components/notifications/Callout.stories.tsx +81 -0
  130. package/src/components/notifications/Callout.tsx +64 -0
  131. package/src/components/notifications/Toast.module.scss +86 -0
  132. package/src/components/notifications/Toast.stories.tsx +71 -0
  133. package/src/components/notifications/Toast.tsx +51 -0
  134. package/src/components/notifications/ToastContainer.module.scss +23 -0
  135. package/src/components/notifications/ToastContainer.stories.tsx +66 -0
  136. package/src/components/notifications/ToastContainer.tsx +29 -0
  137. package/src/components/notifications/UpdateBanner.stories.tsx +77 -0
  138. package/src/components/notifications/UpdateBanner.test.tsx +64 -0
  139. package/src/components/notifications/UpdateBanner.tsx +44 -0
  140. package/src/components/notifications/index.ts +8 -0
  141. package/src/components/panels/AboutPanel.stories.tsx +70 -0
  142. package/src/components/panels/AboutPanel.tsx +66 -0
  143. package/src/components/panels/AppearancePanel.stories.tsx +45 -0
  144. package/src/components/panels/AppearancePanel.tsx +97 -0
  145. package/src/components/panels/CredentialProvidersPanel.stories.tsx +62 -0
  146. package/src/components/panels/CredentialProvidersPanel.tsx +111 -0
  147. package/src/components/panels/EnvironmentEditPanel.module.scss +170 -0
  148. package/src/components/panels/EnvironmentEditPanel.stories.tsx +206 -0
  149. package/src/components/panels/EnvironmentEditPanel.tsx +785 -0
  150. package/src/components/panels/FindingsPanel.module.scss +94 -0
  151. package/src/components/panels/FindingsPanel.stories.tsx +109 -0
  152. package/src/components/panels/FindingsPanel.tsx +76 -0
  153. package/src/components/panels/KeyboardShortcutsPanel.module.scss +65 -0
  154. package/src/components/panels/KeyboardShortcutsPanel.stories.tsx +40 -0
  155. package/src/components/panels/KeyboardShortcutsPanel.tsx +104 -0
  156. package/src/components/panels/PluginsPanel.tsx +77 -0
  157. package/src/components/panels/SettingsPanel.module.scss +336 -0
  158. package/src/components/panels/TaskActionButtons.module.scss +22 -0
  159. package/src/components/panels/TaskActionButtons.stories.tsx +125 -0
  160. package/src/components/panels/TaskActionButtons.tsx +87 -0
  161. package/src/components/panels/TaskEditPanel.module.scss +202 -0
  162. package/src/components/panels/TaskEditPanel.stories.tsx +75 -0
  163. package/src/components/panels/TaskEditPanel.tsx +328 -0
  164. package/src/components/panels/TaskOverviewPanel.module.scss +236 -0
  165. package/src/components/panels/TaskOverviewPanel.stories.tsx +219 -0
  166. package/src/components/panels/TaskOverviewPanel.tsx +270 -0
  167. package/src/components/panels/TokensPanel.stories.tsx +131 -0
  168. package/src/components/panels/TokensPanel.tsx +143 -0
  169. package/src/components/panels/WorkpadPanel.module.scss +39 -0
  170. package/src/components/panels/WorkpadPanel.stories.tsx +56 -0
  171. package/src/components/panels/WorkpadPanel.tsx +63 -0
  172. package/src/components/panels/index.ts +13 -0
  173. package/src/components/personas/McpToolSelector.module.scss +109 -0
  174. package/src/components/personas/McpToolSelector.stories.tsx +129 -0
  175. package/src/components/personas/McpToolSelector.tsx +180 -0
  176. package/src/components/personas/PersonaManager.module.scss +233 -0
  177. package/src/components/personas/PersonaManager.stories.tsx +139 -0
  178. package/src/components/personas/PersonaManager.tsx +122 -0
  179. package/src/components/schedules/ScheduleManager.module.scss +98 -0
  180. package/src/components/schedules/ScheduleManager.stories.tsx +78 -0
  181. package/src/components/schedules/ScheduleManager.tsx +160 -0
  182. package/src/components/settings/SettingsNav.module.scss +82 -0
  183. package/src/components/settings/SettingsNav.stories.tsx +83 -0
  184. package/src/components/settings/SettingsNav.tsx +104 -0
  185. package/src/components/streams/StreamDetailPanel.module.scss +206 -0
  186. package/src/components/streams/StreamDetailPanel.stories.tsx +132 -0
  187. package/src/components/streams/StreamDetailPanel.tsx +119 -0
  188. package/src/components/streams/StreamList.module.scss +92 -0
  189. package/src/components/streams/StreamList.stories.tsx +99 -0
  190. package/src/components/streams/StreamList.tsx +114 -0
  191. package/src/components/streams/index.ts +10 -0
  192. package/src/components/tools/AgentToolCard.module.scss +118 -0
  193. package/src/components/tools/AgentToolCard.stories.tsx +304 -0
  194. package/src/components/tools/AgentToolCard.tsx +247 -0
  195. package/src/components/tools/FileEditCard.stories.tsx +138 -0
  196. package/src/components/tools/FileEditCard.tsx +160 -0
  197. package/src/components/tools/FileReadCard.stories.tsx +120 -0
  198. package/src/components/tools/FileReadCard.tsx +106 -0
  199. package/src/components/tools/FindingCard.stories.tsx +124 -0
  200. package/src/components/tools/FindingCard.tsx +178 -0
  201. package/src/components/tools/GenericToolCard.stories.tsx +80 -0
  202. package/src/components/tools/GenericToolCard.tsx +111 -0
  203. package/src/components/tools/IpcCard.stories.tsx +129 -0
  204. package/src/components/tools/IpcCard.tsx +178 -0
  205. package/src/components/tools/KnowledgeCard.stories.tsx +112 -0
  206. package/src/components/tools/KnowledgeCard.tsx +165 -0
  207. package/src/components/tools/MetadataCard.stories.tsx +32 -0
  208. package/src/components/tools/MetadataCard.tsx +39 -0
  209. package/src/components/tools/SearchCard.stories.tsx +74 -0
  210. package/src/components/tools/SearchCard.tsx +86 -0
  211. package/src/components/tools/ShellCard.stories.tsx +112 -0
  212. package/src/components/tools/ShellCard.tsx +106 -0
  213. package/src/components/tools/TaskCard.stories.tsx +123 -0
  214. package/src/components/tools/TaskCard.tsx +203 -0
  215. package/src/components/tools/TodoCard.module.scss +131 -0
  216. package/src/components/tools/TodoCard.stories.tsx +202 -0
  217. package/src/components/tools/TodoCard.tsx +200 -0
  218. package/src/components/tools/ToolCard.stories.tsx +177 -0
  219. package/src/components/tools/ToolCard.tsx +60 -0
  220. package/src/components/tools/ToolCardProps.ts +20 -0
  221. package/src/components/tools/ToolSearchCard.stories.tsx +81 -0
  222. package/src/components/tools/ToolSearchCard.tsx +86 -0
  223. package/src/components/tools/WorkpadCard.stories.tsx +106 -0
  224. package/src/components/tools/WorkpadCard.tsx +125 -0
  225. package/src/components/tools/classifyTool.test.ts +44 -0
  226. package/src/components/tools/classifyTool.ts +134 -0
  227. package/src/components/tools/parseDiff.ts +95 -0
  228. package/src/components/tools/parseShellOutput.ts +28 -0
  229. package/src/components/tools/toolCardHelpers.test.ts +53 -0
  230. package/src/components/tools/toolCards.module.scss +234 -0
  231. package/src/components/workspace/WorkspaceBoard.module.scss +238 -0
  232. package/src/components/workspace/WorkspaceBoard.stories.tsx +240 -0
  233. package/src/components/workspace/WorkspaceBoard.tsx +232 -0
  234. package/src/components/workspace/WorkspaceFormFields.module.scss +79 -0
  235. package/src/components/workspace/WorkspaceFormFields.stories.tsx +133 -0
  236. package/src/components/workspace/WorkspaceFormFields.tsx +185 -0
  237. package/src/context/GrackleContext.ts +28 -0
  238. package/src/context/GrackleContextTypes.ts +64 -0
  239. package/src/context/SidebarContext.tsx +53 -0
  240. package/src/context/ThemeContext.tsx +21 -0
  241. package/src/context/ToastContext.tsx +56 -0
  242. package/src/hooks/types.ts +864 -0
  243. package/src/hooks/useEventSelection.test.ts +204 -0
  244. package/src/hooks/useEventSelection.ts +158 -0
  245. package/src/hooks/useSmartScroll.ts +151 -0
  246. package/src/hooks/useTheme.ts +228 -0
  247. package/src/index.ts +210 -0
  248. package/src/mocks/MockGrackleProvider.tsx +1397 -0
  249. package/src/mocks/mockData.ts +1966 -0
  250. package/src/mocks/mockKnowledgeData.ts +294 -0
  251. package/src/scss.d.ts +12 -0
  252. package/src/styles/global.scss +244 -0
  253. package/src/styles/mixins.scss +278 -0
  254. package/src/styles/prism-theme.scss +148 -0
  255. package/src/styles/theme.scss +1102 -0
  256. package/src/test-utils/storybook-decorators.tsx +50 -0
  257. package/src/test-utils/storybook-helpers.ts +262 -0
  258. package/src/themes.ts +142 -0
  259. package/src/utils/boardColumns.ts +141 -0
  260. package/src/utils/breadcrumbs.test.ts +285 -0
  261. package/src/utils/breadcrumbs.ts +222 -0
  262. package/src/utils/dashboard.test.ts +156 -0
  263. package/src/utils/dashboard.ts +195 -0
  264. package/src/utils/eventContent.test.ts +353 -0
  265. package/src/utils/eventContent.ts +209 -0
  266. package/src/utils/findingCategory.ts +33 -0
  267. package/src/utils/format.ts +27 -0
  268. package/src/utils/iconSize.ts +18 -0
  269. package/src/utils/navigation.ts +205 -0
  270. package/src/utils/route-config.test.ts +128 -0
  271. package/src/utils/scrollUtils.test.ts +65 -0
  272. package/src/utils/scrollUtils.ts +49 -0
  273. package/src/utils/sessionEvents.test.ts +302 -0
  274. package/src/utils/sessionEvents.ts +233 -0
  275. package/src/utils/taskStatus.tsx +137 -0
  276. package/src/utils/time.ts +92 -0
  277. package/tsconfig.json +8 -0
  278. package/vite.config.ts +20 -0
  279. package/vitest.config.ts +10 -0
@@ -0,0 +1,160 @@
1
+ import { useState, useMemo, type JSX } from "react";
2
+ import type { PersonaData, ScheduleData, ScheduleUpdate } from "../../hooks/types.js";
3
+ import { Button } from "../display/Button.js";
4
+ import { ConfirmDialog } from "../display/index.js";
5
+ import { formatRelativeTime, formatCountdown } from "../../utils/time.js";
6
+ import styles from "./ScheduleManager.module.scss";
7
+
8
+ /** Props for the ScheduleManager component. */
9
+ export interface ScheduleManagerProps {
10
+ /** All schedules. */
11
+ schedules: ScheduleData[];
12
+ /** All personas — used to resolve persona names. */
13
+ personas: PersonaData[];
14
+ /** Callback to delete a schedule. */
15
+ onDeleteSchedule: (scheduleId: string) => Promise<void>;
16
+ /** Callback to toggle a schedule's enabled state. */
17
+ onToggleEnabled: (scheduleId: string, fields: ScheduleUpdate) => Promise<unknown>;
18
+ /** Navigate to the new schedule page. */
19
+ onNavigateToNew: () => void;
20
+ /** Navigate to a schedule's detail page for editing. */
21
+ onNavigateToSchedule: (scheduleId: string) => void;
22
+ }
23
+
24
+ /** Schedule list view — shows cards and navigates to detail pages for create/edit. */
25
+ export function ScheduleManager({
26
+ schedules, personas,
27
+ onDeleteSchedule, onToggleEnabled,
28
+ onNavigateToNew, onNavigateToSchedule,
29
+ }: ScheduleManagerProps): JSX.Element {
30
+ const [confirmDelete, setConfirmDelete] = useState<string | null>(null);
31
+ const scheduleToDelete = confirmDelete ? schedules.find((s) => s.id === confirmDelete) : undefined;
32
+
33
+ const handleDelete = async (id: string): Promise<void> => {
34
+ await onDeleteSchedule(id);
35
+ setConfirmDelete(null);
36
+ };
37
+
38
+ const personaNameMap = useMemo(() => {
39
+ const map = new Map<string, string>();
40
+ for (const p of personas) {
41
+ map.set(p.id, p.name);
42
+ }
43
+ return map;
44
+ }, [personas]);
45
+
46
+ const resolvePersonaName = (personaId: string): string => personaNameMap.get(personaId) ?? personaId;
47
+
48
+ return (
49
+ <div className={styles.container}>
50
+ <div className={styles.header}>
51
+ <h2>Schedules</h2>
52
+ <Button variant="primary" size="md" onClick={onNavigateToNew} data-testid="schedule-new-button">
53
+ + New Schedule
54
+ </Button>
55
+ </div>
56
+
57
+ {schedules.length === 0 ? (
58
+ <p className={styles.empty} data-testid="schedule-empty-state">
59
+ No schedules yet. Create one to run tasks on a recurring cadence.
60
+ </p>
61
+ ) : (
62
+ <div className={styles.list}>
63
+ {schedules.map((s) => (
64
+ <div
65
+ key={s.id}
66
+ className={styles.card}
67
+ data-testid={`schedule-card-${s.id}`}
68
+ onClick={() => onNavigateToSchedule(s.id)}
69
+ role="button"
70
+ tabIndex={0}
71
+ onKeyDown={(e) => {
72
+ if (e.currentTarget === e.target && (e.key === "Enter" || e.key === " ")) {
73
+ e.preventDefault();
74
+ onNavigateToSchedule(s.id);
75
+ }
76
+ }}
77
+ >
78
+ <div className={styles.cardHeader}>
79
+ <span className={styles.cardTitle}>
80
+ <strong>{s.title}</strong>
81
+ <span
82
+ className={`${styles.statusBadge} ${s.enabled ? styles.enabled : styles.disabled}`}
83
+ data-testid={`schedule-status-badge-${s.id}`}
84
+ >
85
+ {s.enabled ? "Enabled" : "Disabled"}
86
+ </span>
87
+ </span>
88
+ <div className={styles.cardActions} onClick={(e) => e.stopPropagation()}>
89
+ <Button
90
+ variant="ghost"
91
+ size="sm"
92
+ onClick={() => {
93
+ const toggle = async (): Promise<void> => { await onToggleEnabled(s.id, { enabled: !s.enabled }); };
94
+ toggle().catch(() => undefined);
95
+ }}
96
+ data-testid={`schedule-toggle-${s.id}`}
97
+ title={s.enabled ? "Disable schedule" : "Enable schedule"}
98
+ >
99
+ {s.enabled ? "Disable" : "Enable"}
100
+ </Button>
101
+ <Button
102
+ variant="ghost"
103
+ size="sm"
104
+ onClick={() => onNavigateToSchedule(s.id)}
105
+ data-testid={`schedule-edit-${s.id}`}
106
+ >
107
+ Edit
108
+ </Button>
109
+ <Button
110
+ variant="ghost"
111
+ size="sm"
112
+ onClick={() => setConfirmDelete(s.id)}
113
+ data-testid={`schedule-delete-${s.id}`}
114
+ >
115
+ Delete
116
+ </Button>
117
+ </div>
118
+ </div>
119
+
120
+ <div className={styles.cardMeta}>
121
+ <span data-testid={`schedule-expression-${s.id}`}>{s.scheduleExpression}</span>
122
+ {s.personaId && (
123
+ <span data-testid={`schedule-persona-${s.id}`}>
124
+ Persona: {resolvePersonaName(s.personaId)}
125
+ </span>
126
+ )}
127
+ <span data-testid={`schedule-last-run-${s.id}`}>
128
+ Last run: {s.lastRunAt ? formatRelativeTime(s.lastRunAt) : "Never"}
129
+ </span>
130
+ {s.enabled && s.nextRunAt ? (
131
+ <span data-testid={`schedule-next-run-${s.id}`}>
132
+ Next run: {formatCountdown(s.nextRunAt)}
133
+ </span>
134
+ ) : null}
135
+ {s.runCount > 0 && (
136
+ <span data-testid={`schedule-run-count-${s.id}`}>
137
+ Runs: {s.runCount}
138
+ </span>
139
+ )}
140
+ </div>
141
+ </div>
142
+ ))}
143
+ </div>
144
+ )}
145
+
146
+ <ConfirmDialog
147
+ isOpen={confirmDelete !== null}
148
+ title="Delete Schedule?"
149
+ description={`"${scheduleToDelete?.title ?? ""}" will be permanently removed. Tasks already created by this schedule will not be affected.`}
150
+ confirmLabel="Delete"
151
+ onConfirm={() => {
152
+ if (confirmDelete) {
153
+ handleDelete(confirmDelete).catch(() => undefined);
154
+ }
155
+ }}
156
+ onCancel={() => setConfirmDelete(null)}
157
+ />
158
+ </div>
159
+ );
160
+ }
@@ -0,0 +1,82 @@
1
+ @use '../../styles/mixins' as *;
2
+
3
+ .nav {
4
+ display: flex;
5
+ flex-direction: column;
6
+ gap: var(--space-xs);
7
+ width: 100%;
8
+ padding: var(--space-md);
9
+ overflow-y: auto;
10
+
11
+ @include mobile {
12
+ flex-direction: row;
13
+ width: 100%;
14
+ min-width: unset;
15
+ border-right: none;
16
+ border-bottom: 1px solid var(--border-subtle);
17
+ overflow-x: auto;
18
+ overflow-y: hidden;
19
+ padding: var(--space-xs) var(--space-sm);
20
+ gap: 0;
21
+ flex-wrap: nowrap;
22
+ }
23
+ }
24
+
25
+ .tab {
26
+ display: flex;
27
+ align-items: center;
28
+ gap: var(--space-sm);
29
+ padding: var(--space-sm) var(--space-md);
30
+ border: none;
31
+ border-left: 3px solid transparent;
32
+ border-radius: var(--radius-md);
33
+ background: transparent;
34
+ color: var(--text-secondary);
35
+ font-size: var(--font-size-sm);
36
+ font-family: var(--font-ui);
37
+ cursor: pointer;
38
+ transition: background var(--transition-fast),
39
+ color var(--transition-fast),
40
+ border-color var(--transition-fast);
41
+ text-align: left;
42
+ width: 100%;
43
+
44
+ &:hover {
45
+ background: var(--bg-overlay);
46
+ color: var(--text-primary);
47
+ }
48
+
49
+ &:focus-visible {
50
+ outline: 2px solid var(--accent-green);
51
+ outline-offset: -2px;
52
+ }
53
+
54
+ @include mobile {
55
+ border-left: none;
56
+ border-bottom: 2px solid transparent;
57
+ white-space: nowrap;
58
+ flex-shrink: 0;
59
+ padding: var(--space-xs) var(--space-sm);
60
+ font-size: var(--font-size-xs);
61
+ width: auto;
62
+ border-radius: 0;
63
+ }
64
+ }
65
+
66
+ .tabIcon {
67
+ font-size: var(--font-size-base);
68
+ line-height: 1;
69
+ flex-shrink: 0;
70
+ }
71
+
72
+ .tabActive {
73
+ border-left-color: var(--accent-green);
74
+ background: var(--bg-overlay);
75
+ color: var(--text-primary);
76
+ font-weight: var(--font-weight-medium);
77
+
78
+ @include mobile {
79
+ border-left-color: transparent;
80
+ border-bottom-color: var(--accent-green);
81
+ }
82
+ }
@@ -0,0 +1,83 @@
1
+ import type { Meta, StoryObj } from "@storybook/react";
2
+ import { expect, userEvent } from "@storybook/test";
3
+ import { SettingsNav } from "./SettingsNav.js";
4
+
5
+ const meta: Meta<typeof SettingsNav> = {
6
+ component: SettingsNav,
7
+ title: "App/Settings/SettingsNav",
8
+ };
9
+ export default meta;
10
+ type Story = StoryObj<typeof meta>;
11
+
12
+ /** All five tabs are rendered with correct labels. */
13
+ export const AllTabsRendered: Story = {
14
+ play: async ({ canvas }) => {
15
+ await expect(canvas.getByRole("tab", { name: /Credentials/ })).toBeInTheDocument();
16
+ await expect(canvas.getByRole("tab", { name: /Personas/ })).toBeInTheDocument();
17
+ await expect(canvas.getByRole("tab", { name: /Schedules/ })).toBeInTheDocument();
18
+ await expect(canvas.getByRole("tab", { name: /Appearance/ })).toBeInTheDocument();
19
+ await expect(canvas.getByRole("tab", { name: /Shortcuts/ })).toBeInTheDocument();
20
+ await expect(canvas.getByRole("tab", { name: /About/ })).toBeInTheDocument();
21
+ },
22
+ };
23
+
24
+ /** First tab (Credentials) is selected by default. */
25
+ export const DefaultTabIsCredentials: Story = {
26
+ play: async ({ canvas }) => {
27
+ const credentialsTab = canvas.getByRole("tab", { name: /Credentials/ });
28
+ await expect(credentialsTab).toHaveAttribute("aria-selected", "true");
29
+ },
30
+ };
31
+
32
+ /** Keyboard navigation with ArrowDown moves focus to next tab. */
33
+ export const KeyboardNavigation: Story = {
34
+ play: async ({ canvas }) => {
35
+ const credentialsTab = canvas.getByRole("tab", { name: /Credentials/ });
36
+ credentialsTab.focus();
37
+
38
+ // ArrowDown should move to Personas
39
+ await userEvent.keyboard("{ArrowDown}");
40
+ const personasTab = canvas.getByRole("tab", { name: /Personas/ });
41
+ await expect(personasTab).toHaveFocus();
42
+
43
+ // ArrowDown again to Schedules
44
+ await userEvent.keyboard("{ArrowDown}");
45
+ const schedulesTab = canvas.getByRole("tab", { name: /Schedules/ });
46
+ await expect(schedulesTab).toHaveFocus();
47
+
48
+ // Home goes to first tab
49
+ await userEvent.keyboard("{Home}");
50
+ await expect(credentialsTab).toHaveFocus();
51
+
52
+ // End goes to last tab
53
+ await userEvent.keyboard("{End}");
54
+ const aboutTab = canvas.getByRole("tab", { name: /About/ });
55
+ await expect(aboutTab).toHaveFocus();
56
+ },
57
+ };
58
+
59
+ /** J/K keys navigate between tabs (vim-style aliases). */
60
+ export const JKNavigation: Story = {
61
+ play: async ({ canvas }) => {
62
+ const credentialsTab = canvas.getByRole("tab", { name: /Credentials/ });
63
+ credentialsTab.focus();
64
+
65
+ // J moves down to Personas
66
+ await userEvent.keyboard("j");
67
+ const personasTab = canvas.getByRole("tab", { name: /Personas/ });
68
+ await expect(personasTab).toHaveFocus();
69
+
70
+ // K moves back up to Credentials
71
+ await userEvent.keyboard("k");
72
+ await expect(credentialsTab).toHaveFocus();
73
+ },
74
+ };
75
+
76
+ /** Tab list has proper ARIA orientation. */
77
+ export const AriaOrientation: Story = {
78
+ play: async ({ canvas }) => {
79
+ const tablist = canvas.getByRole("tablist");
80
+ await expect(tablist).toHaveAttribute("aria-orientation", "vertical");
81
+ await expect(tablist).toHaveAttribute("aria-label", "Settings");
82
+ },
83
+ };
@@ -0,0 +1,104 @@
1
+ import { useCallback, useRef, type JSX, type KeyboardEvent, type ReactNode } from "react";
2
+ import { useLocation } from "react-router";
3
+ import { CalendarClock, Info, Key, Keyboard, Palette, Puzzle, User } from "lucide-react";
4
+ import { SETTINGS_URL, useAppNavigate } from "../../utils/navigation.js";
5
+ import { ICON_LG } from "../../utils/iconSize.js";
6
+ import styles from "./SettingsNav.module.scss";
7
+
8
+ /** Tab definition for the settings navigation rail. */
9
+ interface SettingsTab {
10
+ /** URL path segment (appended to /settings/). */
11
+ path: string;
12
+ /** Display label for the tab. */
13
+ label: string;
14
+ /** Icon element displayed before the label. */
15
+ icon: ReactNode;
16
+ }
17
+
18
+ /** Ordered list of settings tabs. */
19
+ const TABS: SettingsTab[] = [
20
+ { path: "credentials", label: "Credentials", icon: <Key size={ICON_LG} /> },
21
+ { path: "personas", label: "Personas", icon: <User size={ICON_LG} /> },
22
+ { path: "schedules", label: "Schedules", icon: <CalendarClock size={ICON_LG} /> },
23
+ { path: "appearance", label: "Appearance", icon: <Palette size={ICON_LG} /> },
24
+ { path: "shortcuts", label: "Shortcuts", icon: <Keyboard size={ICON_LG} /> },
25
+ { path: "plugins", label: "Plugins", icon: <Puzzle size={ICON_LG} /> },
26
+ { path: "about", label: "About", icon: <Info size={ICON_LG} /> },
27
+ ];
28
+
29
+ /** Vertical tab navigation rail for the settings hub. */
30
+ export function SettingsNav(): JSX.Element {
31
+ const location = useLocation();
32
+ const navigate = useAppNavigate();
33
+ const tabListRef = useRef<HTMLElement>(null);
34
+
35
+ const activeTab = TABS.find((tab) => {
36
+ const tabPath = `${SETTINGS_URL}/${tab.path}`;
37
+ return location.pathname === tabPath || location.pathname.startsWith(`${tabPath}/`);
38
+ })?.path ?? TABS[0].path;
39
+
40
+ const handleClick = useCallback((path: string) => {
41
+ navigate(`${SETTINGS_URL}/${path}`);
42
+ }, [navigate]);
43
+
44
+ const handleKeyDown = useCallback((e: KeyboardEvent<HTMLDivElement>) => {
45
+ // Derive current index from the focused element rather than location
46
+ // to avoid stale closures during rapid keyboard navigation.
47
+ const buttons = tabListRef.current?.querySelectorAll<HTMLButtonElement>('[role="tab"]');
48
+ if (!buttons) {
49
+ return;
50
+ }
51
+ const focusedIndex = Array.from(buttons).findIndex((b) => b === document.activeElement);
52
+ const currentIndex = focusedIndex >= 0 ? focusedIndex : TABS.findIndex((t) => t.path === activeTab);
53
+ let nextIndex = currentIndex;
54
+
55
+ if (e.key === "ArrowDown" || e.key === "j" || e.key === "J") {
56
+ e.preventDefault();
57
+ nextIndex = (currentIndex + 1) % TABS.length;
58
+ } else if (e.key === "ArrowUp" || e.key === "k" || e.key === "K") {
59
+ e.preventDefault();
60
+ nextIndex = (currentIndex - 1 + TABS.length) % TABS.length;
61
+ } else if (e.key === "Home") {
62
+ e.preventDefault();
63
+ nextIndex = 0;
64
+ } else if (e.key === "End") {
65
+ e.preventDefault();
66
+ nextIndex = TABS.length - 1;
67
+ } else {
68
+ return;
69
+ }
70
+
71
+ const nextPath = TABS[nextIndex].path;
72
+ navigate(`${SETTINGS_URL}/${nextPath}`);
73
+ buttons[nextIndex]?.focus(); // eslint-disable-line @typescript-eslint/no-unnecessary-condition -- index may be out of bounds
74
+ }, [activeTab, navigate]);
75
+
76
+ return (
77
+ <nav
78
+ className={styles.nav}
79
+ ref={tabListRef}
80
+ role="tablist"
81
+ aria-orientation="vertical"
82
+ aria-label="Settings"
83
+ onKeyDown={handleKeyDown}
84
+ >
85
+ {TABS.map((tab) => {
86
+ const isActive = tab.path === activeTab;
87
+ return (
88
+ <button
89
+ key={tab.path}
90
+ role="tab"
91
+ type="button"
92
+ aria-selected={isActive}
93
+ tabIndex={isActive ? 0 : -1}
94
+ className={`${styles.tab} ${isActive ? styles.tabActive : ""}`}
95
+ onClick={() => handleClick(tab.path)}
96
+ >
97
+ <span className={styles.tabIcon} aria-hidden="true">{tab.icon}</span>
98
+ {tab.label}
99
+ </button>
100
+ );
101
+ })}
102
+ </nav>
103
+ );
104
+ }
@@ -0,0 +1,206 @@
1
+ // =============================================================================
2
+ // StreamDetailPanel — right pull-out drawer for stream details
3
+ // =============================================================================
4
+
5
+ .panel {
6
+ position: absolute;
7
+ top: 0;
8
+ right: 0;
9
+ bottom: 0;
10
+ width: 350px;
11
+ background: var(--bg-surface, #1a1a2e);
12
+ border-left: 1px solid var(--border-default, #333);
13
+ display: flex;
14
+ flex-direction: column;
15
+ overflow-y: auto;
16
+ z-index: 10;
17
+ animation: slideIn 0.2s ease-out;
18
+ }
19
+
20
+ @keyframes slideIn {
21
+ from {
22
+ transform: translateX(100%);
23
+ }
24
+ to {
25
+ transform: translateX(0);
26
+ }
27
+ }
28
+
29
+ .header {
30
+ display: flex;
31
+ align-items: center;
32
+ justify-content: space-between;
33
+ padding: 16px;
34
+ border-bottom: 1px solid var(--border-default, #333);
35
+ flex-shrink: 0;
36
+ }
37
+
38
+ .title {
39
+ margin: 0;
40
+ font-size: 16px;
41
+ font-weight: 600;
42
+ overflow: hidden;
43
+ text-overflow: ellipsis;
44
+ white-space: nowrap;
45
+ flex: 1;
46
+ }
47
+
48
+ .closeButton {
49
+ background: none;
50
+ border: none;
51
+ color: var(--text-secondary, #999);
52
+ font-size: 24px;
53
+ cursor: pointer;
54
+ padding: 0 4px;
55
+ line-height: 1;
56
+ flex-shrink: 0;
57
+
58
+ &:hover {
59
+ color: var(--text-primary, #fff);
60
+ }
61
+ }
62
+
63
+ .body {
64
+ padding: 16px;
65
+ flex: 1;
66
+ overflow-y: auto;
67
+ }
68
+
69
+ .section {
70
+ margin-bottom: 20px;
71
+ }
72
+
73
+ .sectionLabel {
74
+ font-size: 11px;
75
+ font-weight: 600;
76
+ text-transform: uppercase;
77
+ color: var(--text-disabled, #666);
78
+ margin-bottom: 8px;
79
+ letter-spacing: 0.05em;
80
+ }
81
+
82
+ .metaRow {
83
+ display: flex;
84
+ align-items: baseline;
85
+ gap: 8px;
86
+ margin-bottom: 6px;
87
+ font-size: 13px;
88
+ }
89
+
90
+ .metaKey {
91
+ color: var(--text-secondary, #999);
92
+ flex-shrink: 0;
93
+ min-width: 100px;
94
+ }
95
+
96
+ .metaValue {
97
+ color: var(--text-primary, #eee);
98
+ font-family: monospace;
99
+ font-size: 12px;
100
+ overflow: hidden;
101
+ text-overflow: ellipsis;
102
+ white-space: nowrap;
103
+ }
104
+
105
+ .subscriberCard {
106
+ border: 1px solid var(--border-default, #333);
107
+ border-radius: 6px;
108
+ padding: 10px 12px;
109
+ margin-bottom: 8px;
110
+ font-size: 13px;
111
+ }
112
+
113
+ .subscriberHeader {
114
+ display: flex;
115
+ align-items: center;
116
+ gap: 6px;
117
+ margin-bottom: 6px;
118
+ }
119
+
120
+ .sessionLink {
121
+ background: none;
122
+ border: none;
123
+ color: var(--accent-blue, #4A9EFF);
124
+ cursor: pointer;
125
+ font-size: 12px;
126
+ font-family: monospace;
127
+ padding: 0;
128
+ text-align: left;
129
+ overflow: hidden;
130
+ text-overflow: ellipsis;
131
+ white-space: nowrap;
132
+ max-width: 200px;
133
+
134
+ &:hover {
135
+ text-decoration: underline;
136
+ }
137
+ }
138
+
139
+ .badges {
140
+ display: flex;
141
+ align-items: center;
142
+ gap: 4px;
143
+ flex-wrap: wrap;
144
+ margin-top: 4px;
145
+ }
146
+
147
+ .badge {
148
+ display: inline-block;
149
+ padding: 2px 7px;
150
+ border-radius: 4px;
151
+ font-size: 11px;
152
+ font-weight: 500;
153
+ background: var(--bg-inset, #222);
154
+ color: var(--text-secondary, #aaa);
155
+ }
156
+
157
+ .badgeRw {
158
+ composes: badge;
159
+ background: rgba(74, 158, 255, 0.15);
160
+ color: var(--accent-blue, #4A9EFF);
161
+ }
162
+
163
+ .badgeR {
164
+ composes: badge;
165
+ background: rgba(100, 200, 100, 0.15);
166
+ color: var(--accent-green, #4CAF50);
167
+ }
168
+
169
+ .badgeW {
170
+ composes: badge;
171
+ background: rgba(255, 165, 0, 0.15);
172
+ color: var(--accent-yellow, #FFA500);
173
+ }
174
+
175
+ .badgeAsync {
176
+ composes: badge;
177
+ background: rgba(128, 90, 213, 0.15);
178
+ color: #a78bfa;
179
+ }
180
+
181
+ .badgeSync {
182
+ composes: badge;
183
+ }
184
+
185
+ .badgeDetach {
186
+ composes: badge;
187
+ background: rgba(255, 80, 80, 0.15);
188
+ color: var(--accent-red, #ef4444);
189
+ }
190
+
191
+ .spawnTag {
192
+ composes: badge;
193
+ font-size: 10px;
194
+ }
195
+
196
+ .fdNumber {
197
+ font-family: monospace;
198
+ font-size: 12px;
199
+ color: var(--text-disabled, #666);
200
+ }
201
+
202
+ .emptySubscribers {
203
+ font-size: 13px;
204
+ color: var(--text-disabled, #666);
205
+ font-style: italic;
206
+ }