Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
import { type ReactNode, useRef } from 'react'
import { cn, scrollFadeAttributes, scrollFadeClass, useScrollEdges } from '@sim/emcn'
import {
cn,
overflowFadeSizeClass,
scrollFadeAttributes,
scrollFadeClass,
useScrollEdges,
} from '@sim/emcn'
import { HEADER_ACTION_CLUSTER, PAGE_HEADER_BAR } from '@/components/page-header-bar'
import type { WorkspaceSearchFilters } from '@/lib/api/contracts/knowledge'
import type { SearchResource } from '@/lib/mothership/generated/resources'
Expand Down Expand Up @@ -51,6 +57,7 @@ export function SearchResultsView({
SIDEBAR_DIVIDER_PAD_BELOW_CLASS,
SIDEBAR_DIVIDER_PAD_ABOVE_CLASS,
scrollFadeClass,
overflowFadeSizeClass,
'min-h-0 flex-1 overflow-y-auto [scrollbar-gutter:stable_both-edges]'
)}
{...scrollFadeAttributes(scrollEdges)}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,14 @@ import {
useRef,
useState,
} from 'react'
import { type ClipboardContent, cn } from '@sim/emcn'
import {
type ClipboardContent,
cn,
overflowFadeSizeClass,
scrollFadeAttributes,
scrollFadeClass,
useScrollEdges,
} from '@sim/emcn'
import { useQueryClient } from '@tanstack/react-query'
import { defaultRangeExtractor, type Range, useVirtualizer } from '@tanstack/react-virtual'
import { SMOOTH_CHASE_RATE } from '@/lib/core/utils/smooth-bottom-chase'
Expand Down Expand Up @@ -529,6 +536,10 @@ export function MothershipChat({
})

const hasMessages = messages.length > 0
const scrollEdges = useScrollEdges(scrollElementRef, {
contentRef: sizerRef,
enabled: !isLoading || hasMessages,
})

/**
* Keep a bottom-pinned transcript pinned when the scroll container resizes.
Expand Down Expand Up @@ -851,7 +862,12 @@ export function MothershipChat({
inputRef={find.inputRef}
/>
)}
<div ref={setScrollElement} className={styles.scrollContainer} onCopy={handleCopy}>
<div
ref={setScrollElement}
className={cn(styles.scrollContainer, scrollFadeClass, overflowFadeSizeClass)}
{...scrollFadeAttributes(scrollEdges)}
onCopy={handleCopy}
>
{isLoading && !hasMessages ? (
<MothershipChatSkeleton layout={layout} />
) : (
Expand Down
Loading