MCPcopy Create free account
hub / github.com/Openpanel-dev/openpanel / StreamingText

Function StreamingText

apps/public/src/components/illustrations/mcp.tsx:87–131  ·  view source on GitHub ↗
({ text, done }: { text: string; done: boolean })

Source from the content-addressed store, hash-verified

85}
86
87function StreamingText({ text, done }: { text: string; done: boolean }) {
88 // Split the full response into plain/highlighted segments for rendering
89 const segments: { content: string; highlight?: 'white' | 'emerald' }[] = [
90 { content: 'Last week saw ' },
91 { content: '1,234 new signups', highlight: 'white' },
92 { content: ' — up 23% from the week before. Your signup funnel is converting at ' },
93 { content: '72%', highlight: 'emerald' },
94 { content: ', the highest rate in the past month.' },
95 ];
96
97 // Walk through segments, revealing up to text.length characters
98 let remaining = text.length;
99 const rendered: ReactNode[] = [];
100
101 for (const seg of segments) {
102 if (remaining <= 0) break;
103 const visible = seg.content.slice(0, remaining);
104 remaining -= seg.content.length;
105
106 if (seg.highlight === 'white') {
107 rendered.push(
108 <span key={seg.content} className={done ? 'font-semibold text-white/90' : 'text-white/70'}>
109 {visible}
110 </span>,
111 );
112 } else if (seg.highlight === 'emerald') {
113 rendered.push(
114 <span key={seg.content} className={done ? 'font-semibold text-emerald-400' : 'text-white/70'}>
115 {visible}
116 </span>,
117 );
118 } else {
119 rendered.push(<span key={seg.content}>{visible}</span>);
120 }
121 }
122
123 return (
124 <p className="text-[10px] text-white/70 leading-relaxed">
125 {rendered}
126 {!done && (
127 <span className="ml-0.5 inline-block h-3 w-px bg-white/60 animate-pulse align-middle" />
128 )}
129 </p>
130 );
131}
132
133export function McpIllustration() {
134 const [phase, setPhase] = useState<Phase>('user');

Callers

nothing calls this directly

Calls 1

pushMethod · 0.45

Tested by

no test coverage detected