Skip to content

improvement(scheduled-tasks): render prompt chips in task details and align weekday picker#5159

Merged
waleedlatif1 merged 5 commits into
stagingfrom
fix/scheduled-task-prompt-chips
Jun 20, 2026
Merged

improvement(scheduled-tasks): render prompt chips in task details and align weekday picker#5159
waleedlatif1 merged 5 commits into
stagingfrom
fix/scheduled-task-prompt-chips

Conversation

@waleedlatif1

Copy link
Copy Markdown
Collaborator

What

Two scheduled-tasks polish items:

1. Task details modal renders mention/skill chips

The read-only task details modal (shown for running/finished tasks) dumped the stored prompt into a plain ChipModalField type='textarea', so a previously entered prompt showed raw @Gmail / /deploy-workflow text — even though the create/edit modal renders those as chips while composing.

Fix: reuse the home PromptEditor in a new read-only mode and seed it with the task's prompt + contexts, exactly like the edit modal already does. The prompt now renders mention/skill chips when you reopen a task.

  • New readOnly prop on PromptEditor: the textarea becomes readOnly (text stays selectable/copyable), the caret-anchored resource/skill menus don't mount, and the chip overlay still paints. No new rendering path — same engine, display-only.
  • TaskDetailsModal splits out an inner TaskDetailsContent mounted only while a task is shown, so the editor's mention-data queries don't fire on page load (mirrors TaskModalContent).
  • Integration @-mentions and /-skills chipify from the seeded text alone; resource chips (@file, @table) restore from the task's stored contexts.

2. Weekly "Repeat on" day picker alignment

The weekday selector was a stretched segmented bar with a faint active surface for selected days. Re-rendered it as a seven-column grid of day cells that reuse the calendar's exact day-cell grammar (primary fill when on, bare --text-body when off) so it reads as a one-row sibling of the date picker rather than a separate control.

Testing

  • bunx tsc --noEmit — clean
  • biome check — clean
  • bun run check:api-validation — passed

… align weekday picker

The read-only task-details modal dumped the stored prompt into a plain
textarea, so a previously entered prompt showed raw `@Gmail` / `/skill`
text instead of the chips the editor renders while composing. Reuse the
home `PromptEditor` in a new read-only mode (textarea becomes `readOnly`,
caret-anchored menus unmount, the chip overlay still paints) seeded with
the task's prompt and contexts, so the record renders mention/skill chips
identically to the create/edit modal.

Also realign the weekly "Repeat on" day picker: instead of a stretched
segmented bar with a faint `active` surface, render a seven-column grid of
day cells that reuse the calendar's exact day-cell grammar (`primary` fill
when on, bare `--text-body` when off) so it reads as a one-row sibling of
the date picker.
@vercel

vercel Bot commented Jun 20, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
Project Deployment Actions Updated (UTC)
docs Skipped Skipped Jun 20, 2026 11:27pm

Request Review

@cursor

cursor Bot commented Jun 20, 2026

Copy link
Copy Markdown

PR Summary

Low Risk
UI-only polish on scheduled tasks and shared calendar styling; read-only editor reuses existing prompt rendering without changing persistence or scheduling logic.

Overview
Scheduled task details no longer show the stored prompt as plain textarea text. The modal uses PromptEditor in readOnly mode, seeded with task.prompt and initialContexts so resource mentions render as chips alongside integration/skill tokens chipified from text. Content is split into TaskDetailsContent (keyed by task id) so mention queries only run when the modal is open and switching tasks remounts the editor.

PromptEditor gains readOnly: readOnly textarea, copy still works, edit handlers and @// menus unmounted, no focus-on-click. usePromptEditor exposes initialContexts passed into context management on mount.

Weekly Repeat on in the task recurrence UI switches from stretched Chip toggles to a 7-column grid of shared CalendarDayCell pills; Calendar day buttons are refactored to the same component and it is exported from emcn.

Reviewed by Cursor Bugbot for commit 203e308. Configure here.

…weekday picker

Pull the calendar's day pill into one CalendarDayCell component (the
single source of the day-pill chrome: primary fill when selected, the
border ring on today, fixed 30px square or full-width). The calendar grid
and the weekly "Repeat on" toggles now both render it, so the call sites
are props-only (no re-derived chipVariants classes) and the two surfaces
stay visually identical by construction.
The read-only details editor seeds its prompt + mention contexts on mount
only. Selecting a different finished task while the modal stays open swapped
the Status/run-time fields but left the editor on the first task's prompt.
Key the content by the occurrence id so each task gets a fresh mount.
@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@greptile review

