Skip to content

Commit 74f44d5

Browse files
committed
refactor: remove gradient handling logic from GeneralToolCard component
1 parent d83983b commit 74f44d5

1 file changed

Lines changed: 0 additions & 25 deletions

File tree

  • webapp/_webapp/src/components/message-entry-container/tools

webapp/_webapp/src/components/message-entry-container/tools/general.tsx

Lines changed: 0 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@ const shimmerStyle = {
3131
export const GeneralToolCard = ({ functionName, message, animated, isCollapsed: externalIsCollapsed, onToggleCollapse, isLoading }: GeneralToolCardProps) => {
3232
const [internalIsCollapsed, setInternalIsCollapsed] = useState(true);
3333
const scrollContainerRef = useRef<HTMLDivElement>(null);
34-
const [showGradients, setShowGradients] = useState(false);
3534

3635
// Use external state if provided, otherwise use internal state
3736
const isCollapsed = externalIsCollapsed !== undefined ? externalIsCollapsed : internalIsCollapsed;
@@ -43,20 +42,6 @@ export const GeneralToolCard = ({ functionName, message, animated, isCollapsed:
4342
}
4443
}, [externalIsCollapsed]);
4544

46-
// Check if content exceeds 4 lines to show gradients
47-
useEffect(() => {
48-
if (scrollContainerRef.current && !isCollapsed) {
49-
const container = scrollContainerRef.current;
50-
// Calculate line height: text-[11px] with default line-height ~1.5 = ~16.5px
51-
const lineHeight = parseFloat(getComputedStyle(container).lineHeight) || 16.5;
52-
const scrollHeight = container.scrollHeight;
53-
const lineCount = scrollHeight / lineHeight;
54-
setShowGradients(lineCount > 4);
55-
} else {
56-
setShowGradients(false);
57-
}
58-
}, [message, isCollapsed]);
59-
6045
// Auto-scroll to bottom when message updates and is loading
6146
useEffect(() => {
6247
if (isLoading && scrollContainerRef.current && !isCollapsed) {
@@ -132,11 +117,6 @@ export const GeneralToolCard = ({ functionName, message, animated, isCollapsed:
132117
"canselect rounded-md !border px-2 py-1 mt-1 transition-opacity duration-200 relative",
133118
isCollapsed ? "opacity-0" : "opacity-100 !border-gray-200"
134119
)}>
135-
{/* Fade-out gradient at top - only show if content exceeds 4 lines */}
136-
{showGradients && (
137-
<div className="absolute top-0 left-0 right-0 h-6 bg-gradient-to-b from-white to-transparent pointer-events-none z-10 rounded-t-md" />
138-
)}
139-
140120
{/* Scrollable content with max height - hide scrollbar */}
141121
<div
142122
ref={scrollContainerRef}
@@ -150,11 +130,6 @@ export const GeneralToolCard = ({ functionName, message, animated, isCollapsed:
150130
{message}
151131
</Streamdown>
152132
</div>
153-
154-
{/* Fade-out gradient at bottom - only show if content exceeds 4 lines */}
155-
{showGradients && (
156-
<div className="absolute bottom-0 left-0 right-0 h-6 bg-gradient-to-t from-white to-transparent pointer-events-none z-10 rounded-b-md" />
157-
)}
158133
</div>
159134
</div>
160135
</div>

0 commit comments

Comments
 (0)