2023-09-13 17:43:25 +03:00
|
|
|
"use client";
|
2023-10-11 19:36:16 +03:00
|
|
|
import { useFeatureIsOn } from "@growthbook/growthbook-react";
|
2023-09-13 17:43:25 +03:00
|
|
|
import { useEffect } from "react";
|
|
|
|
|
|
|
|
import { useSupabase } from "@/lib/context/SupabaseProvider";
|
|
|
|
import { redirectToPreviousPageOrChatPage } from "@/lib/helpers/redirectToPreviousPageOrChatPage";
|
2023-06-15 12:52:46 +03:00
|
|
|
|
2023-05-23 13:45:10 +03:00
|
|
|
import Features from "./Features";
|
2023-05-18 14:37:03 +03:00
|
|
|
import Hero from "./Hero";
|
2023-10-11 19:36:16 +03:00
|
|
|
import { HomeHeader } from "./components";
|
2023-05-18 14:37:03 +03:00
|
|
|
|
2023-06-15 12:52:46 +03:00
|
|
|
const HomePage = (): JSX.Element => {
|
2023-09-13 17:43:25 +03:00
|
|
|
const { session } = useSupabase();
|
|
|
|
|
|
|
|
useEffect(() => {
|
|
|
|
if (session?.user !== undefined) {
|
|
|
|
redirectToPreviousPageOrChatPage();
|
|
|
|
}
|
|
|
|
}, [session?.user]);
|
2023-05-21 02:20:55 +03:00
|
|
|
|
2023-10-11 19:36:16 +03:00
|
|
|
const isNewHomePage = useFeatureIsOn("new-homepage-activated");
|
|
|
|
|
|
|
|
if (isNewHomePage) {
|
|
|
|
return (
|
|
|
|
<>
|
|
|
|
<div data-testid="home-page">
|
|
|
|
<div className="fixed bg-gradient-to-b from-[#6300FF] to-[#D07DF9] w-screen h-[50vh] z-[-1]"></div>
|
|
|
|
<HomeHeader />
|
|
|
|
<main>
|
|
|
|
<div className="mx-auto my-5 p-5 w-min-content bg-yellow-100 rounded-lg">
|
|
|
|
🚧 New homepage in progress 🚧
|
|
|
|
</div>
|
|
|
|
</main>
|
|
|
|
</div>
|
|
|
|
</>
|
|
|
|
);
|
|
|
|
} else {
|
|
|
|
return (
|
|
|
|
<main data-testid="home-page">
|
|
|
|
<Hero />
|
|
|
|
<Features />
|
|
|
|
</main>
|
|
|
|
);
|
|
|
|
}
|
2023-06-15 12:52:46 +03:00
|
|
|
};
|
|
|
|
|
|
|
|
export default HomePage;
|