mirror of
https://github.com/infinilabs/coco-app.git
synced 2025-12-16 11:37:47 +01:00
refactor: refactoring Coco App (#112)
* feat: impl Coco server related APIs * chore: remove unused method * fix: invoke Rust interfaces in tauri::run() * chore: add invoke * feat: add add_coco_server * fix: trim the tailing forward slash * feat: interface get_user_profiles * chore: add * fix: store the servers in add interface * chore: ass * fix: skip non-publich servers with no token * feat: add * feat: get datasources and connectors * fix: invoke interfaces in tauri::run() * chore: add SidebarRef * refactor: refactoring coco-app * refactor: refactoring coco app * refactor: refactoring project layout * refactor: refactoring server management * chore: cleanup code * chore: display error when connect failed * refactor: refactoring refresh server's info * refactor: refactoring how to connect the coco serverg * chore: rename to cloud * refactor: refactoring remove coco server * fix: refresh current selected server * fix: reset server selection * chore: update login status * feat: add error message tips * fix: fix login and logout * refactor: refactoring http client * fix: fix the datasources * chore: minor fix * refactor: refactoring code * fix: fix search api * chore: optimize part of icons * chore: fix build * refactor: search list icon * refactor: search list icon * chore: lib * feat: add plugin-os --------- Co-authored-by: rain <15911122312@163.com> Co-authored-by: medcl <m@medcl.net>
This commit is contained in:
39
src/components/Search/SearchResults.tsx
Normal file
39
src/components/Search/SearchResults.tsx
Normal file
@@ -0,0 +1,39 @@
|
||||
import { useState } from "react";
|
||||
|
||||
import { DocumentList } from "./DocumentList";
|
||||
import { DocumentDetail } from "./DocumentDetail";
|
||||
|
||||
interface SearchResultsProps {
|
||||
input: string;
|
||||
isChatMode: boolean;
|
||||
}
|
||||
|
||||
export function SearchResults({ input, isChatMode }: SearchResultsProps) {
|
||||
const [selectedDocumentId, setSelectedDocumentId] = useState("1");
|
||||
|
||||
const [detailData, setDetailData] = useState<any>({});
|
||||
|
||||
function getDocDetail(detail: any) {
|
||||
setDetailData(detail)
|
||||
}
|
||||
|
||||
return (
|
||||
<div className="h-[458px] w-full p-2 pr-0 flex flex-col rounded-xl focus:outline-none">
|
||||
<div className="h-full flex">
|
||||
{/* Left Panel */}
|
||||
<DocumentList
|
||||
onSelectDocument={setSelectedDocumentId}
|
||||
selectedId={selectedDocumentId}
|
||||
input={input}
|
||||
getDocDetail={getDocDetail}
|
||||
isChatMode={isChatMode}
|
||||
/>
|
||||
|
||||
{/* Right Panel */}
|
||||
<div className="flex-1 overflow-y-auto custom-scrollbar">
|
||||
<DocumentDetail document={detailData} />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user