"use no memo"; // widget trees are built by calling the component as a plain function — the React Compiler must not transform it // Home-screen widget: the same top-three "Next up" list as the home screen. // Built only from react-native-android-widget primitives (no RN views, no // hooks) — it renders to Android RemoteViews in a headless task. // // Interactions mirror the app: tap the checkbox to complete, tap the row to // open Clarify, tap + to capture, tap anywhere else to open the app. import { FlexWidget, TextWidget } from "react-native-android-widget"; import { dueMeta, type DueTone } from "../lib/dates"; import { formatEstimate, PRIORITY_COLOR } from "../lib/priority"; import { C } from "../lib/theme"; import type { Task } from "../lib/types"; const DUE_COLOR: Record = { overdue: C.danger, today: C.warn, later: C.muted }; function Row({ task }: { task: Task }) { const due = task.due_date ? dueMeta(task.due_date) : null; // One line per row so three rows fit the 2-cell height: right-side meta is // the due label when there is one, otherwise context/estimate. const side = due ? due.label : [task.context, formatEstimate(task.estimate_min)].filter(Boolean).join(" · "); return ( {!!side && } ); } export function NextUpWidget({ tasks, totalNext, overdueCount }: { tasks: Task[]; totalNext: number; overdueCount: number }) { return ( {totalNext > tasks.length && ( )} {overdueCount > 0 && ( )} {tasks.length === 0 ? ( ) : ( {tasks.map((t) => ( ))} )} ); }