File tree Expand file tree Collapse file tree
apps/sim/app/workspace/[workspaceId]/home/components/message-content/components/agent-group Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -154,6 +154,7 @@ function BoundedViewport({ children, isStreaming }: BoundedViewportProps) {
154154 const ref = useRef < HTMLDivElement > ( null )
155155 const rafRef = useRef < number | null > ( null )
156156 const stickToBottomRef = useRef ( true )
157+ const [ hasOverflow , setHasOverflow ] = useState ( false )
157158
158159 useEffect ( ( ) => {
159160 const el = ref . current
@@ -176,6 +177,11 @@ function BoundedViewport({ children, isStreaming }: BoundedViewportProps) {
176177 } , [ ] )
177178
178179 useLayoutEffect ( ( ) => {
180+ const el = ref . current
181+ if ( el ) {
182+ const next = el . scrollHeight > el . clientHeight
183+ setHasOverflow ( ( prev ) => ( prev === next ? prev : next ) )
184+ }
179185 if ( rafRef . current !== null ) {
180186 window . cancelAnimationFrame ( rafRef . current )
181187 rafRef . current = null
@@ -206,11 +212,19 @@ function BoundedViewport({ children, isStreaming }: BoundedViewportProps) {
206212 } )
207213
208214 return (
209- < div
210- ref = { ref }
211- className = 'max-h-[110px] overflow-y-auto pr-2 [-ms-overflow-style:none] [scrollbar-width:none] [&::-webkit-scrollbar]:hidden'
212- >
213- { children }
215+ < div className = 'relative' >
216+ < div
217+ ref = { ref }
218+ className = { cn ( 'max-h-[110px] overflow-y-auto pr-2' , hasOverflow && 'py-1' ) }
219+ >
220+ { children }
221+ </ div >
222+ { hasOverflow && (
223+ < >
224+ < div className = 'pointer-events-none absolute top-0 right-2 left-0 h-3 bg-gradient-to-b from-[var(--bg)] to-transparent' />
225+ < div className = 'pointer-events-none absolute right-2 bottom-0 left-0 h-3 bg-gradient-to-t from-[var(--bg)] to-transparent' />
226+ </ >
227+ ) }
214228 </ div >
215229 )
216230}
You can’t perform that action at this time.
0 commit comments