Skip to content

improvement(scheduled-tasks): move recurrence into modal body as a section#5054

Merged
waleedlatif1 merged 4 commits into
stagingfrom
improvement/scheduled-task-recurrence-section
Jun 15, 2026
Merged

improvement(scheduled-tasks): move recurrence into modal body as a section#5054
waleedlatif1 merged 4 commits into
stagingfrom
improvement/scheduled-task-recurrence-section

Conversation

@emir-karabeg

Copy link
Copy Markdown
Collaborator

Summary

  • scheduled-tasks: Replace the footer RecurrenceControl (a row of chip dropdowns) with a RecurrenceSection rendered between the prompt body and footer — a "Recurring" Switch toggles one-time vs. repeat, and once on, frequency and end (never / on a date / after N runs) are labeled ChipModalField rows aligned to the modal header/footer gutter.
  • scheduled-tasks: Toggling Recurring off now preserves the recurrence shape (cadence, end, and a passed-through custom cron) and only sets frequency: 'once', so toggling back on restores a conversationally-authored custom schedule rather than silently rewriting it to daily — honoring the documented custom round-trip invariant.
  • home/user-input: Restore the prompt editor's native scale (text-[15px], -0.015em tracking) so the editor reads the same in the chat input and the task modal body.

Type of Change

  • Improvement (UI / behavior)
  • Bug fix (custom-cron preservation on the Recurring toggle)

Testing

  • recurrence unit suite passes (17 tests).
  • tsc clean for the changed files; biome check clean (lint-staged ran on commit).
  • Reviewed by three independent agents (conventions / correctness / elegance); findings applied.

Checklist

  • Code follows project style guidelines
  • Self-reviewed my changes
  • Tests added/updated and passing
  • No new warnings introduced
  • I confirm that I have read and agree to the terms outlined in the Contributor License Agreement (CLA)

@emir-karabeg

Copy link
Copy Markdown
Collaborator Author

@greptile run

@vercel

vercel Bot commented Jun 15, 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 15, 2026 5:23pm

Request Review

@cursor

cursor Bot commented Jun 15, 2026

Copy link
Copy Markdown

PR Summary

Low Risk
UI and local recurrence-state changes in the task modal; behavior is covered by existing recurrence tests per the PR description.

Overview
Scheduled task modal recurrence moves out of the footer chip row into a body section under the prompt: a Recurring switch toggles one-time vs repeat, and when on, Frequency / Ends (and end date or run count) use labeled ChipModalField rows with ChipModalSeparator spacing aligned to the modal gutter. Footer keeps launch date/time (and Delete on edit) only.

Behavior fix: Turning Recurring off sets frequency to once but keeps weekdays, end rules, and custom cron; turning it back on restores the last cadence (including custom) via a ref cache instead of defaulting to daily. Preset frequency changes clear cron.

Prompt editor shared mirror/textarea classes switch from chip text-sm to chat-native text-[15px] / tracking-[-0.015em] and updated placeholder tokens so the task modal prompt matches the home chat input.

ChipModalSeparator is exported from emcn for body sections; scheduled-tasks loading imports Calendar and Plus from one barrel.

Reviewed by Cursor Bugbot for commit 9964a5b. Configure here.

@greptile-apps

greptile-apps Bot commented Jun 15, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR refactors the scheduled-task modal's recurrence UI from a horizontal chip row in the footer to a vertical RecurrenceSection component rendered between the prompt body and footer, and fixes two recurrence toggle bugs (stale-cron restoration and lost cadence on toggle round-trip).

  • RecurrenceSection replaces RecurrenceControl: a Switch toggles one-time vs. repeat, and a useRef caches the last active non-once frequency so toggling off and back on restores the user's cadence (weekly, monthly, etc.) rather than defaulting to daily. handleFrequencyChange now also clears cron: undefined on non-custom branches, fixing the stale-cron restore path.
  • ChipModalSeparator is exported from the barrel so RecurrenceSection can draw the canonical divider line without duplicating the class string.
  • constants.ts updates the prompt textarea scale to text-[15px] / tracking-[-0.015em] / leading-[24px], aligning the task modal body with the chat input appearance.

Confidence Score: 5/5

Safe to merge — the toggle logic is correct, previously reported bugs are fixed, and all changed CSS variables are defined.

The recurrence toggle correctly caches and restores the last non-once cadence via a render-time ref write that is idempotent. handleFrequencyChange now clears cron: undefined on all non-custom branches, closing the stale-cron restore path. --text-subtle is defined in globals.css for both light and dark themes. The ChipModalSeparator export and loading.tsx import fix are mechanical and low-risk.

