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";
|
|
|
|
import { SearchBar } from "@/lib/components/ui/SearchBar/SearchBar";
|
|
|
|
import { useMenuContext } from "@/lib/context/MenuProvider/hooks/useMenuContext";
|
2024-01-20 23:04:03 +03:00
|
|
|
import { useSupabase } from "@/lib/context/SupabaseProvider";
|
|
|
|
import { redirectToLogin } from "@/lib/router/redirectToLogin";
|
2024-01-20 07:34:30 +03:00
|
|
|
|
2024-01-20 23:04:03 +03:00
|
|
|
import { useChatsList } from "../chat/[chatId]/hooks/useChatsList";
|
|
|
|
// eslint-disable-next-line import/order
|
2024-01-20 07:34:30 +03:00
|
|
|
import styles from "./page.module.scss";
|
|
|
|
|
2024-01-20 23:04:03 +03:00
|
|
|
|
2024-01-20 07:34:30 +03:00
|
|
|
const Search = (): JSX.Element => {
|
|
|
|
const {setIsOpened} = useMenuContext();
|
|
|
|
const pathname = usePathname()
|
2024-01-20 23:04:03 +03:00
|
|
|
const { session } = useSupabase();
|
2024-01-20 07:34:30 +03:00
|
|
|
|
|
|
|
useEffect(() => {
|
2024-01-20 23:04:03 +03:00
|
|
|
if (session === null) {
|
|
|
|
redirectToLogin();
|
|
|
|
}
|
|
|
|
setIsOpened(false)
|
|
|
|
}, [pathname, session, setIsOpened]);
|
|
|
|
|
|
|
|
useChatsList();
|
2024-01-20 07:34:30 +03:00
|
|
|
|
|
|
|
return (
|
|
|
|
<div className={styles.search_page_container}>
|
|
|
|
<div className={styles.main_container}>
|
|
|
|
<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>
|
|
|
|
<SearchBar />
|
|
|
|
</div>
|
|
|
|
</div >
|
|
|
|
);
|
|
|
|
};
|
|
|
|
|
|
|
|
export default Search;
|