merge global and local search

This commit is contained in:
smanylov
2026-02-09 16:44:34 +07:00
parent b6c5c59919
commit 1b57d589fb
+6 -14
View File
@@ -10,6 +10,7 @@ export function FileSearchPanel({ fileId, ref }: { fileId: string | null, ref: a
const [searchedGlobalFiles, setSearchedGlobalFiles] = useState<string[]>([]);
const [searchedGlobalFilesShowNull, setSearchedGlobalFilesShowNull] = useState<boolean>(false);
const [loading, setLoading] = useState<boolean>(false);
const [showGlobalSearch, setShowGlobalSearch] = useState<boolean>(false);
const queryClient = useQueryClient();
useImperativeHandle(ref, () => ({
@@ -18,6 +19,7 @@ export function FileSearchPanel({ fileId, ref }: { fileId: string | null, ref: a
setSearchedGlobalFiles([]);
setSearchedUserFilesShowNull(false);
setSearchedGlobalFilesShowNull(false);
setShowGlobalSearch(false);
}
}));
@@ -35,6 +37,8 @@ export function FileSearchPanel({ fileId, ref }: { fileId: string | null, ref: a
} catch (error) {
}
setShowGlobalSearch(true);
handlerSearchGlobalFile(fileId)
}, [fileId])
@@ -107,6 +111,7 @@ export function FileSearchPanel({ fileId, ref }: { fileId: string | null, ref: a
</div>
)}
{showGlobalSearch && (
<div
className="global-search-section"
>
@@ -152,20 +157,6 @@ export function FileSearchPanel({ fileId, ref }: { fileId: string | null, ref: a
</div>
</div>
<button
type="button"
className="global-search-btn"
id="global-search-btn"
disabled={loading ? true : false}
onClick={() => {
if (fileId) {
handlerSearchGlobalFile(fileId)
}
}}
>
Найти в интернете
</button>
<div className={`global-loading ${loading ? 'show' : ''}`} id="global-loading">
<div className="global-spinner"></div>
<div className="global-loading-text" id="global-loading-text">
@@ -198,6 +189,7 @@ export function FileSearchPanel({ fileId, ref }: { fileId: string | null, ref: a
</div>
</div>
</div>
)}
</>
)
}