Skip to content

Commit

Permalink
Add search list function
Browse files Browse the repository at this point in the history
  • Loading branch information
selaudin committed Oct 29, 2023
1 parent 450a39a commit 94a0d48
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 5 deletions.
3 changes: 2 additions & 1 deletion frontend/src/index.css
Expand Up @@ -224,11 +224,12 @@ table > tbody > tr > td {
padding: 1.25rem 1.5rem;
margin-bottom: 1rem;
margin-top: 0.5rem;
width: 80%;
height: fit-content;
width: 100%;
}

.docs-container {
width: 80%;
display: flex;
flex-direction: column;
align-items: center;
Expand Down
16 changes: 12 additions & 4 deletions frontend/src/pages/dashboard/dashboard.component.jsx
Expand Up @@ -31,7 +31,7 @@ export function Dashboard() {
}
})
.catch((error) => console.error('Error fetching data:', error));
}, []);
}, [id]);

const handleSubmit = (e) => {
e.preventDefault()
Expand Down Expand Up @@ -60,15 +60,23 @@ export function Dashboard() {
<form onSubmit={handleSubmit} style={{position: 'sticky'}}>
<input ref={searchRef} placeholder={"Search"} id="search-bar"/>
</form>
{docs ? (
{id ? (
<div className={'docs-container'}
style={{marginTop: '10px', padding: '20px', height: '100vh', overflowY: 'auto'}}>
{
filteredDocs.map((doc, index) => {
console.log(doc);
return (
<div className="doc" key={index}>
<WriteLikeChatGPT text={doc.conversations[0].prompt} />
<div>
{doc.conversations.map((conv) => (
<div className="doc" key={index}>
<div>Q: {conv.request}</div>
<div>A: {conv.prompt}</div>
{/* <WriteLikeChatGPT text={`A: ${conv.prompt}`} /> */}
{/* <WriteLikeChatGPT text={` A: ${conv.prompt}`}/> */}
</div>
))}
{/* <WriteLikeChatGPT text={doc.conversations[0].prompt} /> */}
</div>
);
})
Expand Down

0 comments on commit 94a0d48

Please sign in to comment.