2024-01-20 07:34:30 +03:00
|
|
|
"use client";
|
|
|
|
import { usePathname } from "next/navigation";
|
|
|
|
import { useEffect } from "react";
|
|
|
|
|
|
|
|
import { QuivrLogo } from "@/lib/assets/QuivrLogo";
|
2024-02-07 03:05:07 +03:00
|
|
|
import { AddBrainModal } from "@/lib/components/AddBrainModal";
|
|
|
|
import { useBrainCreationContext } from "@/lib/components/AddBrainModal/components/AddBrainSteps/brainCreation-provider";
|
|
|
|
import PageHeader from "@/lib/components/PageHeader/PageHeader";
|
|
|
|
import { UploadDocumentModal } from "@/lib/components/UploadDocumentModal/UploadDocumentModal";
|
2024-01-20 07:34:30 +03:00
|
|
|
import { SearchBar } from "@/lib/components/ui/SearchBar/SearchBar";
|
2024-02-07 03:05:07 +03:00
|
|
|
import { useKnowledgeToFeedContext } from "@/lib/context/KnowledgeToFeedProvider/hooks/useKnowledgeToFeedContext";
|
2024-01-20 23:04:03 +03:00
|
|
|
import { useSupabase } from "@/lib/context/SupabaseProvider";
|
|
|
|
import { redirectToLogin } from "@/lib/router/redirectToLogin";
|
2024-02-07 03:05:07 +03:00
|
|
|
import { ButtonType } from "@/lib/types/QuivrButton";
|
2024-01-20 07:34:30 +03:00
|
|
|
|
|
|
|
import styles from "./page.module.scss";
|
|
|
|
|
|
|
|
const Search = (): JSX.Element => {
|
2024-01-23 04:37:45 +03:00
|
|
|
const pathname = usePathname();
|
|
|
|
const { session } = useSupabase();
|
2024-02-07 03:05:07 +03:00
|
|
|
const { setShouldDisplayFeedCard } = useKnowledgeToFeedContext();
|
|
|
|
const { setIsBrainCreationModalOpened } = useBrainCreationContext();
|
2024-01-23 04:37:45 +03:00
|
|
|
|
|
|
|
useEffect(() => {
|
|
|
|
if (session === null) {
|
|
|
|
redirectToLogin();
|
|
|
|
}
|
2024-01-31 00:34:32 +03:00
|
|
|
}, [pathname, session]);
|
2024-01-23 04:37:45 +03:00
|
|
|
|
2024-02-07 03:05:07 +03:00
|
|
|
const buttons: ButtonType[] = [
|
|
|
|
{
|
|
|
|
label: "Create brain",
|
|
|
|
color: "primary",
|
|
|
|
onClick: () => {
|
|
|
|
setIsBrainCreationModalOpened(true);
|
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
|
|
|
label: "Add knowledge",
|
|
|
|
color: "primary",
|
|
|
|
onClick: () => {
|
|
|
|
setShouldDisplayFeedCard(true);
|
|
|
|
},
|
|
|
|
},
|
|
|
|
];
|
|
|
|
|
2024-01-23 04:37:45 +03:00
|
|
|
return (
|
2024-02-07 03:05:07 +03:00
|
|
|
<div className={styles.main_container}>
|
|
|
|
<div className={styles.page_header}>
|
|
|
|
<PageHeader iconName="home" label="Home" buttons={buttons} />
|
2024-01-23 04:37:45 +03:00
|
|
|
</div>
|
2024-02-07 03:05:07 +03:00
|
|
|
<div className={styles.search_page_container}>
|
|
|
|
<div className={styles.main_wrapper}>
|
|
|
|
<div className={styles.quivr_logo_wrapper}>
|
|
|
|
<QuivrLogo size={80} color="black" />
|
|
|
|
<div className={styles.quivr_text}>
|
|
|
|
<span>Talk to </span>
|
|
|
|
<span className={styles.quivr_text_primary}>Quivr</span>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<div className={styles.search_bar_wrapper}>
|
|
|
|
<SearchBar />
|
|
|
|
</div>
|
2024-02-02 22:50:09 +03:00
|
|
|
</div>
|
2024-02-07 03:05:07 +03:00
|
|
|
<div className={styles.shortcuts_card_wrapper}>
|
|
|
|
<div className={styles.shortcut_wrapper}>
|
|
|
|
<span className={styles.shortcut}>@</span>
|
|
|
|
<span>Select a brain</span>
|
|
|
|
</div>
|
|
|
|
<div className={styles.shortcut_wrapper}>
|
|
|
|
<span className={styles.shortcut}>#</span>
|
|
|
|
<span>Select a prompt</span>
|
|
|
|
</div>
|
2024-02-02 22:50:09 +03:00
|
|
|
</div>
|
|
|
|
</div>
|
2024-02-07 03:05:07 +03:00
|
|
|
<UploadDocumentModal />
|
|
|
|
<AddBrainModal />
|
2024-01-23 04:37:45 +03:00
|
|
|
</div>
|
|
|
|
);
|
2024-01-20 07:34:30 +03:00
|
|
|
};
|
|
|
|
|
|
|
|
export default Search;
|