import { DocumentIcon, WarningIcon } from "@chopin/icons"; import type { Relation } from "../relation"; /** Pending with nobody to do the work: said plainly, and without a pulse. */ export const NOT_LINKED = "Not linked yet"; const ORDER: Relation[] = ["orphaned", "pending", "linked", "empty"]; /** One state for a card, and the question a linked card points through. */ export function cardRelation( relations: Record | undefined, questions: string[], ): { relation: Relation; question: string } | undefined { if (!relations) return undefined; for (let relation of ORDER) { let question = questions.find(id => relations[id] === relation); if (question) return { relation, question }; } return undefined; } const ROW = "inline-flex min-w-0 items-center gap-1.5 text-xs"; export function RelationNote( { count = 0, onEnter, onLeave, onSelect, pending = "Linking…", question, relation }: { count?: number; onEnter?: (question: string) => void; onLeave?: (question: string) => void; onSelect?: (question: string) => void; /** A host that knows what the wait is for can say so. */ pending?: string; question: string; relation: Relation; }, ) { if (relation === "linked") { if (!onSelect) return null; return ( ); } if (relation === "pending") { return ( ); } if (relation === "orphaned") { return ( ); } return ( ); }