@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@cursor review

@greptile-apps

greptile-apps Bot commented Jun 20, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR adds two polish items to the scheduled-tasks feature: a readOnly mode on PromptEditor so that the task-details modal renders @-mention and /-skill chips instead of raw token text, and a visual alignment improvement that replaces the weekday-picker segmented bar with a seven-cell grid that shares the same CalendarDayCell primitive as the date picker.

  • Read-only chip editor: PromptEditor gains a readOnly prop that disables editing handlers and the floating menus while keeping the chip overlay and text-selection/copy intact; usePromptEditor gains initialContexts to seed resource-backed contexts before the mount chipify pass; TaskDetailsModal splits into an outer wrapper and a TaskDetailsContent keyed by task.id so the editor remounts on task switch without firing queries at page load.
  • CalendarDayCell extraction: a new shared CalendarDayCell component built on chipVariants is extracted from the calendar month grid and reused in the weekday-toggle row, giving both surfaces identical visual grammar (primary fill when selected, border ring for today, --text-body tint when off).
  • Component index update: CalendarDayCell and CalendarDayCellProps are exported from the EMCN barrel.

Confidence Score: 5/5

Safe to merge — both changes are additive and well-scoped, with no mutations to existing read/write editor paths or data persistence logic.

The read-only flag is carefully gated at every relevant interaction point (autoFocus, handleSurfaceClick, onChange, onKeyDown, onPaste, onCut, onSelect, onMouseUp, and the two floating menus). The initialContexts seeding correctly seeds before the mount chipify pass to avoid clobbering auto-registered integration/skill contexts. The CalendarDayCell extraction is a pure refactor with no behavior change.

No files require special attention.

Important Files Changed

Filename Overview
apps/sim/app/workspace/[workspaceId]/home/components/user-input/components/prompt-editor/prompt-editor.tsx Adds readOnly prop: gates autoFocus, handleSurfaceClick, change/keydown/paste/cut/select handlers, and the two floating menus on !readOnly; cursor-default + caret-transparent applied to the textarea in read-only mode.
apps/sim/app/workspace/[workspaceId]/home/components/user-input/components/prompt-editor/use-prompt-editor.ts Adds initialContexts prop threaded into useContextManagement so resource-backed contexts (files, tables, knowledge) are seeded before the mount chipify pass merges integration/skill contexts on top.
apps/sim/app/workspace/[workspaceId]/scheduled-tasks/components/task-details-modal/task-details-modal.tsx Splits the modal into outer TaskDetailsModal + inner TaskDetailsContent keyed by task.id; the inner component mounts the read-only PromptEditor seeded with task.prompt + task.contexts so chips render without needing a new code path.
apps/sim/app/workspace/[workspaceId]/scheduled-tasks/components/task-modal/recurrence-section.tsx Replaces the flex-stretch Chip row with a 7-column CalendarDayCell grid so the weekday toggles share visual grammar with the calendar date picker.
apps/sim/components/emcn/components/calendar/calendar-day-cell.tsx New shared CalendarDayCell component built on chipVariants; handles selected/today/fullWidth variants with proper type='button' default to prevent accidental form submission.
apps/sim/components/emcn/components/calendar/calendar.tsx Replaces the inlined button+chipVariants day cell with the new CalendarDayCell; clean deduplication with no behavior change.
apps/sim/components/emcn/components/index.ts Exports CalendarDayCell and CalendarDayCellProps from the EMCN component library barrel.

Sequence Diagram

%%{init: {'theme': 'neutral'}}%%
sequenceDiagram
    participant User
    participant TaskDetailsModal
    participant TaskDetailsContent
    participant usePromptEditor
    participant useContextManagement
    participant PromptEditor

    User->>TaskDetailsModal: clicks finished/running task
    TaskDetailsModal->>TaskDetailsContent: "mount (key=task.id)"
    TaskDetailsContent->>usePromptEditor: "{ workspaceId, initialValue: task.prompt, initialContexts: task.contexts }"
    usePromptEditor->>useContextManagement: "{ message, initialContexts }"
    useContextManagement-->>usePromptEditor: selectedContexts (seeded with resource contexts)
    Note over usePromptEditor: mount chipify effect merges integration @-mentions and /skills
    usePromptEditor-->>TaskDetailsContent: editor instance
    TaskDetailsContent->>PromptEditor: "editor={editor} readOnly"
    Note over PromptEditor: textarea readOnly=true, handlers disabled, menus not mounted, chip overlay paints
    PromptEditor-->>User: "renders chips for @mentions and /skills"
