@@ -17,10 +17,12 @@ import {
1717 assistantCitationHash ,
1818 assistantCitationNavigation ,
1919} from "../../lib/assistantCitationNavigation" ;
20+ import { cn } from "~/lib/utils" ;
2021import { ContextChip , ContextChipAction , ContextChipLabel } from "../ContextChip" ;
2122import { ContextChipPopover } from "../contextChipParts" ;
2223import { Button } from "../ui/button" ;
2324import { Popover , PopoverClose , PopoverPopup , PopoverTrigger } from "../ui/popover" ;
25+ import { getVirtualizedScrollFadeClassName } from "../ui/scroll-area" ;
2426import { AssistantCitationCommentEditor } from "./AssistantCitationCommentEditor" ;
2527import { resolveAssistantCitationCommentDismissal } from "./assistantCitationCommentDismissal" ;
2628import { observeAssistantCitationCommentSource } from "./AssistantCitationSource" ;
@@ -131,12 +133,7 @@ export function AssistantCitationChip({
131133 copyMarkdown = { serializeAssistantCitation ( citation ) }
132134 >
133135 < div className = "space-y-3 p-1 text-sm" >
134- < div className = "max-h-64 space-y-3 overflow-y-auto whitespace-pre-wrap wrap-break-word" >
135- < blockquote className = "border-l-2 border-border pl-3 text-muted-foreground" >
136- { citation . text }
137- </ blockquote >
138- { citation . comment ? < p > { citation . comment } </ p > : null }
139- </ div >
136+ < AssistantCitationQuote citation = { citation } />
140137 < PopoverClose
141138 render = { < Button variant = "outline" size = "sm" render = { < Link { ...sourceLinkProps } /> } /> }
142139 >
@@ -240,3 +237,26 @@ export function AssistantCitationChip({
240237 </ ContextChip >
241238 ) ;
242239}
240+
241+ function AssistantCitationQuote ( { citation } : { citation : AssistantCitation } ) {
242+ const [ fadeBottom , setFadeBottom ] = useState ( false ) ;
243+ const updateFade = ( element : HTMLElement ) =>
244+ setFadeBottom ( element . scrollHeight - element . clientHeight - element . scrollTop > 1 ) ;
245+ return (
246+ < div
247+ ref = { ( element ) => {
248+ if ( element ) updateFade ( element ) ;
249+ } }
250+ onScroll = { ( event ) => updateFade ( event . currentTarget ) }
251+ className = { cn (
252+ "max-h-64 space-y-3 overflow-y-auto whitespace-pre-wrap wrap-break-word" ,
253+ getVirtualizedScrollFadeClassName ( { top : false , bottom : fadeBottom } ) ,
254+ ) }
255+ >
256+ < blockquote className = "border-l-2 border-border pl-3 text-muted-foreground" >
257+ { citation . text }
258+ </ blockquote >
259+ { citation . comment ? < p > { citation . comment } </ p > : null }
260+ </ div >
261+ ) ;
262+ }
0 commit comments