No files require special attention.

Important Files Changed

Filename Overview
apps/sim/app/workspace/[workspaceId]/scheduled-tasks/components/task-modal/recurrence-section.tsx New component replacing RecurrenceControl; toggle logic is correct, ref-based cadence cache is idempotent, and cron: undefined is cleared on all non-custom branches.
apps/sim/app/workspace/[workspaceId]/scheduled-tasks/components/task-modal/recurrence-control.tsx Deleted file — replaced by recurrence-section.tsx with correct toggle behaviour.
apps/sim/app/workspace/[workspaceId]/scheduled-tasks/components/task-modal/task-modal.tsx RecurrenceSection is placed between ChipModalPromptBody and ChipModalFooter; secondary-actions array is trimmed accordingly.
apps/sim/app/workspace/[workspaceId]/home/components/user-input/components/constants.ts Textarea scale updated to 15px/24px line-height/−0.015em tracking; --text-subtle is a defined CSS variable in globals.css.
apps/sim/components/emcn/components/chip-modal/chip-modal.tsx ChipModalSeparator promoted from private to exported function; no logic changes.
apps/sim/components/emcn/components/index.ts ChipModalSeparator added to barrel export; follows canonical import-path convention.
apps/sim/app/workspace/[workspaceId]/scheduled-tasks/loading.tsx Import of Plus and Calendar consolidated into the canonical @/components/emcn barrel; no logic changes.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
    A[TaskModal opens] --> B[ChipModalHeader]
    B --> C[ChipModalPromptBody\nPromptEditor]
    C --> D[RecurrenceSection]
    D --> E{isRecurring?}
    E -- No/once --> F[Switch OFF - preserves weekdays, end, cron]
    E -- Yes --> G[Switch ON - restore lastRecurringFrequency ref]
    G --> H[ChipModalField: Frequency]
    G --> I[ChipModalField: Ends]
    I -- on --> J[ChipModalField: End date]
    I -- after --> K[ChipModalField: Number of runs]
    D --> L[ChipModalFooter - date, time, Save, Delete]
Loading

Reviews (5): Last reviewed commit: "improvement(scheduled-tasks): compose ca..." | Re-trigger Greptile

@greptile-apps

greptile-apps Bot commented Jun 15, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR moves the recurrence controls from a chip-row in the modal footer into a dedicated RecurrenceSection rendered between the prompt body and footer, and fixes a bug where toggling "Recurring" off then on would silently overwrite a conversationally-authored custom cron with daily.

  • recurrence-section.tsx (new): a Switch toggles one-time vs. repeat; when on, labeled ChipModalField rows expose frequency and end options. Toggling off now only sets frequency: 'once' while preserving the full recurrence shape, so a custom cron round-trips correctly.
  • recurrence-control.tsx (deleted): old footer chip-row replaced entirely by the new section.
  • constants.ts: prompt editor scale changed from text-sm/20 px to text-[15px]/24 px with -0.015em tracking, and placeholder color updated to --text-subtle with font-[380], aligning the editor's appearance between the chat input and the task modal body.

Confidence Score: 4/5

Safe to merge; the custom-cron fix is correct and the UI restructure is clean. The one behaviour worth discussing before shipping is whether toggling the switch off then back on should restore a previously chosen weekly or monthly cadence, or intentionally default to daily.

The custom-cron round-trip preservation works correctly. The only notable gap is that handleRecurringToggle unconditionally resets to daily for non-custom frequencies when the switch is turned back on, so a user who configured Weekly on Mon and toggled it off would get Daily instead of their original cadence restored.

recurrence-section.tsx — specifically the toggle-ON branch of handleRecurringToggle and whether weekdays/frequency should be inferred from the preserved off-state shape for standard schedules.

Important Files Changed

