Feat: Bind data to the agent module of the home page #3221 (#7385)

### What problem does this PR solve?

Feat: Bind data to the agent module of the home page #3221

### Type of change


- [x] New Feature (non-breaking change which adds functionality)
This commit is contained in:
balibabu
2025-04-29 09:50:54 +08:00
committed by GitHub
parent c7310f7fb2
commit 5bb1c383ac
26 changed files with 260 additions and 187 deletions

View File

@ -1,8 +1,11 @@
import { useSetModalState } from '@/hooks/common-hooks';
import { UseRowSelectionType } from '@/hooks/logic-hooks/use-row-selection';
import { useMoveFile } from '@/hooks/use-file-request';
import { useCallback, useState } from 'react';
import { useCallback, useRef, useState } from 'react';
export const useHandleMoveFile = () => {
export const useHandleMoveFile = ({
clearRowSelection,
}: Pick<UseRowSelectionType, 'clearRowSelection'>) => {
const {
visible: moveFileVisible,
hideModal: hideMoveFileModal,
@ -10,6 +13,7 @@ export const useHandleMoveFile = () => {
} = useSetModalState();
const { moveFile, loading } = useMoveFile();
const [sourceFileIds, setSourceFileIds] = useState<string[]>([]);
const isBulkRef = useRef(false);
const onMoveFileOk = useCallback(
async (targetFolderId: string) => {
@ -19,16 +23,19 @@ export const useHandleMoveFile = () => {
});
if (ret === 0) {
// setSelectedRowKeys([]);
if (isBulkRef.current) {
clearRowSelection();
}
hideMoveFileModal();
}
return ret;
},
[moveFile, hideMoveFileModal, sourceFileIds],
[moveFile, sourceFileIds, hideMoveFileModal, clearRowSelection],
);
const handleShowMoveFileModal = useCallback(
(ids: string[]) => {
(ids: string[], isBulk = false) => {
isBulkRef.current = isBulk;
setSourceFileIds(ids);
showMoveFileModal();
},