-
Notifications
You must be signed in to change notification settings - Fork 21
Add calendar feature with event management and invites #3889
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Draft
jbecke
wants to merge
3
commits into
main
Choose a base branch
from
claude/calendar-block-shortcuts-0u7v6o
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,44 @@ | ||
| # block-calendar | ||
|
|
||
| A Google-Calendar-style calendar surface, opened from the sidebar ("Calendar"). | ||
|
|
||
| ## Views | ||
|
|
||
| - **Week** (`w`) — 7-day time grid (default) | ||
| - **Day** (`d`) — single-day time grid | ||
| - **List** (`l`) — agenda of upcoming events grouped by day | ||
|
|
||
| ## Keyboard shortcuts | ||
|
|
||
| Active while the calendar is focused: | ||
|
|
||
| | Key | Action | | ||
| | --- | ----------------- | | ||
| | `j` | Next screen | | ||
| | `k` | Previous screen | | ||
| | `t` | Jump to today | | ||
| | `n` | New event | | ||
| | `w` | Week view | | ||
| | `d` | Day view | | ||
| | `l` | List view | | ||
|
|
||
| `g d` (go-to leader) opens the calendar from anywhere. | ||
|
|
||
| ## Events & invites | ||
|
|
||
| Events are persisted by the `calendar_service` backend | ||
| (`rust/cloud-storage/calendar`). Data access lives in `@queries/calendar`; the | ||
| wire client is `@service-calendar`. | ||
|
|
||
| Click an empty slot to create an event, or an event to edit it. Add guests by | ||
| email; **Save & send invites** records the invite on the backend and emails | ||
| attendees from the user's connected mailbox (via the email service), including | ||
| an `.ics` payload. The dialog can also download a standalone `.ics`. | ||
|
|
||
| ## Layers | ||
|
|
||
| - `model/` — frontend domain types (instant-based, decoupled from the wire DTOs) | ||
| - `util/` — date math, iCalendar generation, invite-email composition | ||
| - `component/` — `Calendar` (orchestrator + hotkeys), `Toolbar`, `TimeGrid` | ||
| (week/day), `ListView`, `EventDialog`, and the `CalendarContext` that wires | ||
| state to queries/mutations. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,99 @@ | ||
| import { | ||
| createHotkeyGroup, | ||
| registerHotkey, | ||
| useHotkeyDOMScope, | ||
| } from '@core/hotkey/hotkeys'; | ||
| import { type HotkeyToken, TOKENS } from '@core/hotkey/tokens'; | ||
| import type { ValidHotkey } from '@core/hotkey/types'; | ||
| import { Match, onCleanup, onMount, Switch } from 'solid-js'; | ||
| import { daysForView } from '../util/dates'; | ||
| import { CalendarProvider, useCalendar } from './CalendarContext'; | ||
| import { EventDialog } from './EventDialog'; | ||
| import { ListView } from './ListView'; | ||
| import { TimeGrid } from './TimeGrid'; | ||
| import { Toolbar } from './Toolbar'; | ||
|
|
||
| function CalendarInner() { | ||
| const calendar = useCalendar(); | ||
| const [attachHotkeys, scopeId] = useHotkeyDOMScope('calendar'); | ||
| const group = createHotkeyGroup(); | ||
| let rootRef: HTMLDivElement | undefined; | ||
|
|
||
| onMount(() => { | ||
| if (rootRef) { | ||
| attachHotkeys(rootRef); | ||
| // Focus the root so j/k work without an explicit click first. | ||
| rootRef.focus(); | ||
| } | ||
|
|
||
| const bind = ( | ||
| hotkey: ValidHotkey, | ||
| hotkeyToken: HotkeyToken, | ||
| description: string, | ||
| run: () => void | ||
| ) => | ||
| group.add( | ||
| registerHotkey({ | ||
| hotkey, | ||
| scopeId, | ||
| hotkeyToken, | ||
| description, | ||
| keyDownHandler: () => { | ||
| run(); | ||
| return true; | ||
| }, | ||
| }) | ||
| ); | ||
|
|
||
| // Primary navigation: vim-style j/k step one screen forward/back, matching | ||
| // the soup list convention (j = next, k = previous). | ||
| bind('j', TOKENS.calendar.next, 'Next', calendar.goNext); | ||
| bind('k', TOKENS.calendar.prev, 'Previous', calendar.goPrev); | ||
| bind('t', TOKENS.calendar.today, 'Today', calendar.goToday); | ||
| bind('n', TOKENS.calendar.newEvent, 'New event', () => calendar.openNew()); | ||
| bind('d', TOKENS.calendar.viewDay, 'Day view', () => | ||
| calendar.setView('day') | ||
| ); | ||
| bind('w', TOKENS.calendar.viewWeek, 'Week view', () => | ||
| calendar.setView('week') | ||
| ); | ||
| bind('l', TOKENS.calendar.viewList, 'List view', () => | ||
| calendar.setView('list') | ||
| ); | ||
| }); | ||
|
|
||
| onCleanup(() => group.dispose()); | ||
|
|
||
| return ( | ||
| <div | ||
| ref={rootRef} | ||
| tabindex={0} | ||
| class="flex h-full flex-col bg-surface outline-none select-none" | ||
| > | ||
| <Toolbar /> | ||
| <div class="min-h-0 flex-1"> | ||
| <Switch> | ||
| <Match when={calendar.view() === 'week'}> | ||
| <TimeGrid days={daysForView('week', calendar.anchor())} /> | ||
| </Match> | ||
| <Match when={calendar.view() === 'day'}> | ||
| <TimeGrid days={daysForView('day', calendar.anchor())} /> | ||
| </Match> | ||
| <Match when={calendar.view() === 'list'}> | ||
| <ListView /> | ||
| </Match> | ||
| </Switch> | ||
| </div> | ||
| <EventDialog /> | ||
| </div> | ||
| ); | ||
| } | ||
|
|
||
| /** The calendar surface, opened from the sidebar. */ | ||
| export default function Calendar() { | ||
| return ( | ||
| <CalendarProvider> | ||
| <CalendarInner /> | ||
| </CalendarProvider> | ||
| ); | ||
| } |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add Postgres startup dependency for local reliability.
calendar_serviceis DB-backed but has nodepends_on, so it can start before Postgres and fail during initial connect. Add a Postgres dependency to match existing service startup patterns.Suggested fix
calendar_service: <<: [*common-env, *rust-services-image] command: ["/app/out/calendar_service"] ports: - "8101:8080" + depends_on: + - postgres networks: databases: services: aliases: - calendar-service📝 Committable suggestion
🤖 Prompt for AI Agents