Loading
%%{init: {'theme': 'base', 'themeVariables': {"darkMode": true, "background": "#0d1117", "primaryColor": "#21262d", "primaryTextColor": "#e6edf3", "primaryBorderColor": "#8b949e", "lineColor": "#8b949e", "textColor": "#e6edf3", "edgeLabelBackground": "#161b22", "actorBkg": "#21262d", "actorBorder": "#8b949e", "actorTextColor": "#e6edf3", "actorLineColor": "#8b949e", "signalColor": "#8b949e", "signalTextColor": "#e6edf3", "noteBkgColor": "#373320", "noteBorderColor": "#d4a72c", "noteTextColor": "#f0e6c0", "labelBoxBkgColor": "#21262d", "labelBoxBorderColor": "#8b949e", "labelTextColor": "#e6edf3", "loopTextColor": "#e6edf3", "activationBkgColor": "#30363d", "activationBorderColor": "#8b949e"}}}%%
sequenceDiagram
    participant User
    participant TaskDetailsModal
    participant TaskDetailsContent
    participant usePromptEditor
    participant useContextManagement
    participant PromptEditor

    User->>TaskDetailsModal: clicks finished/running task
    TaskDetailsModal->>TaskDetailsContent: "mount (key=task.id)"
    TaskDetailsContent->>usePromptEditor: "{ workspaceId, initialValue: task.prompt, initialContexts: task.contexts }"
    usePromptEditor->>useContextManagement: "{ message, initialContexts }"
    useContextManagement-->>usePromptEditor: selectedContexts (seeded with resource contexts)
    Note over usePromptEditor: mount chipify effect merges integration @-mentions and /skills
    usePromptEditor-->>TaskDetailsContent: editor instance
    TaskDetailsContent->>PromptEditor: "editor={editor} readOnly"
    Note over PromptEditor: textarea readOnly=true, handlers disabled, menus not mounted, chip overlay paints
    PromptEditor-->>User: "renders chips for @mentions and /skills"
Loading

Reviews (4): Last reviewed commit: "fix(scheduled-tasks): seed task contexts..." | Re-trigger Greptile

…y-only

Greptile P2: a padding click on the read-only editor still focused the
non-editable textarea, which can read as editable. Gate the surface-click
focus on `!readOnly`, and drop the blinking caret (`caret-transparent` +
`cursor-default`) in read-only mode. Text stays selectable for copy.
@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

Addressed the Greptile P2 (handleSurfaceClick focusing the read-only textarea) in 94a2bb1: the surface-click focus is now gated on !readOnly, and read-only mode drops the blinking caret (caret-transparent + cursor-default). Text stays selectable so the prompt is still copyable — it just no longer reads as editable.

@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@greptile review

@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@cursor review

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ Bugbot reviewed your changes and found no new issues!

Comment @cursor review or bugbot run to trigger another review on this PR

Reviewed by Cursor Bugbot for commit 94a2bb1. Configure here.

…entions

Cursor (Medium): the mount-only `setContexts(task.contexts)` replaced the
editor's context list AFTER the chipify pass had already registered the
prompt's integration `@`-mentions and `/`-skills, so a task with any stored
resource context lost its integration/skill chip overlay.

Thread an `initialContexts` option through `usePromptEditor` (into the
context manager's existing `initialContexts` seed) and seed the task's
stored contexts there. The mount chipify pass then MERGES integration and
skill contexts on top of the seed (deduped), so the overlay renders the
full set — resources from the seed, integrations/skills from the text.
@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@greptile review

@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@cursor review

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ Bugbot reviewed your changes and found no new issues!

Comment @cursor review or bugbot run to trigger another review on this PR

Reviewed by Cursor Bugbot for commit 203e308. Configure here.

@waleedlatif1 waleedlatif1 merged commit 39cfae9 into staging Jun 20, 2026
16 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant