# Calendar today

The next event as a big number and today's events as a list, built from the phone's calendar.

**Sizes:** small (next event), medium (next on the left, today's list on the right), large (both)
**Needs:** the Calendar switch in Droplet.ai, Settings, Phone access (check that `calendar` is in the context)
**Freshness:** your agent, in the morning and when the calendar changes; the list doesn't update itself

## Widget

```json
{
  "slug": "calendar-today",
  "title": "Today",
  "symbol": "calendar",
  "accent": "#FF453A",
  "blocks": [
    { "type": "metric", "label": "Next: Standup", "value": "10:00" },
    { "type": "list", "title": "Today", "items": ["10:00 Team standup", "14:00 Design review", "17:30 1:1 with Sara"] }
  ],
  "sizes": { "small": [0], "large": [0, 1] },
  "lock": { "circular": 0, "inline": "10:00 Standup" }
}
```

Medium has no `sizes`, so it uses the split layout: the metric in the left column and the list on the right. Next to a number, list titles fit about 23 characters, so keep them short. Don't write "in 25 min" anywhere: it's wrong a minute later.

## Build it from the phone

```javascript
const ctx = await droplet_get_phone_context();
if (!ctx.shared || !("calendar" in ctx)) {
  // Not shared: tell the user, or ask them to turn on Calendar in Droplet.ai, Settings, Phone access.
}
const today = ctx.local_time.slice(0, 10);
const now = Date.parse(ctx.local_time);
const events = (ctx.calendar ?? []).filter((e) => e.start.startsWith(today) && !e.all_day);
const next = events.find((e) => Date.parse(e.end) > now);
const hhmm = (iso) => iso.slice(11, 16);

const blocks = [
  next
    ? { type: "metric", label: `Next: ${next.title}`.slice(0, 40), value: hhmm(next.start) }
    : { type: "metric", label: "Next", value: "Free" },
  events.length
    ? { type: "list", title: "Today", items: events.slice(0, 6).map((e) => `${hhmm(e.start)} ${e.title}`.slice(0, 23)) }
    : { type: "text", text: "Nothing else today." },
];

await droplet_set_widget({
  slug: "calendar-today", title: "Today", symbol: "calendar", blocks,
  sizes: { small: [0], large: [0, 1] },
  lock: { circular: 0, inline: next ? `${hhmm(next.start)} ${next.title}`.slice(0, 20) : "Free today" },
});
```

The phone shares events from 30 minutes ago to the end of tomorrow (up to 20), with `title`, `start`, `end`, `calendar`, and `all_day` and `location` when set. No notes, meeting links or attendees: if the user wants a join button, ask them for the link or read it from their calendar service.
