fix(frontend): upgrade to plus button (#2324)

# Description

Please include a summary of the changes and the related issue. Please
also include relevant motivation and context.

## Checklist before requesting a review

Please delete options that are not relevant.

- [ ] My code follows the style guidelines of this project
- [ ] I have performed a self-review of my code
- [ ] I have commented hard-to-understand areas
- [ ] I have ideally added tests that prove my fix is effective or that
my feature works
- [ ] New and existing unit tests pass locally with my changes
- [ ] Any dependent changes have been merged

## Screenshots (if appropriate):
This commit is contained in:
Antoine Dewez 2024-03-08 16:31:12 -08:00 committed by GitHub
parent 96f1308d9b
commit 276dcd20e1
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 6 additions and 50 deletions

View File

@ -4,7 +4,6 @@ import { Outfit } from "next/font/google";
import { cookies, headers } from "next/headers";
import { ToastProvider } from "@/lib/components/ui/Toast";
import { FeatureFlagsProvider } from "@/lib/context";
import { SupabaseProvider } from "@/lib/context/SupabaseProvider";
import { App } from "./App";
@ -37,14 +36,12 @@ const RootLayout = async ({
<body
className={`bg-white text-black h-screen flex flex-col dark:bg-black dark:text-white w-full ${inter.className}`}
>
<FeatureFlagsProvider>
<ToastProvider>
<SupabaseProvider session={session}>
<App>{children}</App>
</SupabaseProvider>
</ToastProvider>
<VercelAnalytics />
</FeatureFlagsProvider>
<ToastProvider>
<SupabaseProvider session={session}>
<App>{children}</App>
</SupabaseProvider>
</ToastProvider>
<VercelAnalytics />
</body>
</html>
);

View File

@ -1,38 +0,0 @@
"use client"
import type { FeatureDefinition } from "@growthbook/growthbook";
import { GrowthBook, GrowthBookProvider } from "@growthbook/growthbook-react";
import axios from "axios";
import { useAsync } from "react-use";
const growthBook = new GrowthBook({
apiHost: "https://cdn.growthbook.io",
clientKey:process.env.NEXT_PUBLIC_GROWTHBOOK_CLIENT_KEY,
enableDevMode: true,
});
const unauthenticatedClient = axios.create();
export const FeatureFlagsProvider = ({
children,
}: {
children?: React.ReactNode;
}): JSX.Element => {
const growthBookUrl = process.env.NEXT_PUBLIC_GROWTHBOOK_URL;
useAsync(async () => {
if (growthBookUrl !== undefined) {
const growthBookInitResponse = await unauthenticatedClient.get<{
features: Record<string, FeatureDefinition>;
}>(growthBookUrl);
growthBook.setFeatures(growthBookInitResponse.data.features);
}
});
return (
<GrowthBookProvider growthbook={growthBook}>{children}</GrowthBookProvider>
);
};

View File

@ -1,2 +0,0 @@
export { FeatureFlagsProvider } from './FeatureFlagsProvider';

View File

@ -1,4 +1,3 @@
export * from "./BrainProvider";
export * from "./ChatProvider";
export * from "./FeatureFlagProvider";
export * from "./KnowledgeToFeedProvider";