add: feature flag

This commit is contained in:
Karrix 2024-01-21 19:49:26 +08:00
parent ac8f6e2808
commit 0ba1a6d1f0

View File

@ -22,6 +22,7 @@ import {
} from "@clerk/nextjs"; } from "@clerk/nextjs";
import { Github, Menu } from "lucide-react"; import { Github, Menu } from "lucide-react";
import meta from "next-gen/config"; import meta from "next-gen/config";
import { useFeatureFlagEnabled } from "posthog-js/react";
import { useEffect, useState } from "react"; import { useEffect, useState } from "react";
import { useMediaQuery } from "usehooks-ts"; import { useMediaQuery } from "usehooks-ts";
@ -29,9 +30,13 @@ export function Navbar() {
const { organization } = useOrganization(); const { organization } = useOrganization();
const _isDesktop = useMediaQuery("(min-width: 1024px)"); const _isDesktop = useMediaQuery("(min-width: 1024px)");
const [isDesktop, setIsDesktop] = useState(true); const [isDesktop, setIsDesktop] = useState(true);
const pricingPlanFlagEnable = useFeatureFlagEnabled("pricing-plan");
useEffect(() => { useEffect(() => {
setIsDesktop(_isDesktop); setIsDesktop(_isDesktop);
}, [_isDesktop]); }, [_isDesktop]);
return ( return (
<> <>
<div className="flex flex-row items-center gap-4"> <div className="flex flex-row items-center gap-4">
@ -85,13 +90,15 @@ export function Navbar() {
</div> </div>
<div className="flex flex-row items-center gap-2"> <div className="flex flex-row items-center gap-2">
{isDesktop && <NavbarMenu />} {isDesktop && <NavbarMenu />}
<Button {pricingPlanFlagEnable && (
asChild <Button
variant="link" asChild
className="rounded-full aspect-square p-2 mr-4" variant="link"
> className="rounded-full aspect-square p-2 mr-4"
<a href="/pricing">Pricing</a> >
</Button> <a href="/pricing">Pricing</a>
</Button>
)}
<Button <Button
asChild asChild
variant="link" variant="link"
@ -105,7 +112,11 @@ export function Navbar() {
variant="outline" variant="outline"
className="rounded-full aspect-square p-2" className="rounded-full aspect-square p-2"
> >
<a target="_blank" href="https://github.com/BennyKok/comfyui-deploy" rel="noreferrer"> <a
target="_blank"
href="https://github.com/BennyKok/comfyui-deploy"
rel="noreferrer"
>
<Github /> <Github />
</a> </a>
</Button> </Button>