Commit b5a1d17
feat(ui): improve scheduled task controls (#378)
## Summary
- add client-side search to the scheduled tasks agent picker
- close and reset the picker on selection, outside click, or Escape
- add a visible label to the prompt field in the edit schedule modal
## Test plan
- [x] Run `npm run typecheck`
- [x] Lint the updated schedule components
- [x] Run `npm run test:run -- hooks/use-agents.test.tsx`
- [x] Verify the searchable picker and prompt label locally
Made with [Cursor](https://cursor.com)
<!-- greptile_comment -->
<h3>Greptile Summary</h3>
This PR improves the scheduled-tasks UI in two ways: it replaces the
Radix `Select` with a custom searchable dropdown for the scope picker,
and it adds an explicit "Prompt" label to the edit-schedule textarea.
- **Custom agent picker** — adds client-side filtering, Escape /
outside-click dismissal, and focus-return to the trigger; removes the
Radix `Select` dependency from this component.
- **Prompt label** — wraps the textarea in a `<label>` element with a
visible "Prompt" span, matching the existing `ScheduleNameInput` pattern
and improving accessibility.
- **Known gap** — the trigger button's `onClick` handler does not call
`setQuery('')` when closing, so a stale search term persists if the user
toggles the dropdown closed via the button rather than via Escape,
outside-click, or item selection.
<details><summary><h3>Confidence Score: 4/5</h3></summary>
Safe to merge after fixing the stale-query issue on trigger-button
close.
The custom dropdown correctly resets the search query on every close
path (Escape, outside-click, item selection) except one: clicking the
trigger button a second time only toggles isOpen without calling
setQuery. A user who closes via the button and reopens sees a filtered
list based on their previous search term with no explanation. The fix is
a one-liner. Everything else is correct.
**Files Needing Attention:**
agentex-ui/components/scheduled-tasks/scheduled-tasks-page.tsx — the
trigger button onClick handler needs to clear the search query when
closing.
</details>
<details><summary><h3>Important Files Changed</h3></summary>
| Filename | Overview |
|----------|----------|
| agentex-ui/components/scheduled-tasks/scheduled-tasks-page.tsx |
Replaces Radix Select with a custom searchable dropdown; correctly
handles outside-click, Escape, and item-selection close paths, but omits
query reset when the trigger button toggles the dropdown closed. |
| agentex-ui/components/scheduled-tasks/schedule-modals.tsx | Wraps the
prompt textarea in a labeled `<label>` element, matching the existing
`ScheduleNameInput` pattern; straightforward and safe change. |
</details>
<details><summary><h3>Flowchart</h3></summary>
```mermaid
%%{init: {'theme': 'neutral'}}%%
flowchart TD
A([User clicks trigger button]) --> B{isOpen?}
B -- false --> C[setIsOpen true\nautoFocus search input]
B -- true --> D[setIsOpen false\n query NOT cleared]
C --> E[Dropdown renders]
E --> F{User action}
F -- Types in search --> G[filteredAgents updates]
F -- Selects item --> H[selectAgent or selectScope\nsetIsOpen false\nsetQuery empty\ntriggerRef.focus]
F -- Presses Escape --> I[closeOnEscape handler\nsetIsOpen false\nsetQuery empty\ntriggerRef.focus]
F -- Clicks outside --> J[closeOnOutsideClick handler\nsetIsOpen false\nsetQuery empty]
F -- Clicks trigger again --> D
D --> K([Dropdown closes, stale query remains])
```
</details>
<sub>Reviews (2): Last reviewed commit: ["fix(ui): handle schedule
picker loading
..."](14bf201)
| [Re-trigger
Greptile](https://app.greptile.com/api/retrigger?id=47575437)</sub>
<!-- /greptile_comment -->
---------
Co-authored-by: Cursor <cursoragent@cursor.com>1 parent 2c4f061 commit b5a1d17
2 files changed
Lines changed: 134 additions & 46 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
137 | 137 | | |
138 | 138 | | |
139 | 139 | | |
140 | | - | |
141 | | - | |
142 | | - | |
143 | | - | |
144 | | - | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
145 | 148 | | |
146 | 149 | | |
147 | 150 | | |
| |||
Lines changed: 126 additions & 41 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | | - | |
| 3 | + | |
4 | 4 | | |
5 | | - | |
| 5 | + | |
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
| |||
17 | 17 | | |
18 | 18 | | |
19 | 19 | | |
20 | | - | |
21 | | - | |
22 | | - | |
23 | | - | |
24 | | - | |
25 | | - | |
26 | | - | |
27 | 20 | | |
28 | 21 | | |
29 | 22 | | |
| |||
217 | 210 | | |
218 | 211 | | |
219 | 212 | | |
220 | | - | |
221 | | - | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
| 244 | + | |
| 245 | + | |
| 246 | + | |
| 247 | + | |
| 248 | + | |
| 249 | + | |
| 250 | + | |
| 251 | + | |
| 252 | + | |
| 253 | + | |
| 254 | + | |
| 255 | + | |
| 256 | + | |
| 257 | + | |
| 258 | + | |
| 259 | + | |
| 260 | + | |
| 261 | + | |
| 262 | + | |
222 | 263 | | |
223 | 264 | | |
224 | | - | |
225 | | - | |
226 | | - | |
227 | | - | |
228 | | - | |
229 | | - | |
230 | | - | |
231 | | - | |
232 | | - | |
233 | | - | |
234 | | - | |
235 | | - | |
| 265 | + | |
| 266 | + | |
| 267 | + | |
| 268 | + | |
| 269 | + | |
236 | 270 | | |
| 271 | + | |
| 272 | + | |
| 273 | + | |
237 | 274 | | |
238 | | - | |
239 | | - | |
240 | | - | |
241 | | - | |
242 | | - | |
243 | | - | |
244 | | - | |
| 275 | + | |
| 276 | + | |
| 277 | + | |
| 278 | + | |
| 279 | + | |
| 280 | + | |
| 281 | + | |
| 282 | + | |
| 283 | + | |
| 284 | + | |
245 | 285 | | |
246 | | - | |
247 | | - | |
248 | | - | |
249 | | - | |
250 | | - | |
251 | | - | |
252 | | - | |
253 | | - | |
254 | | - | |
255 | | - | |
256 | | - | |
| 286 | + | |
| 287 | + | |
| 288 | + | |
| 289 | + | |
| 290 | + | |
| 291 | + | |
| 292 | + | |
| 293 | + | |
| 294 | + | |
| 295 | + | |
| 296 | + | |
| 297 | + | |
| 298 | + | |
| 299 | + | |
| 300 | + | |
| 301 | + | |
| 302 | + | |
| 303 | + | |
| 304 | + | |
| 305 | + | |
| 306 | + | |
| 307 | + | |
| 308 | + | |
| 309 | + | |
| 310 | + | |
| 311 | + | |
| 312 | + | |
| 313 | + | |
| 314 | + | |
| 315 | + | |
| 316 | + | |
| 317 | + | |
| 318 | + | |
| 319 | + | |
| 320 | + | |
| 321 | + | |
| 322 | + | |
| 323 | + | |
| 324 | + | |
| 325 | + | |
| 326 | + | |
| 327 | + | |
| 328 | + | |
| 329 | + | |
| 330 | + | |
| 331 | + | |
| 332 | + | |
| 333 | + | |
| 334 | + | |
| 335 | + | |
| 336 | + | |
| 337 | + | |
| 338 | + | |
| 339 | + | |
| 340 | + | |
| 341 | + | |
257 | 342 | | |
258 | 343 | | |
259 | 344 | | |
| |||
0 commit comments