File size: 1,104 Bytes
7c5ed63 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 | import type { ProjectedMessage } from '../../types';
interface UndoRibbonProps {
/** The synthetic undo-marker message emitted by the projector
* (`source === 'undo'`). */
message: ProjectedMessage;
}
/**
* Horizontal ribbon that marks where a `context.undo` record spliced earlier
* prompts out of the conversation. Receives the `ProjectedMessage` whose
* `source === 'undo'` so we can show how many prompts / messages were removed.
*/
export function UndoRibbon({ message }: UndoRibbonProps) {
const count = message.undo?.count ?? 0;
const removed = message.undo?.removedMessageCount ?? 0;
return (
<div className="my-3 flex items-center gap-3">
<span className="h-px flex-1 bg-[var(--color-sev-warning)] opacity-50" />
<span className="font-mono text-[11px] uppercase tracking-[0.12em] text-[var(--color-sev-warning)]">
undid {count} prompt{count === 1 ? '' : 's'} · {removed} message{removed === 1 ? '' : 's'} removed · line {message.lineNo}
</span>
<span className="h-px flex-1 bg-[var(--color-sev-warning)] opacity-50" />
</div>
);
}
|