merge global and local search
This commit is contained in:
@@ -10,6 +10,7 @@ export function FileSearchPanel({ fileId, ref }: { fileId: string | null, ref: a
|
|||||||
const [searchedGlobalFiles, setSearchedGlobalFiles] = useState<string[]>([]);
|
const [searchedGlobalFiles, setSearchedGlobalFiles] = useState<string[]>([]);
|
||||||
const [searchedGlobalFilesShowNull, setSearchedGlobalFilesShowNull] = useState<boolean>(false);
|
const [searchedGlobalFilesShowNull, setSearchedGlobalFilesShowNull] = useState<boolean>(false);
|
||||||
const [loading, setLoading] = useState<boolean>(false);
|
const [loading, setLoading] = useState<boolean>(false);
|
||||||
|
const [showGlobalSearch, setShowGlobalSearch] = useState<boolean>(false);
|
||||||
const queryClient = useQueryClient();
|
const queryClient = useQueryClient();
|
||||||
|
|
||||||
useImperativeHandle(ref, () => ({
|
useImperativeHandle(ref, () => ({
|
||||||
@@ -18,6 +19,7 @@ export function FileSearchPanel({ fileId, ref }: { fileId: string | null, ref: a
|
|||||||
setSearchedGlobalFiles([]);
|
setSearchedGlobalFiles([]);
|
||||||
setSearchedUserFilesShowNull(false);
|
setSearchedUserFilesShowNull(false);
|
||||||
setSearchedGlobalFilesShowNull(false);
|
setSearchedGlobalFilesShowNull(false);
|
||||||
|
setShowGlobalSearch(false);
|
||||||
}
|
}
|
||||||
}));
|
}));
|
||||||
|
|
||||||
@@ -35,6 +37,8 @@ export function FileSearchPanel({ fileId, ref }: { fileId: string | null, ref: a
|
|||||||
} catch (error) {
|
} catch (error) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
setShowGlobalSearch(true);
|
||||||
|
handlerSearchGlobalFile(fileId)
|
||||||
|
|
||||||
}, [fileId])
|
}, [fileId])
|
||||||
|
|
||||||
@@ -107,6 +111,7 @@ export function FileSearchPanel({ fileId, ref }: { fileId: string | null, ref: a
|
|||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
|
{showGlobalSearch && (
|
||||||
<div
|
<div
|
||||||
className="global-search-section"
|
className="global-search-section"
|
||||||
>
|
>
|
||||||
@@ -152,20 +157,6 @@ export function FileSearchPanel({ fileId, ref }: { fileId: string | null, ref: a
|
|||||||
</div>
|
</div>
|
||||||
</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-loading ${loading ? 'show' : ''}`} id="global-loading">
|
||||||
<div className="global-spinner"></div>
|
<div className="global-spinner"></div>
|
||||||
<div className="global-loading-text" id="global-loading-text">
|
<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>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
)}
|
||||||
</>
|
</>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user