fix(today): cloud users see 'connect daemon' instead of fake 'No events today'

Onboarding-funnel audit continued — /today is the default landing
surface, and a brand-new cockpitapp.vercel.app user always sees the
CalendarCard render "No events today" because:

  • /api/calendar returns `{events: []}` in cloud mode (isRuntimeAvailable
    is false — the calendar source is `gog calendar list`, a local
    Google CLI), and
  • CalendarCard treats events.length === 0 as the "you have nothing
    on today's calendar" branch.

That's misleading. The user might have a packed calendar locally but
is staring at "No events today" with no indication that the empty state
is a runtime gap, not a real reflection of their day. They have no
reason to ever check Settings or install anything based on what they
see.

Fix: the cloud branch now returns `{events: [], runtimeOnly: true}`.
CalendarCard checks `data.runtimeOnly` before the empty branch and
shows "Calendar shows here once the local daemon is connected." —
links the surface to the same daemon-install requirement that
DaemonStatusBanner on /control already names.

WeatherCard already handles cloud mode correctly via 947fc55 (HTTP
fallback to open-meteo); GitHubStatus is on /projects, not /today, so
out of scope for this commit.

tsc + eslint + build clean.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
g-butandClaude Opus 4.7 committed 2026-05-21 09:08:59 +02:00
1 parent 954030218c
commit 3ee1567d56
2 files changed
+10 -2

No files matched your search

+5 -1
View File
@@ -4,7 +4,11 @@ import { isRuntimeAvailable } from "@/lib/runtime";
import { CALENDAR_LOOKAHEAD_DAYS } from "@/lib/constants/today";
export async function GET() {
if (!isRuntimeAvailable()) return NextResponse.json({ events: [] });
// Cloud mode: the calendar source is `gog calendar list` (local Google CLI),
// so there's no events stream in cloud. Surface `runtimeOnly: true` so the
// UI can show a meaningful empty state instead of "No events today" which
// misleads users into thinking their calendar is genuinely empty.
if (!isRuntimeAvailable()) return NextResponse.json({ events: [], runtimeOnly: true });
const result = await runTool(
`gog calendar list --json --days ${CALENDAR_LOOKAHEAD_DAYS} 2>/dev/null || echo "[]"`,
+5 -1
View File
@@ -16,7 +16,7 @@ type CalendarEvent = {
};
export function CalendarCard() {
const { data, loading, error, refetch } = useFetch<{ events: CalendarEvent[]; error?: string }>("/api/calendar", { intervalMs: 5 * 60_000, timeoutMs: 12_000 });
const { data, loading, error, refetch } = useFetch<{ events: CalendarEvent[]; error?: string; runtimeOnly?: boolean }>("/api/calendar", { intervalMs: 5 * 60_000, timeoutMs: 12_000 });
const events = data?.events ?? [];
return (
@@ -36,6 +36,10 @@ export function CalendarCard() {
</div>
) : error || (data?.error && events.length === 0) ? (
<FetchErrorState message="Couldn't load calendar" detail={error ?? data?.error} onRetry={refetch} />
) : data?.runtimeOnly ? (
// Cloud mode — `gog calendar list` is local-only, no events stream.
// Tell the user instead of pretending they have an empty calendar.
<EmptyState>Calendar shows here once the local daemon is connected.</EmptyState>
) : events.length === 0 ? (
<EmptyState>No events today</EmptyState>
) : (