/** * rCal applet definitions — Next Event. */ import type { AppletDefinition, AppletLiveData } from "../../shared/applet-types"; const nextEvent: AppletDefinition = { id: "next-event", label: "Next Event", icon: "📅", accentColor: "#2563eb", ports: [ { name: "events-in", type: "json", direction: "input" }, { name: "event-out", type: "json", direction: "output" }, ], renderCompact(data: AppletLiveData): string { const { snapshot } = data; const title = (snapshot.title as string) || "No upcoming events"; const time = (snapshot.time as string) || ""; const location = (snapshot.location as string) || ""; return `
${title}
${time ? `
🕐 ${time}
` : ""} ${location ? `
📍 ${location}
` : ""} ${!time && !location ? `
Connect a calendar feed
` : ""}
`; }, onInputReceived(portName, value, ctx) { if (portName === "events-in" && Array.isArray(value) && value.length > 0) { ctx.emitOutput("event-out", value[0]); } }, }; export const calApplets: AppletDefinition[] = [nextEvent];