Skip to content

Commit 87166b0

Browse files
fix(web): preserve timeline fade bounds
Co-authored-by: Exotic <[email protected]>
1 parent b6c57a6 commit 87166b0

1 file changed

Lines changed: 8 additions & 14 deletions

File tree

‎apps/web/src/components/chat/MessagesTimeline.tsx‎

Lines changed: 8 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -451,18 +451,17 @@ export const MessagesTimeline = memo(function MessagesTimeline({
451451
);
452452
return config ? { ...config, onReady: handleAnchorReady } : undefined;
453453
}, [anchorMessageId, handleAnchorReady, rows]);
454-
const timelineScrollFadeMask =
454+
const timelineBottomFadeMask =
455455
contentInsetEndAdjustment > 0
456-
? `linear-gradient(to bottom, ${
457-
topFadeEnabled ? "transparent 0, black var(--timeline-top-fade-height)," : "black 0,"
458-
} black calc(100% - var(--timeline-composer-overlay-height) - 1.5rem), transparent calc(100% - var(--timeline-composer-overlay-height)), transparent 100%)`
456+
? "linear-gradient(to bottom, black 0, black calc(100% - var(--timeline-composer-overlay-height) - 1.5rem), transparent calc(100% - var(--timeline-composer-overlay-height)), transparent 100%)"
459457
: null;
460458
const timelineViewportStyle =
461-
timelineScrollFadeMask === null
459+
timelineBottomFadeMask === null
462460
? undefined
463461
: ({
464-
"--timeline-composer-overlay-height": `${contentInsetEndAdjustment}px`,
465-
"--virtualized-scroll-fade-mask": timelineScrollFadeMask,
462+
"--timeline-composer-overlay-height": `min(${contentInsetEndAdjustment}px, 60%)`,
463+
WebkitMaskImage: timelineBottomFadeMask,
464+
maskImage: timelineBottomFadeMask,
466465
} as CSSProperties);
467466

468467
const handleScroll = useCallback(() => {
@@ -597,11 +596,7 @@ export const MessagesTimeline = memo(function MessagesTimeline({
597596
<TimelineRowActivityCtx value={activityState}>
598597
<div
599598
ref={setTimelineViewportElement}
600-
className={cn(
601-
"relative h-full min-h-0",
602-
topFadeEnabled &&
603-
"[--timeline-top-fade-height:2.5rem] sm:[--timeline-top-fade-height:3rem]",
604-
)}
599+
className="relative h-full min-h-0"
605600
style={timelineViewportStyle}
606601
>
607602
<LegendList<MessagesTimelineRow>
@@ -623,8 +618,7 @@ export const MessagesTimeline = memo(function MessagesTimeline({
623618
onScroll={handleScroll}
624619
className={cn(
625620
"scrollbar-gutter-both h-full min-h-0 overflow-x-hidden overscroll-y-contain px-3 [overflow-anchor:none] sm:px-5",
626-
contentInsetEndAdjustment > 0 && "virtualized-scroll-fade",
627-
contentInsetEndAdjustment === 0 && topFadeEnabled && "topbar-scroll-fade",
621+
topFadeEnabled && "topbar-scroll-fade",
628622
)}
629623
ListHeaderComponent={
630624
loadEarlier !== null ? (

0 commit comments

Comments
 (0)