feat: remove feature flags for homepage (#1493)

This commit is contained in:
Matthieu Jacq 2023-10-26 09:05:21 +02:00 committed by GitHub
parent d311a53b6f
commit c3acb2901c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
13 changed files with 50 additions and 304 deletions

View File

@ -1,76 +0,0 @@
"use client";
import { ReactNode } from "react";
import { useTranslation } from "react-i18next";
import {
GiArtificialIntelligence,
GiBrain,
GiDatabase,
GiFastArrow,
GiLockedDoor,
GiOpenBook,
} from "react-icons/gi";
import Card from "@/lib/components/ui/Card";
const Features = (): JSX.Element => {
const { t } = useTranslation();
return (
<section className="my-20 text-center flex flex-col items-center justify-center gap-10">
<div>
<h1 className="text-5xl font-bold ">{t("features")}</h1>
{/* <h2 className="opacity-50">Change the way you take notes</h2> */}
</div>
<div className="flex flex-wrap gap-5 justify-center">
<Feature
icon={<GiBrain className="text-7xl w-full" />}
title={t("two_brains_title")}
desc={t("two_brains_desc")}
/>
<Feature
icon={<GiDatabase className="text-7xl w-full" />}
title={t("any_kind_of_data_title")}
desc={t("any_kind_of_data_desc")}
/>
<Feature
icon={<GiArtificialIntelligence className="text-7xl w-full" />}
title={t("fast_and_accurate_title")}
desc={t("fast_and_accurate_desc")}
/>
<Feature
icon={<GiFastArrow className="text-7xl w-full" />}
title={t("fast_and_efficient_title")}
desc={t("fast_and_efficient_desc")}
/>
<Feature
icon={<GiLockedDoor className="text-7xl w-full" />}
title={t("secure_title")}
desc={t("secure_desc")}
/>
<Feature
icon={<GiOpenBook className="text-7xl w-full" />}
title={t("open_source_title")}
desc={t("open_source_desc")}
/>
</div>
</section>
);
};
interface FeatureProps {
icon?: ReactNode;
title: string;
desc: string;
}
const Feature = ({ title, desc, icon }: FeatureProps): JSX.Element => {
return (
<Card className="p-10 max-w-xs flex flex-col gap-5 w-full">
{icon}
<h1 className="text-xl font-bold">{title}</h1>
<p>{desc}</p>
</Card>
);
};
export default Features;

View File

@ -1,72 +0,0 @@
"use client";
import { motion, useScroll, useSpring, useTransform } from "framer-motion";
import Link from "next/link";
import { useRef } from "react";
import { useTranslation } from "react-i18next";
import { MdNorthEast } from "react-icons/md";
import Button from "@/lib/components/ui/Button";
const Hero = (): JSX.Element => {
const { t } = useTranslation();
const targetRef = useRef<HTMLDivElement | null>(null);
const { scrollYProgress } = useScroll({
target: targetRef,
offset: ["start start", "end start"],
});
const scaleSync = useTransform(scrollYProgress, [0, 0.5], [1, 0.9]);
const scale = useSpring(scaleSync, { mass: 0.1, stiffness: 100 });
const position = useTransform(scrollYProgress, (pos) => {
if (pos === 1) {
return "relative";
}
return "sticky";
});
const videoScaleSync = useTransform(scrollYProgress, [0, 0.5], [0.9, 1]);
const videoScale = useSpring(videoScaleSync, { mass: 0.1, stiffness: 100 });
const opacitySync = useTransform(scrollYProgress, [0, 0.5], [1, 0]);
const opacity = useSpring(opacitySync, { mass: 0.1, stiffness: 200 });
return (
<section
ref={targetRef}
className="relative w-full flex flex-col gap-24 items-center text-center min-h-[768px] py-12"
>
<motion.div
style={{ scale, opacity, position }}
className="top-24 -z-0 flex flex-col gap-2 items-center justify-center pt-24"
>
<h1 className="text-5xl sm:text-7xl font-bold max-w-lg sm:max-w-xl">
{t("title.short")} <span className="text-primary">Quivr</span>
</h1>
<p className="text-base max-w-sm text-gray-500 mb-5 sm:mb-10">
{t("description")}
</p>
<Link href={"/login"}>
<Button>{t("getStarted")}</Button>
</Link>
<Link target="_blank" href={"https://github.com/StanGirard/quivr/"}>
<Button variant={"tertiary"}>
Github <MdNorthEast />
</Button>
</Link>
</motion.div>
<motion.video
style={{ scale: videoScale }}
className="rounded-md max-w-screen-lg shadow-lg dark:shadow-white/25 border dark:border-white/25 w-full bg-white dark:bg-black"
src="https://user-images.githubusercontent.com/19614572/239713902-a6463b73-76c7-4bc0-978d-70562dca71f5.mp4"
autoPlay
muted
loop
/>
</section>
);
};
export default Hero;

View File

@ -1,9 +1,11 @@
import { QueryClient, QueryClientProvider } from "@tanstack/react-query";
import { render, screen } from "@testing-library/react";
import { describe, expect, it, vi } from "vitest";
import { getProcessEnvManager } from "@/lib/helpers/getProcessEnvManager";
import HomePage from "../page";
const queryClient = new QueryClient();
const mockUseSupabase = vi.fn(() => ({
session: {
@ -17,6 +19,9 @@ vi.mock("@/lib/context/SupabaseProvider", () => ({
vi.mock("next/navigation", () => ({
redirect: (url: string) => url,
useRouter: () => ({
push: (url: string) => url,
}),
}));
describe("HomePage", () => {
@ -27,7 +32,11 @@ describe("HomePage", () => {
NEXT_PUBLIC_ENV: "not-local",
});
render(<HomePage />);
render(
<QueryClientProvider client={queryClient}>
<HomePage />
</QueryClientProvider>
);
const homePage = screen.getByTestId("home-page");
expect(homePage).toBeDefined();

View File

@ -1,12 +1,9 @@
"use client";
import { useFeatureIsOn } from "@growthbook/growthbook-react";
import { useEffect } from "react";
import { useSupabase } from "@/lib/context/SupabaseProvider";
import { redirectToPreviousPageOrChatPage } from "@/lib/helpers/redirectToPreviousPageOrChatPage";
import Features from "./Features";
import Hero from "./Hero";
import {
DemoSection,
FooterSection,
@ -28,61 +25,49 @@ const HomePage = (): JSX.Element => {
}
}, [session?.user]);
const isNewHomePage = useFeatureIsOn("new-homepage-activated");
return (
<>
<HomeHeaderBackground />
<HomeHeader />
if (isNewHomePage) {
return (
<>
<HomeHeaderBackground />
<HomeHeader />
<main
className="relative flex flex-col items-center"
data-testid="home-page"
>
<HomeSection bg="transparent">
<IntroSection />
</HomeSection>
<main className="relative flex flex-col items-center">
<HomeSection bg="transparent">
<IntroSection />
</HomeSection>
<HomeSection bg="bg-[#FCFAF6]" slantAfter="down" hiddenOnMobile={true}>
<DemoSection />
</HomeSection>
<HomeSection
bg="bg-[#FCFAF6]"
slantAfter="down"
hiddenOnMobile={true}
>
<DemoSection />
</HomeSection>
<HomeSection
bg="bg-[#362469]"
slantCurrent="down"
gradient="bg-gradient-to-t bg-gradient-to-t from-white to-[#362469]"
>
<UseCases />
<div />
</HomeSection>
<HomeSection
bg="bg-[#362469]"
slantCurrent="down"
gradient="bg-gradient-to-t bg-gradient-to-t from-white to-[#362469]"
>
<UseCases />
<div />
</HomeSection>
<HomeSection bg="bg-white" slantBefore="down" slantAfter="up">
<SecuritySection />
</HomeSection>
<HomeSection bg="bg-white" slantBefore="down" slantAfter="up">
<SecuritySection />
</HomeSection>
<HomeSection bg="bg-[#FCFAF6]" slantCurrent="up">
<TestimonialsSection />
</HomeSection>
<HomeSection bg="bg-[#FCFAF6]" slantCurrent="up">
<TestimonialsSection />
</HomeSection>
<HomeSection
bg="bg-gradient-to-b from-[#D07DF9] to-[#7A27FD]"
slantBefore="up"
>
<FooterSection />
</HomeSection>
</main>
</>
);
} else {
return (
<main data-testid="home-page">
<Hero />
<Features />
<HomeSection
bg="bg-gradient-to-b from-[#D07DF9] to-[#7A27FD]"
slantBefore="up"
>
<FooterSection />
</HomeSection>
</main>
);
}
</>
);
};
export default HomePage;

View File

@ -1,6 +1,4 @@
"use client";
import { useFeatureIsOn } from "@growthbook/growthbook-react";
import { redirect } from "next/navigation";
import { useTranslation } from "react-i18next";
import Card from "@/lib/components/ui/Card";
@ -14,11 +12,7 @@ import {
} from "../(home)/components";
const ContactSalesPage = (): JSX.Element => {
const isNewHomePage = useFeatureIsOn("new-homepage-activated");
const { t } = useTranslation("contact");
if (!isNewHomePage) {
redirect("/");
}
return (
<div className="bg-[#FCFAF6]">

View File

@ -1,5 +1,4 @@
"use client";
import { useFeatureIsOn } from "@growthbook/growthbook-react";
import { usePathname } from "next/navigation";
import { DISCORD_URL, GITHUB_URL, TWITTER_URL } from "@/lib/config/CONSTANTS";
@ -9,11 +8,10 @@ const Footer = (): JSX.Element => {
const { session } = useSupabase();
const path = usePathname();
const isNewHomePageActivated = useFeatureIsOn("new-homepage-activated");
const isNewHomePage = path === "/" && isNewHomePageActivated;
const isHomePage = path === "/";
const isContactPage = path === "/contact";
if (session?.user !== undefined || isNewHomePage || isContactPage) {
if (session?.user !== undefined || isHomePage || isContactPage) {
return <></>;
}

View File

@ -1,6 +1,5 @@
"use client";
import { useFeatureIsOn } from "@growthbook/growthbook-react";
import { usePathname } from "next/navigation";
import { Header } from "./components/Header";
@ -15,11 +14,10 @@ export const NavBar = (): JSX.Element => {
path.startsWith("/chat") ||
path.startsWith("/brains-management");
const isNewHomePageActivated = useFeatureIsOn("new-homepage-activated");
const isNewHomePage = path === "/" && isNewHomePageActivated;
const isHomePage = path === "/";
const isContactPage = path === "/contact";
if (pageHasSidebar || isNewHomePage || isContactPage) {
if (pageHasSidebar || isHomePage || isContactPage) {
return <></>;
}

View File

@ -1,22 +1,7 @@
{
"lang": "en-US",
"title": "Quivr - Get a Second Brain with Generative AI",
"title.short": "Get a Second Brain with",
"description": "Quivr is your second brain in the cloud, designed to easily store and retrieve unstructured information.",
"getStarted": "Get Started",
"features": "Features",
"two_brains_title": "Two brains are better than one",
"two_brains_desc": "Quivr is your second brain in the cloud, designed to easily store and retrieve unstructured information.",
"any_kind_of_data_title": "Store any kind of data",
"any_kind_of_data_desc": "Quivr can handle almost any type of data you throw at it. Text, images, code snippets, we've got you covered.",
"fast_and_accurate_title": "Get a Fast and Consistent Brain",
"fast_and_accurate_desc": "Quivr is your second brain in the cloud, designed to easily store and retrieve unstructured information.",
"fast_and_efficient_title": "Fast and Efficient",
"fast_and_efficient_desc": "Designed with speed and efficiency at its core. Quivr ensures rapid access to your data.",
"secure_title": "Secure",
"secure_desc": "Your data, your control. Always.",
"open_source_title": "Open source",
"open_source_desc": "Freedom is beautiful, so is Quivr. Open source and free to use.",
"toastDismiss": "dismiss",
"email": "Email",
"password": "Password",

View File

@ -1,6 +1,4 @@
{
"any_kind_of_data_desc": "Quivr puede gestionar casi cualquier tipo de dato que le brindes. Texto, imagen, fragmentos de código, te tenemos cubierto.",
"any_kind_of_data_title": "Almacena cualquier tipo de dato",
"Chat": "Conversar",
"chatButton": "Conversar",
"comingSoon": "Próximamente",
@ -12,33 +10,20 @@
"Editor": "Editor",
"email": "Correo electrónico",
"Explore": "Explorar",
"fast_and_accurate_desc": "Quivr es tu segundo cerebro en la nube, diseñado para almacenar y obtener información inestructurada.",
"fast_and_accurate_title": "Obtén un Cerebro rápido y consistente",
"fast_and_efficient_desc": "Diseñado con velocidad y eficiciencia como base. Quivr asegura rápido acceso a tus datos.",
"fast_and_efficient_title": "Rápido y eficiente",
"features": "Características",
"getStarted": "Empezar a usar",
"lang": "es-ES",
"loading": "Cargando...",
"loginButton": "Iniciar sesión",
"logoutButton": "Cerrar sesión",
"newChatButton": "Nueva conversación",
"open_source_desc": "La libertad es hermosa, al igual que Quivr. Código abierto y de uso gratuito.",
"open_source_title": "Open source",
"or": "o",
"and": "y",
"Owner": "Propietario",
"password": "Contraseña",
"resetButton": "Restaurar",
"secure_desc": "Tú controlas tus datos. Siempre.",
"secure_title": "Seguro",
"shareButton": "Compartir",
"signUpButton": "Registrarse",
"title": "Quivr - Tu segundo cerebro con IA generativa",
"title.short": "Obtén un Segundo Cerebro con",
"toastDismiss": "cerrar",
"two_brains_desc": "Quivr es tu segundo cerebro en la nube, diseñado para almacenar y obtener información inestructurada.",
"two_brains_title": "Dos cerebros son mejores que uno",
"updateButton": "Actualizar",
"Upload": "Subir",
"uploadButton": "Subir",

View File

@ -1,22 +1,7 @@
{
"lang": "fr-FR",
"title": "Quivr - Obtenez un deuxième cerveau avec l'IA générative",
"title.short": "Obtenez un deuxième cerveau avec",
"description": "Quivr est votre deuxième cerveau dans le nuage, conçu pour stocker et récupérer facilement des informations non structurées.",
"getStarted": "Commencer",
"features": "Fonctionnalités",
"two_brains_title": "Deux cerveaux valent mieux qu'un",
"two_brains_desc": "Quivr est votre deuxième cerveau dans le nuage, conçu pour stocker et récupérer facilement des informations non structurées.",
"any_kind_of_data_title": "Stockez n'importe quel type de données",
"any_kind_of_data_desc": "Quivr peut gérer presque n'importe quel type de données que vous lui donnez. Texte, images, extraits de code, nous avons ce qu'il vous faut.",
"fast_and_accurate_title": "Obtenez un cerveau rapide et cohérent",
"fast_and_accurate_desc": "Quivr est votre deuxième cerveau dans le nuage, conçu pour stocker et récupérer facilement des informations non structurées.",
"fast_and_efficient_title": "Rapide et efficace",
"fast_and_efficient_desc": "Conçu avec la rapidité et l'efficacité à son cœur. Quivr assure un accès rapide à vos données.",
"secure_title": "Sécurisé",
"secure_desc": "Vos données, votre contrôle. Toujours.",
"open_source_title": "Open source",
"open_source_desc": "La liberté est belle, tout comme Quivr. Open source et gratuit à utiliser.",
"toastDismiss": "ignorer",
"email": "Email",
"password": "Mot de passe",

View File

@ -1,22 +1,7 @@
{
"lang": "pt-BR",
"title": "Quivr - Tenha um Segundo Cérebro com IA Generativa",
"title.short": "Tenha um Segundo Cérebro com",
"description": "Quivr é o seu segundo cérebro na nuvem, projetado para armazenar e recuperar facilmente informações não estruturadas.",
"getStarted": "Começar",
"features": "Recursos",
"two_brains_title": "Dois cérebros são melhores que um",
"two_brains_desc": "Quivr é o seu segundo cérebro na nuvem, projetado para armazenar e recuperar facilmente informações não estruturadas.",
"any_kind_of_data_title": "Armazene qualquer tipo de dado",
"any_kind_of_data_desc": "Quivr pode lidar com quase qualquer tipo de dado que você jogar nele. Texto, imagens, trechos de código, estamos aqui para ajudar.",
"fast_and_accurate_title": "Tenha um Cérebro Rápido e Consistente",
"fast_and_accurate_desc": "Quivr é o seu segundo cérebro na nuvem, projetado para armazenar e recuperar facilmente informações não estruturadas.",
"fast_and_efficient_title": "Rápido e Eficiente",
"fast_and_efficient_desc": "Projetado com velocidade e eficiência em seu núcleo. Quivr garante acesso rápido aos seus dados.",
"secure_title": "Seguro",
"secure_desc": "Seus dados, seu controle. Sempre.",
"open_source_title": "Código aberto",
"open_source_desc": "A liberdade é bela, assim como o Quivr. Código aberto e gratuito para usar.",
"toastDismiss": "fechar",
"email": "Email",
"password": "Senha",

View File

@ -1,22 +1,7 @@
{
"lang": "ru-RU",
"title": "Quivr - Второй мозг с генеративным ИИ",
"title.short": "Второй мозг с",
"description": "Quivr - это ваш второй мозг в облаке, предназначенный для легкого хранения и извлечения неструктурированной информации.",
"getStarted": "Начать",
"features": "Особенности",
"two_brains_title": "Два мозга лучше одного",
"two_brains_desc": "Quivr - это ваш второй мозг в облаке, предназначенный для легкого хранения и извлечения неструктурированной информации.",
"any_kind_of_data_title": "Храните любые данные",
"any_kind_of_data_desc": "Quivr может обрабатывать практически любой тип данных, с которым вы работаете. Текст, изображения, фрагменты кода - мы позаботились о вас.",
"fast_and_accurate_title": "Получите быстрый и последовательный мозг",
"fast_and_accurate_desc": "Quivr - это ваш второй мозг в облаке, предназначенный для легкого хранения и извлечения неструктурированной информации.",
"fast_and_efficient_title": "Быстро и эффективно",
"fast_and_efficient_desc": "Создан для скорости и эффективности. Quivr обеспечивает быстрый доступ к вашим данным.",
"secure_title": "Безопасность",
"secure_desc": "Ваши данные - ваши контроль. Всегда.",
"open_source_title": "Открытый исходный код",
"open_source_desc": "Свобода красива, так же как и Quivr. Открытый и бесплатный для использования.",
"toastDismiss": "закрыть",
"email": "Email",
"password": "Пароль",

View File

@ -1,22 +1,7 @@
{
"lang": "zh-CN",
"title": "Quivr - 通过人工智能获得第二个大脑",
"title.short": "获得第二个大脑",
"description": "Quivr 是您在云中的第二个大脑,让您轻松存储和检索非结构化信息。",
"getStarted": "开始使用",
"features": "功能",
"two_brains_title": "两个脑袋总比一个好",
"two_brains_desc": "Quivr 是您在云中的第二个大脑,让您轻松存储和检索非结构化信息。",
"any_kind_of_data_title": "存储任何类型的数据",
"any_kind_of_data_desc": "Quivr几乎可以处理任何类型的数据。文本、图像、代码片段我们会帮你处理的。",
"fast_and_accurate_title": "获得一个快速而稳定的大脑",
"fast_and_accurate_desc": "Quivr 是您在云中的第二个大脑,让您轻松存储和检索非结构化信息。",
"fast_and_efficient_title": "快速高效",
"fast_and_efficient_desc": "以速度和效率为核心设计。Quivr确保快速访问您的数据。",
"secure_title": "安全",
"secure_desc": "您的数据,由您掌控。始终如此。",
"open_source_title": "开源",
"open_source_desc": "自由是美好的Quivr 也是如此。开放源代码,免费使用。",
"toastDismiss": "dismiss",
"email": "Email",
"password": "密码",