Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Dec 5, 2025

Implements keyboard shortcut to create calendar events in day view. Pressing 'c' creates an event when not focused on tasks, or a task when focused within the task section.

Changes

  • Context-aware shortcut handler: Added handleCreateShortcut that checks isFocusedWithinTask() to route 'c' key to either task or event creation
  • Event creation flow:
    • Restructured DayViewContent to access DraftContextV2 via inner component
    • Creates draft event with start time at current hour, duration 1 hour
    • Positions floating form at screen center using virtual reference point
  • Shortcuts overlay: Added "Create event" entry to Calendar section in dayAgendaShortcuts

Implementation

const handleCreateShortcut = useCallback(() => {
  if (isFocusedWithinTask()) {
    onAddTask?.();  // Existing behavior
  } else {
    onCreateEvent?.();  // New: creates calendar event
  }
}, [onAddTask, onCreateEvent]);

Event created with:

  • Start: Current hour rounded to :00
  • End: +1 hour
  • Form positioned at viewport center
  • Error handling for auth failures

Notes

  • Preserves existing 'c' behavior for task creation when focused on tasks
  • Respects editable element checks (won't trigger while typing)
  • All tests updated for context-aware behavior (1232 passing)
Original prompt

This section details on the original issue you should resolve

<issue_title>Add a shortcut in the day view to create an event</issue_title>
<issue_description>### Priority

High (would significantly improve my experience)

Feature Description

Implement a keyboard shortcut in the day view of Compass to quickly create a new calendar event. Pressing the "c" key should immediately open the event creation form, allowing users to add details and schedule an event for the selected day. This shortcut should be context-aware; only triggering in the day view and when no other input fields or modals are focused, to avoid interfering with text entry or other interactions.

Use Case

Users who frequently add events throughout their workday can do so much faster by using a single key. For example, a user navigating through their agenda with keyboard shortcuts can press "c" to instantly bring up the event form, streamlining the workflow and minimizing context switching. This improves efficiency and increases comfort for power users who rely on keyboard-centric navigation.

Additional Context

Follow interaction and accessibility standards defined in AGENTS.md. Ensure the shortcut does not conflict with other commands; provide visual feedback or tooltips for discoverability.</issue_description>

Comments on the Issue (you are @copilot in this section)


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Copilot AI and others added 2 commits December 5, 2025 18:35
… view

Co-authored-by: victor-enogwe <23452630+victor-enogwe@users.noreply.github.com>
Co-authored-by: victor-enogwe <23452630+victor-enogwe@users.noreply.github.com>
Copilot AI changed the title [WIP] Add keyboard shortcut to create event in day view feat(web): add context-aware 'c' shortcut to create events in day view Dec 5, 2025
Copilot AI requested a review from victor-enogwe December 5, 2025 18:45
Copilot finished work on behalf of victor-enogwe December 5, 2025 18:45
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.

Add a shortcut in the day view to create an event

2 participants