2023-09-05 19:47:18 +03:00
|
|
|
import { ChatInput, KnowledgeToFeed } from "./components";
|
2023-09-05 11:49:29 +03:00
|
|
|
import { useActionBar } from "./hooks/useActionBar";
|
2023-09-07 11:00:45 +03:00
|
|
|
import { useKnowledgeUploader } from "./hooks/useKnowledgeUploader";
|
2023-08-11 11:06:20 +03:00
|
|
|
|
|
|
|
export const ActionsBar = (): JSX.Element => {
|
2023-09-07 11:00:45 +03:00
|
|
|
const { shouldDisplayUploadCard, setShouldDisplayUploadCard } =
|
|
|
|
useActionBar();
|
|
|
|
const { addContent, contents, feedBrain, removeContent } =
|
|
|
|
useKnowledgeUploader();
|
2023-09-05 11:49:29 +03:00
|
|
|
|
2023-08-11 11:06:20 +03:00
|
|
|
return (
|
2023-09-07 11:00:45 +03:00
|
|
|
<div
|
|
|
|
className={
|
|
|
|
shouldDisplayUploadCard ? "h-full flex flex-col flex-auto" : ""
|
|
|
|
}
|
|
|
|
>
|
|
|
|
{shouldDisplayUploadCard && (
|
2023-09-05 19:47:18 +03:00
|
|
|
<div className="flex flex-1 overflow-y-scroll shadow-md dark:shadow-primary/25 hover:shadow-xl transition-shadow rounded-xl bg-white dark:bg-black border border-black/10 dark:border-white/25 p-6">
|
2023-09-07 11:00:45 +03:00
|
|
|
<KnowledgeToFeed
|
|
|
|
onClose={() => setShouldDisplayUploadCard(false)}
|
|
|
|
contents={contents}
|
|
|
|
addContent={addContent}
|
|
|
|
removeContent={removeContent}
|
|
|
|
/>
|
2023-09-05 11:49:29 +03:00
|
|
|
</div>
|
|
|
|
)}
|
|
|
|
<div className="flex mt-1 flex-col w-full shadow-md dark:shadow-primary/25 hover:shadow-xl transition-shadow rounded-xl bg-white dark:bg-black border border-black/10 dark:border-white/25 p-6">
|
2023-09-07 11:00:45 +03:00
|
|
|
<ChatInput
|
|
|
|
shouldDisplayUploadCard={shouldDisplayUploadCard}
|
|
|
|
setShouldDisplayUploadCard={setShouldDisplayUploadCard}
|
|
|
|
feedBrain={() => void feedBrain()}
|
2023-09-07 11:15:19 +03:00
|
|
|
hasContentToFeedBrain={contents.length > 0}
|
2023-09-07 11:00:45 +03:00
|
|
|
/>
|
2023-09-05 11:49:29 +03:00
|
|
|
</div>
|
2023-08-11 11:06:20 +03:00
|
|
|
</div>
|
|
|
|
);
|
|
|
|
};
|