2025-01-21 19:37:15 +08:00
|
|
|
import { useState } from "react";
|
2025-02-06 11:45:37 +08:00
|
|
|
|
2024-10-28 17:34:48 +08:00
|
|
|
import { DocumentList } from "./DocumentList";
|
|
|
|
|
import { DocumentDetail } from "./DocumentDetail";
|
|
|
|
|
|
2025-01-21 19:37:15 +08:00
|
|
|
interface SearchResultsProps {
|
|
|
|
|
input: string;
|
|
|
|
|
isChatMode: boolean;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export function SearchResults({ input, isChatMode }: SearchResultsProps) {
|
2024-10-30 20:57:03 +08:00
|
|
|
const [selectedDocumentId, setSelectedDocumentId] = useState("1");
|
2024-10-28 17:34:48 +08:00
|
|
|
|
2025-01-21 19:37:15 +08:00
|
|
|
const [detailData, setDetailData] = useState<any>({});
|
|
|
|
|
|
|
|
|
|
function getDocDetail(detail: any) {
|
|
|
|
|
setDetailData(detail)
|
|
|
|
|
}
|
|
|
|
|
|
2024-10-28 17:34:48 +08:00
|
|
|
return (
|
2025-01-21 19:37:15 +08:00
|
|
|
<div className="h-[458px] w-full p-2 pr-0 flex flex-col rounded-xl focus:outline-none">
|
|
|
|
|
<div className="h-full flex">
|
2024-10-28 17:34:48 +08:00
|
|
|
{/* Left Panel */}
|
2025-01-21 19:37:15 +08:00
|
|
|
<DocumentList
|
2025-02-06 11:45:37 +08:00
|
|
|
onSelectDocument={setSelectedDocumentId}
|
|
|
|
|
selectedId={selectedDocumentId}
|
|
|
|
|
input={input}
|
|
|
|
|
getDocDetail={getDocDetail}
|
|
|
|
|
isChatMode={isChatMode}
|
|
|
|
|
/>
|
2024-10-28 17:34:48 +08:00
|
|
|
|
|
|
|
|
{/* Right Panel */}
|
2024-10-30 20:57:03 +08:00
|
|
|
<div className="flex-1 overflow-y-auto custom-scrollbar">
|
2025-02-06 11:45:37 +08:00
|
|
|
<DocumentDetail document={detailData} />
|
2024-10-28 17:34:48 +08:00
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
);
|
2025-01-21 19:37:15 +08:00
|
|
|
}
|