export type Change = 'added' | 'removed' | 'changed' | undefined; export type Field = { name: string; type: string; note?: string; change?: Change; }; const MARK: Record, { sign: string; cls: string }> = { added: { sign: '+', cls: 'flag-added' }, removed: { sign: '−', cls: 'flag-removed' }, changed: { sign: '~', cls: 'flag-changed' }, }; /** * Database table / type shape with per-field change flags. Use for schema or * data-shape work; mark touched fields with `change` so reviewers see deltas. */ export function DataModel({ table, fields, caption }: { table: string; fields: Field[]; caption?: string }) { return (
table {table} {caption && · {caption}}
{fields.map((f, i) => { const m = f.change ? MARK[f.change] : null; return ( ); })}
{m?.sign} {f.name} {f.type} {f.note}
); }