Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: remove onboarding's feature flag #1501

Merged
merged 1 commit into from
Oct 26, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading