Skip to content

Commit 919265e

Browse files
committed
fix(home-chat): extract shimmer to CSS module, move streamingContentRef to main-only branch
1 parent 756e86d commit 919265e

File tree

3 files changed

+30
-25
lines changed

3 files changed

+30
-25
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
@keyframes subagent-shimmer {
2+
0% {
3+
background-position: 150% 0;
4+
}
5+
50% {
6+
background-position: 0% 0;
7+
}
8+
100% {
9+
background-position: -150% 0;
10+
}
11+
}
12+
13+
.shimmer {
14+
background-image: linear-gradient(
15+
90deg,
16+
rgba(255, 255, 255, 0) 0%,
17+
rgba(255, 255, 255, 0.85) 50%,
18+
rgba(255, 255, 255, 0) 100%
19+
);
20+
background-size: 200% 100%;
21+
background-repeat: no-repeat;
22+
-webkit-background-clip: text;
23+
background-clip: text;
24+
animation: subagent-shimmer 1.4s ease-in-out infinite;
25+
mix-blend-mode: screen;
26+
}

apps/sim/app/workspace/[workspaceId]/home/components/message-content/components/agent-group/subagent-thinking-block.tsx

Lines changed: 3 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import { memo, useEffect, useRef, useState } from 'react'
44
import { ChevronDown } from '@/components/emcn'
55
import { cn } from '@/lib/core/utils/cn'
66
import { formatDuration } from '@/lib/core/utils/formatting'
7+
import styles from './subagent-thinking-block.module.css'
78

89
const CHARS_PER_FRAME = 3
910
const SCROLL_INTERVAL_MS = 50
@@ -54,7 +55,7 @@ const StreamingText = memo(
5455
}, [content, isStreaming])
5556

5657
return (
57-
<p className='whitespace-pre-wrap text-[12px] text-[var(--text-muted)] leading-[1.4]'>
58+
<p className='whitespace-pre-wrap text-[12px] leading-[1.4] text-[var(--text-muted)]'>
5859
{displayed}
5960
</p>
6061
)
@@ -113,14 +114,6 @@ export function SubagentThinkingBlock({
113114

114115
return (
115116
<div className='pl-[24px]'>
116-
<style>{`
117-
@keyframes subagent-shimmer {
118-
0% { background-position: 150% 0; }
119-
50% { background-position: 0% 0; }
120-
100% { background-position: -150% 0; }
121-
}
122-
`}</style>
123-
124117
<button
125118
type='button'
126119
onClick={toggle}
@@ -134,21 +127,7 @@ export function SubagentThinkingBlock({
134127
aria-hidden='true'
135128
className='pointer-events-none absolute inset-0 select-none overflow-hidden'
136129
>
137-
<span
138-
className='block text-transparent'
139-
style={{
140-
backgroundImage:
141-
'linear-gradient(90deg, rgba(255,255,255,0) 0%, rgba(255,255,255,0.85) 50%, rgba(255,255,255,0) 100%)',
142-
backgroundSize: '200% 100%',
143-
backgroundRepeat: 'no-repeat',
144-
WebkitBackgroundClip: 'text',
145-
backgroundClip: 'text',
146-
animation: 'subagent-shimmer 1.4s ease-in-out infinite',
147-
mixBlendMode: 'screen',
148-
}}
149-
>
150-
{label}
151-
</span>
130+
<span className={cn('block text-transparent', styles.shimmer)}>{label}</span>
152131
</span>
153132
)}
154133
</span>

apps/sim/app/workspace/[workspaceId]/home/hooks/use-chat.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -608,8 +608,8 @@ export function useChat(
608608
tb.content = (tb.content ?? '') + normalizedChunk
609609
runningText += normalizedChunk
610610
lastContentSource = 'main'
611+
streamingContentRef.current = runningText
611612
}
612-
streamingContentRef.current = runningText
613613
flush()
614614
}
615615
break

0 commit comments

Comments
 (0)