Filename Overview
apps/sim/app/workspace/[workspaceId]/scheduled-tasks/components/task-modal/recurrence-section.tsx New RecurrenceSection replacing footer chip row. Custom-cron round-trip is correctly preserved; toggle-ON for standard (non-custom) schedules silently resets cadence to daily instead of restoring the previous weekly/monthly setting.
apps/sim/app/workspace/[workspaceId]/scheduled-tasks/components/task-modal/task-modal.tsx RecurrenceControl removed from footer secondary actions and replaced with RecurrenceSection placed between ChipModalPromptBody and ChipModalFooter; all other logic unchanged.
apps/sim/app/workspace/[workspaceId]/home/components/user-input/components/constants.ts Typography scale updated from text-sm/20px to text-[15px]/24px with -0.015em tracking; placeholder color changed from --text-muted to --text-subtle with font-[380] weight. Intentional style alignment between chat input and modal editor.
apps/sim/app/workspace/[workspaceId]/scheduled-tasks/components/task-modal/recurrence-control.tsx File deleted — replaced entirely by RecurrenceSection.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
    A[User opens TaskModal] --> B[ChipModalHeader]
    B --> C[ChipModalPromptBody\nPromptEditor]
    C --> D[RecurrenceSection]
    D --> E{isRecurring?}
    E -- No --> F[Switch OFF\nfrequency: once\nshape preserved]
    E -- Yes --> G[Switch ON\nFrequency ChipModalField]
    G --> H[Ends ChipModalField]
    H --> I{end.type?}
    I -- on --> J[End date ChipDatePicker]
    I -- after --> K[Number of runs input]
    I -- never --> L[No sub-row]
    D --> M[ChipModalFooter\nDate · Time · Delete?]
    F -- toggle on --> N{recurrence.cron?}
    N -- yes --> O[frequency: custom\nweekdays: empty]
    N -- no --> P[frequency: daily\nweekdays: empty]
Loading

Reviews (2): Last reviewed commit: "improvement(scheduled-tasks): move recur..." | Re-trigger Greptile

@emir-karabeg

Copy link
Copy Markdown
Collaborator Author

@greptile run

@waleedlatif1

Copy link
Copy Markdown
Collaborator

@cursor review
@greptile

@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 9964a5b. Configure here.

@waleedlatif1 waleedlatif1 changed the base branch from main to staging June 15, 2026 17:21
emir-karabeg and others added 4 commits June 15, 2026 10:23
…ction

Replace the footer RecurrenceControl (a row of chip dropdowns) with a
RecurrenceSection rendered between the prompt body and footer: a "Recurring"
Switch toggles one-time vs repeat, and — once on — frequency and end (never,
on a date, after N runs) are labeled ChipModalField rows aligned to the modal
header/footer gutter.

Toggling Recurring off now preserves the recurrence shape (cadence, end, and a
passed-through custom cron) and only sets frequency: 'once', so toggling back
on restores a conversationally-authored custom schedule instead of silently
rewriting it to daily.

Also restore the prompt editor's native scale (text-[15px], -0.015em tracking)
so the editor reads the same in the chat input and the task modal body.
… from custom

The Recurring toggle restores `frequency: 'custom'` when `recurrence.cron` is
truthy, but switching the frequency dropdown away from custom kept the stale
cron on the object — so editing a custom-cron task to Daily, then toggling
Recurring off and back on, snapped it back to Custom and persisted the old cron.
Clear `cron` in the non-custom frequency branches so it is present only while
the cadence is genuinely custom (matching the type's "custom only" invariant),
making the toggle's restore signal accurate.

Also document the unreachable `once` branch in frequencyOptionFor as a
type-exhaustiveness fallback (keeps the return type without a cast).
…rrence

Toggling Recurring off collapsed frequency to 'once' but toggling back on
forced 'daily' and cleared weekdays, so pausing a weekly/weekdays/monthly task
and re-enabling it silently reset it to daily. Cache the last recurring cadence
in a ref (written during render) and reinstate it on toggle-on, so a paused
"Weekly on Mon" returns as weekly. This also subsumes the custom-cron restore —
the ref remembers 'custom' across the one-time interval — so the toggle no
longer special-cases cron.
… imports

Replace the recurrence section's hand-rolled `h-px bg-[var(--border)]`
divider with the canonical ChipModalSeparator (now exported from the
chip-modal barrel) so the modal's hairline has a single source of truth.
Also unify loading.tsx icon imports onto the @/components/emcn barrel.
@waleedlatif1 waleedlatif1 force-pushed the improvement/scheduled-task-recurrence-section branch from 9964a5b to cf57926 Compare June 15, 2026 17:23
@waleedlatif1

Copy link
Copy Markdown
Collaborator

Rebased onto staging (branch was cut from main); branch now contains only this PR's commits. Re-running review on the new HEAD.

@cursor review
@greptile

@waleedlatif1 waleedlatif1 merged commit 1c8ac05 into staging Jun 15, 2026
9 checks passed
@waleedlatif1 waleedlatif1 deleted the improvement/scheduled-task-recurrence-section branch June 15, 2026 17:25
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.

2 participants