Skip to content

Commit

Permalink
feat: remove onboarding's feature flag (#1501)
Browse files Browse the repository at this point in the history
# Description

US: #1490
  • Loading branch information
matthieujacq authored Oct 26, 2023
1 parent c735298 commit 202daac
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 23 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
"use client";
import { useFeatureIsOn } from "@growthbook/growthbook-react";
import { useTranslation } from "react-i18next";
import { PiPaperclipFill } from "react-icons/pi";

Expand All @@ -23,11 +22,10 @@ export const ChatInput = ({
const { t } = useTranslation(["chat"]);

const { setShouldDisplayFeedCard } = useKnowledgeToFeedContext();
const shouldDisplayOnboarding = useFeatureIsOn("onboarding");

return (
<>
{shouldDisplayOnboarding && <OnboardingQuestions />}
{<OnboardingQuestions />}
<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-2">
<form
data-testid="chat-input-form"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { useFeatureIsOn } from "@growthbook/growthbook-react";

import { useChatContext } from "@/lib/context";
import { useOnboarding } from "@/lib/hooks/useOnboarding";

import { ChatDialogue } from "./components/ChatDialogue";
import { ShortCuts } from "./components/ShortCuts";
Expand All @@ -13,10 +12,9 @@ export const ChatDialogueArea = (): JSX.Element => {
messages,
notifications
);
const shouldDisplayOnboarding = useFeatureIsOn("onboarding");
const { isOnboarding } = useOnboarding();

const shouldDisplayShortcuts =
chatItems.length === 0 && !shouldDisplayOnboarding;
const shouldDisplayShortcuts = chatItems.length === 0 && !isOnboarding;

if (!shouldDisplayShortcuts) {
return <ChatDialogue chatItems={chatItems} />;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
import { useFeatureIsOn } from "@growthbook/growthbook-react";
import Link from "next/link";
import { Fragment } from "react";
import { useTranslation } from "react-i18next";
import { RiDownloadLine } from "react-icons/ri";

Expand All @@ -19,8 +17,6 @@ export const Onboarding = (): JSX.Element => {
const step2 = t("onboarding.step_2");
const step3 = t("onboarding.step_3");

const shouldStepBeDisplayed = useFeatureIsOn("onboarding");

const { trackOnboardingEvent } = useOnboardingTracker();

const { streamingText: titleStream, isDone: isTitleDisplayed } =
Expand Down Expand Up @@ -49,10 +45,6 @@ export const Onboarding = (): JSX.Element => {
enabled: isStep2Done,
});

if (!shouldStepBeDisplayed) {
return <Fragment />;
}

return (
<div className="flex flex-col gap-2 mb-3">
<MessageRow speaker={"assistant"} brainName={"Quivr"}>
Expand Down
9 changes: 2 additions & 7 deletions frontend/lib/hooks/useOnboarding.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import { useFeatureIsOn } from "@growthbook/growthbook-react";
import { useQuery, useQueryClient } from "@tanstack/react-query";
import { useParams } from "next/navigation";

Expand All @@ -9,7 +8,6 @@ import { Onboarding } from "../types/Onboarding";

// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types
export const useOnboarding = () => {
const isOnboardingFeatureActivated = useFeatureIsOn("onboarding");
const { getOnboarding } = useOnboardingApi();
const params = useParams();
const { updateOnboarding } = useOnboardingApi();
Expand Down Expand Up @@ -38,13 +36,10 @@ export const useOnboarding = () => {
await queryClient.invalidateQueries({ queryKey: [ONBOARDING_DATA_KEY] });
};

const shouldDisplayWelcomeChat =
isOnboardingFeatureActivated && onboarding.onboarding_a;
const shouldDisplayWelcomeChat = onboarding.onboarding_a;

const shouldDisplayOnboardingAInstructions =
isOnboardingFeatureActivated &&
chatId === undefined &&
shouldDisplayWelcomeChat;
chatId === undefined && shouldDisplayWelcomeChat;

return {
onboarding,
Expand Down

0 comments on commit 202daac

Please sign in to comment.