Self-hosted, Self-Improving, Federated Everything App — dev management, agent orchestration, persistent mind, digital twin, second brain, and creative pipeline from a single dashboard over Tailscale to port the user into the OS
JavaScript ai-agentsdashboarddeveloper-toolsdigital-twinquantified-selfsecond-brainself-hostedtailscale
/**
* Inline word-level diff — two stacked rows:
* - the OLD text with removed words highlighted in red
* - the NEW text with added words highlighted in green
* Shared component — used by the Cross-Domain Insights narrative diff, the
* Pipeline text-stage history modal, and the Manuscript editor's edit cards.
* The LCS/tokenize/cap core lives in `client/src/lib/diffWords.js` (shared with
* `SideBySideDiff`); this component only renders. Pure / memoized.
*/
import { memo } from 'react';
import { diffWords } from '../../lib/diffWords';
import { renderRuns } from './diffRuns';
const InlineDiff = memo(function InlineDiff({ oldText, newText, emptyLabel = 'No changes.' }) {
const oldStr = oldText || '';
const newStr = newText || '';
if (oldStr === newStr) {
return (
<div className="font-mono text-xs p-4 bg-port-bg">
<div className="text-gray-500">{emptyLabel}</div>
</div>
);
}
const { tooLarge, oldRuns, newRuns } = diffWords(oldStr, newStr);
return (
<div className="font-mono text-xs p-4 space-y-2 bg-port-bg">
{tooLarge && (
<div className="text-gray-500 text-[11px] uppercase tracking-wider">
Diff too large for inline highlighting — both versions shown in full
</div>
)}
<div>
<div className="text-[10px] uppercase tracking-wider text-gray-500 mb-1">Before</div>
<div className="text-port-error leading-relaxed whitespace-pre-wrap">{tooLarge ? oldStr : renderRuns(oldRuns, false)}</div>
</div>
<div>
<div className="text-[10px] uppercase tracking-wider text-gray-500 mb-1">After</div>
<div className="text-port-success leading-relaxed whitespace-pre-wrap">{tooLarge ? newStr : renderRuns(newRuns, true)}</div>
</div>
</div>
);
});
export default InlineDiff;