Skip to content

refactor(emcn): consolidate date pickers onto the chip Calendar (range support + retire legacy DatePicker)#5222

Merged
waleedlatif1 merged 6 commits into
stagingfrom
kb-design-alignment
Jun 26, 2026
Merged

refactor(emcn): consolidate date pickers onto the chip Calendar (range support + retire legacy DatePicker)#5222
waleedlatif1 merged 6 commits into
stagingfrom
kb-design-alignment

Conversation

@waleedlatif1

@waleedlatif1 waleedlatif1 commented Jun 26, 2026

Copy link
Copy Markdown
Collaborator

Summary

Consolidates all date selection onto the canonical chip Calendar, retiring the parallel legacy DatePicker.

  • Calendar gains a mode='range' variant (not a new component): start/end staged behind Clear/Cancel/Apply with optional time-of-day inputs, built from the chip family (CalendarDayCell, chipVariants, ChipTimePicker) and fully tokenized. Single mode is byte-identical to before.
  • ChipDatePicker gains a matching mode='range' behind the same chip trigger.
  • Retired the legacy DatePicker (its own dual-month grid, hardcoded colors, non-chip chrome) and migrated every consumer:
    • tables row modal → ChipDatePicker (single)
    • tables inline grid editor, logs filter, ee audit-logs filter → canonical Calendar inside an emcn Popover (the same headless/anchored pattern DatePicker rendered internally)
    • playground → ChipDatePicker showcase (single, range, range+time)
  • KB alignment: document tags modal now uses ChipDatePicker for date tags.
  • Dead code: removed the unused logs-toolbar/ directory.
  • Tests: pure range-bounds/parse/format helpers are unit-tested.

Wire-format compatibility

The range bounds keep the exact YYYY-MM-DD / YYYY-MM-DDTHH:mm (:59-closed end) format the legacy DatePicker emitted, so the log/audit-log filter parsing is unchanged (verified by unit tests).

Visual QA needed before merge

The headless/anchored calendars can't be verified from code alone — please eyeball:

  • tables inline grid date-cell editing (type + calendar popover, blur/refocus)
  • logs and ee/audit-logs custom date-range filters (popover anchors under the time-range select; range band, time inputs, Apply/Cancel)
  • the range calendar is now single-month (was dual-month) — intentional, to match the chip Calendar.

Type of Change

  • Refactor / feature (component) / design-system consolidation / cleanup

Testing

  • Unit tests for range/parse/format helpers pass; full typecheck + biome clean. UI surfaces need the visual QA pass noted above.

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)

… modal

The document tags modal used the legacy DatePicker primitive for date-typed
tag values while the rest of the knowledge base date inputs use the canonical
ChipDatePicker. Swap both usages (edit + create) to ChipDatePicker (same
YYYY-MM-DD value contract, full-width to match sibling fields) so the chrome
matches the chip design system, and align a tag-row value label to the caption
text size used by its sibling.
@vercel

vercel Bot commented Jun 26, 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 26, 2026 6:12pm

Request Review

@cursor

cursor Bot commented Jun 26, 2026

Copy link
Copy Markdown

PR Summary

Medium Risk
Touches logs and audit-log time filters and table inline date editing with UI/anchoring changes; wire formats are preserved but single-month range and popover behavior need visual QA.

Overview
Retires the legacy DatePicker (and its public export) and routes all date UX through the chip Calendar / ChipDatePicker.

Calendar now supports mode='range' with staged start/end, Clear/Cancel/Apply, optional ChipTimePicker times, and shared helpers (buildRangeBounds, formatDateRangeLabel, broader parseDateValue for YYYY-MM-DDTHH:mm). ChipDatePicker mirrors that with mode='range' and showTime on the chip trigger.

Consumers switch as follows: modals and forms use ChipDatePicker (KB document tags, tables row modal); anchored custom-range filters use Popover + Calendar (workspace logs, EE audit logs); table inline date cells use the same popover pattern with single-day Calendar. The playground showcases ChipDatePicker instead of DatePicker.

Also removes the unused logs-toolbar/ tree (LogsToolbar, AutocompleteSearch) and adds unit tests for the new calendar range/parse/format helpers. Range wire format stays YYYY-MM-DD / YYYY-MM-DDTHH:mm with :59-closed ends; the range UI is single-month (was dual-month on the old picker).

Reviewed by Cursor Bugbot for commit 58512c0. Configure here.

@greptile-apps

greptile-apps Bot commented Jun 26, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR consolidates date selection onto the chip Calendar components. The main changes are:

  • Added range mode to Calendar and ChipDatePicker.
  • Migrated logs, audit logs, table cells, row modals, KB tags, and playground examples.
  • Removed the legacy DatePicker and unused logs-toolbar files.
  • Added tests for range bounds and date parsing helpers.

