Skip to content

TUI Calendar: open a read-only event card on Enter - #419

Open
albertreig wants to merge 1 commit into
basecamp:mainfrom
albertreig:feat/calendar-event-detail-card
Open

TUI Calendar: open a read-only event card on Enter#419
albertreig wants to merge 1 commit into
basecamp:mainfrom
albertreig:feat/calendar-event-detail-card

Conversation

@albertreig

@albertreig albertreig commented Sep 9, 2026

Copy link
Copy Markdown

What

In the calendar's Day and Week views, Enter did nothing on a highlighted event; inside a Year cell it did nothing either. Meanwhile the content help bar advertised enter open the whole time — the generic rowContent binding from updateHelpBindings, which is live in Mail and dead in the calendar. The only way to see an event's notes, location, link or guests was to open the edit form with e.

Enter now opens a read-only detail card over the grid — the same shape as Contacts, where Enter views a contact and e edits it.

╭──────────────────────────────────────────────╮
│  Roadmap review                              │
│                                              │
│  Thursday, August 20 · 2:00pm–3:00pm         │
│  Repeats every week                          │
│                                              │
│  Calendar  Design Team                       │
│  Location  Sala 2                            │
│  Link      https://meet.example.com/roadmap  │
│  Guests    ana@example.com, luis@example.com │
│                                              │
│  Notes                                       │
│  Bring the September report                  │
╰──────────────────────────────────────────────╯

How

  • The card is built from the selected Recording alone — the grid read already carries Notes, Location, Link and Attendees (kept on the model for exactly this reason), so there is no extra request.
  • From the card: o opens the link through viewContext.openAttachment (the same xdg-open / open / Windows handler attachments use), e closes the card and opens the edit form on the same event, esc/q closes it, and the arrows / page keys scroll the notes.
  • calendarView.detail joins CapturingInput(), so the model routes every key to the card (it handles esc/q itself, not via CancelPendingDetail) and the help bar shows o / e / esc instead of the misleading generic enter open.
  • o only opens http/https links. Event links are server data and the edit form accepts any URI with a host, so a shared event could carry a file:// path or an application scheme — the card shows those but never hands them to the OS launcher, and does not offer o for them.
  • The when-and-where line shows the reader's local clock (the same conversion Recording.Starts/Ends and the grid make), rather than labelling a converted time with the event's original zone. The calendar name is sanitized like every other view of server metadata.
  • Year view keeps its two stages: Enter with no cell open still steps into the cell; only once inYearCell does Enter open the selected event.

Changes

File
internal/tui/event_detail.go new — the card: layout, the when/where line, repeat-frequency label, notes wrapping, help bindings
internal/tui/calendar.go detail field; openEventDetail / openEventLink / calendarName; hooks in handleContentKey, handleArrowKey, View, HelpBindings, CapturingInput, Resize, Restyle, CancelPendingDetail
internal/tui/calendar_test.go tests: Enter opens the card (holds every key, esc/q close it), o opens an http link, o refuses a non-web link, a model-level esc regression test, e swaps in the edit form, Enter opens the card inside a Year cell
docs/tui.md Calendar key reference note

Testing

go build ./..., go vet ./..., golangci-lint run (v2.11.1) and go test ./... all pass.

Fixes #418

🤖 Generated with Claude Code

https://claude.ai/code/session_01C6Y2KeiHB6QNWmHdgqbzD1

Copilot AI balanced review requested due to automatic review settings September 9, 2026 04:21
@albertreig
albertreig requested a review from a team as a code owner September 9, 2026 04:21

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟡 Changes recommended

Closing shortcuts are currently ineffective, and event metadata, time-zone labeling, and opened URL schemes need safer handling.

Once you've addressed the issues Copilot identified, you can request another Copilot review.

Pull request overview

Adds a read-only calendar event card for Day, Week, and Year views.

Changes:

  • Opens event details with Enter.
  • Supports link opening, editing, closing, and note scrolling.
  • Documents and tests the new interactions.

[!TIP]
If you aren't ready for review, convert to a draft PR.
Click "Convert to draft" or run gh pr ready --undo.
Click "Ready for review" or run gh pr ready to reengage.

File summaries
File Description
internal/tui/event_detail.go Implements the event card.
internal/tui/calendar.go Integrates card interaction and lifecycle.
internal/tui/calendar_test.go Tests opening, editing, and links.
docs/tui.md Documents calendar controls.
Review details
  • Files reviewed: 4/4 changed files
  • Comments generated: 4
  • Review effort level: Balanced

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread internal/tui/calendar.go Outdated
Comment on lines +1347 to +1354
link := strings.TrimSpace(v.detail.event.Link)
if link == "" {
return nil
}
if v.vc.openAttachment == nil {
return nil
}
if err := v.vc.openAttachment(link); err != nil {
Comment thread internal/tui/event_detail.go
Comment thread internal/tui/calendar.go
Comment on lines +1054 to +1064
if v.detail != nil {
switch msg.String() {
case "o":
return v.openEventLink()
case "e":
event := v.detail.event
v.detail = nil
return v.startEventForm(eventFormEdit, event)
}
return v.detail.update(msg)
}
Comment thread internal/tui/event_detail.go Outdated
Comment on lines +148 to +157
line := starts.Format("Monday, January 2") + " · " + clockTime(starts, d.use24)
switch {
case ends.IsZero() || !ends.After(starts):
case sameDay(starts, ends):
line += "–" + clockTime(ends, d.use24)
default:
line += " – " + ends.Format("Monday, January 2") + " · " + clockTime(ends, d.use24)
}
if zone := d.event.StartsAtZone; zone != "" {
line += " (" + zone + ")"
In the calendar's Day and Week views Enter did nothing on a highlighted
event, and inside a Year cell it did nothing either, while the content
help bar advertised "enter  open" the whole time (the generic rowContent
binding, live in Mail and dead here). The only way to see an event's
notes, location, link or guests was to open the edit form with `e`.

Enter now opens a read-only detail card over the grid, the way Contacts
opens a contact on Enter and leaves `e` for editing. The card is built
from the selected Recording alone -- the grid read already carries Notes,
Location, Link and Attendees -- so nothing is fetched. From the card `o`
opens the link, `e` swaps in the edit form on the same event, esc/q
closes it, and the arrows and page keys scroll the notes. The card is an
inputCapturer, so it handles esc itself and the help bar shows its keys
instead of the generic "enter open".

Two safeguards on what the card shows and does:

- `o` only hands an http/https link to the OS launcher. Event links are
  server data and the edit form accepts any URI with a host, so a shared
  event could carry a file:// path or an application scheme; those are
  shown on the card but not opened, and `o` is not offered for them.
- The when-and-where line shows the reader's local clock, the same
  conversion Recording.Starts/Ends and the grid make, rather than
  labelling a converted time with the event's original zone. The
  calendar name is sanitized like every other view of server metadata.

Year view keeps its two stages: Enter steps into a cell, and only once
inside does it open the selected event.

Fixes basecamp#418

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01C6Y2KeiHB6QNWmHdgqbzD1
@albertreig
albertreig force-pushed the feat/calendar-event-detail-card branch from 6cda55d to cae22f1 Compare September 9, 2026 04:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

TUI Calendar: Enter does nothing on a highlighted event (Day/Week), though the help bar shows "enter: open"

2 participants