refactor: reorganize BatchAction import paths and enhance child segment scrolling behavior

This commit is contained in:
twwu 2024-12-13 10:12:43 +08:00
parent a8254c29c5
commit 1641638523
4 changed files with 19 additions and 9 deletions

View File

@ -9,7 +9,7 @@ import { ProcessStatus } from '../segment-add'
import s from './style.module.css'
import SegmentList from './segment-list'
import DisplayToggle from './display-toggle'
import BatchAction from './batch-action'
import BatchAction from './common/batch-action'
import SegmentDetail from './segment-detail'
import SegmentCard from './segment-card'
import ChildSegmentList from './child-segment-list'
@ -101,6 +101,7 @@ const Completed: FC<ICompletedProps> = ({
const [showNewChildSegmentModal, setShowNewChildSegmentModal] = useState(false)
const segmentListRef = useRef<HTMLDivElement>(null)
const childSegmentListRef = useRef<HTMLDivElement>(null)
const needScrollToBottom = useRef(false)
const { run: handleSearch } = useDebounceFn(() => {
@ -165,6 +166,13 @@ const Completed: FC<ICompletedProps> = ({
)
const invalidChildSegmentList = useInvalid(useChildSegmentListKey)
useEffect(() => {
if (childSegmentListRef.current && needScrollToBottom.current) {
childSegmentListRef.current.scrollTo({ top: childSegmentListRef.current.scrollHeight, behavior: 'smooth' })
needScrollToBottom.current = false
}
}, [childSegments])
useEffect(() => {
if (childChunkListData)
setChildSegments(childChunkListData.data || [])

View File

@ -187,14 +187,16 @@ const DocumentDetail: FC<Props> = ({ datasetId, documentId }) => {
/>
<div className='flex items-center flex-wrap'>
{embeddingAvailable && documentDetail && !documentDetail.archived && !isFullDocMode && (
<SegmentAdd
importStatus={importStatus}
clearProcessStatus={resetProcessStatus}
showNewSegmentModal={showNewSegmentModal}
showBatchModal={showBatchModal}
/>
<>
<SegmentAdd
importStatus={importStatus}
clearProcessStatus={resetProcessStatus}
showNewSegmentModal={showNewSegmentModal}
showBatchModal={showBatchModal}
/>
<Divider type='vertical' className='!bg-divider-regular !h-[14px] !mx-3' />
</>
)}
<Divider type='vertical' className='!bg-divider-regular !h-[14px] !mx-3' />
<StatusItem
status={documentDetail?.display_status || 'available'}
scene='detail'

View File

@ -21,7 +21,7 @@ import { Globe01 } from '../../base/icons/src/vender/line/mapsAndTravel'
import ChunkingModeLabel from '../common/chunking-mode-label'
import s from './style.module.css'
import RenameModal from './rename-modal'
import BatchAction from './detail/completed/batch-action'
import BatchAction from './detail/completed/common/batch-action'
import cn from '@/utils/classnames'
import Switch from '@/app/components/base/switch'
import Divider from '@/app/components/base/divider'