import Link from "next/link"; import { LifecycleButton } from "@/components/piece/Lifecycle"; import { buttonVariants } from "@/components/ui/button"; import { Card } from "@/components/ui/panel"; import { readNextCall } from "@/lib/pieces/frame"; import type { LifecycleState } from "@/lib/lifecycle"; // THE NEXT CARD (canvas "Piece · Overview", `.nextcard`): the piece's top call // from the Inbox -- the same ranking, the same one action -- with the Signal // edge, and `n` runs it (components/piece/PieceKeys.tsx). A parked or done // piece's next move is Reactivate. Nothing waiting says so, with no button. // // Async: the Inbox is read whole (lib/inbox) and then narrowed, so the page // streams this in under a rather than waiting on it. export function NextCardShell({ pending = false, children }: { pending?: boolean; children: React.ReactNode }) { return ( Next {children} ); } export default async function NextCard({ pieceId, title, lifecycle }: { pieceId: string; title: string; lifecycle: LifecycleState }) { const next = await readNextCall(pieceId, lifecycle).catch(() => null); if (!next) { return (
Nothing waiting on you no call on this piece in the Inbox
); } return (
{next.what} {next.count > 1 && ( {next.count} )} {next.why} {next.more > 0 && ` · then ${next.more} more call${next.more === 1 ? "" : "s"}`}
n {next.lifecycleTo ? ( ) : ( {next.action.label} )}
); }