Confidence Score: 5/5

This looks safe to merge.

  • No blocking issues found in the changed code.

Important Files Changed

Filename Overview
apps/sim/components/emcn/components/calendar/calendar.tsx Adds single and range calendar paths with staged range selection, time support, and helper formatting.
apps/sim/components/emcn/components/chip-date-picker/chip-date-picker.tsx Extends the chip date picker to support range selection through the shared Calendar.
apps/sim/app/workspace/[workspaceId]/logs/logs.tsx Moves the logs custom range picker from the retired DatePicker to a Popover-hosted Calendar.
apps/sim/ee/audit-logs/components/audit-logs.tsx Moves the audit logs custom range picker to the shared Calendar.
apps/sim/app/workspace/[workspaceId]/tables/[tableId]/components/table-grid/cells/inline-editors.tsx Updates inline date-cell editing to use the shared Calendar in a popover.

Reviews (6): Last reviewed commit: "fix(logs): keep the date-range popover a..." | Re-trigger Greptile

ChipDatePicker was single-date only, so date-range surfaces had to fall back
to the legacy DatePicker primitive. Add range support as a discriminated
mode on the existing canonical Calendar (not a parallel component): a
start/end selection staged behind Clear/Cancel/Apply with optional
time-of-day inputs, built from the chip family (CalendarDayCell, chipVariants,
ChipTimePicker) and fully tokenized. ChipDatePicker gains a matching
mode='range' that renders it behind the same chip trigger.

Extract the range-bounds serialization into a pure, unit-tested helper, and
remove the dead logs-toolbar directory (LogsToolbar/AutocompleteSearch had no
consumers; the logs page renders its toolbar inline).
@waleedlatif1 waleedlatif1 changed the title improvement(knowledge): use canonical ChipDatePicker in document tags modal improvement(emcn/knowledge): ChipDatePicker range support, KB date-picker alignment, dead-code cleanup Jun 26, 2026
@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@greptile

@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@cursor review

Comment thread apps/sim/components/emcn/components/calendar/calendar.tsx
…e chip calendar

Removes the parallel DatePicker component (its own dual-month CalendarMonth,
hardcoded colors, non-chip chrome) so the chip Calendar is the single date
surface. Migrates every consumer:

- tables row modal -> ChipDatePicker (single)
- tables inline grid editor, logs filter, ee audit-logs filter -> canonical
  Calendar inside an emcn Popover (the same headless/anchored pattern
  DatePicker rendered internally; single for the grid cell, range+time for the
  log filters)
- playground -> ChipDatePicker showcase (single, range, range+time)

The range bounds keep the exact YYYY-MM-DD / YYYY-MM-DDTHH:mm wire format, so
the log filters' parsing is unchanged. Calendar is imported via its component
path (the emcn barrel already exports a Calendar icon).
@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@greptile

@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@cursor review

@waleedlatif1 waleedlatif1 changed the title improvement(emcn/knowledge): ChipDatePicker range support, KB date-picker alignment, dead-code cleanup refactor(emcn): consolidate date pickers onto the chip Calendar (range support + retire legacy DatePicker) Jun 26, 2026

@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!

1 issue from previous review remains unresolved.

Fix All in Cursor

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

Reviewed by Cursor Bugbot for commit 967104d. Configure here.

Cursor Bugbot: RangeCalendarView seeded its staged selection from props only
once. Closing the popover unmounts it (so a fresh open re-seeds), but if the
bound startDate/endDate change while it stays mounted the grid could linger on
a stale draft. Add a render-phase reset keyed on the bound props.
@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@greptile

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

…resync

Replaces the imperative render-phase state reset with React's idiomatic
key-based reset: the range view is keyed on its committed bounds in the
Calendar dispatcher, so a newly applied range remounts it with fresh draft
state. Cleaner and fully encapsulated — consumers need no special handling.
Move the rationale into TSDoc (no inline comment).
@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@greptile

@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 520aa22. Configure here.

…range select

The custom-range Calendar is anchored with an always-rendered PopoverAnchor
overlaying the time-range combobox (absolute inset-0). Without
pointer-events-none it would intercept clicks meant for the select, leaving it
unclickable. The anchor is only a positioning reference, so disable its pointer
events on both the logs and audit-logs filters.
@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@greptile

@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 58512c0. Configure here.

@waleedlatif1 waleedlatif1 merged commit 02d254e into staging Jun 26, 2026
11 checks passed
@waleedlatif1 waleedlatif1 deleted the kb-design-alignment branch June 26, 2026 18:16
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