feat: feature flags

This commit is contained in:
David Nguyen
2023-08-18 20:05:14 +10:00
parent e0cb4314fb
commit f60cb22f11
23 changed files with 661 additions and 36 deletions

View File

@ -7,15 +7,20 @@ import { usePathname } from 'next/navigation';
import { CreditCard, Key, User } from 'lucide-react';
import { IS_SUBSCRIPTIONS_ENABLED } from '@documenso/lib/constants/features';
import { cn } from '@documenso/ui/lib/utils';
import { Button } from '@documenso/ui/primitives/button';
import { useFeatureFlags } from '~/providers/feature-flag';
export type DesktopNavProps = HTMLAttributes<HTMLDivElement>;
export const DesktopNav = ({ className, ...props }: DesktopNavProps) => {
const pathname = usePathname();
const { getFlag } = useFeatureFlags();
const isBillingEnabled = getFlag('billing');
return (
<div className={cn('flex flex-col gap-y-2', className)} {...props}>
<Link href="/settings/profile">
@ -44,7 +49,7 @@ export const DesktopNav = ({ className, ...props }: DesktopNavProps) => {
</Button>
</Link>
{IS_SUBSCRIPTIONS_ENABLED && (
{isBillingEnabled && (
<Link href="/settings/billing">
<Button
variant="ghost"