Files
sign/apps/web/src/components/(dashboard)/settings/layout/desktop-nav.tsx

107 lines
2.8 KiB
TypeScript
Raw Normal View History

2023-06-09 18:21:18 +10:00
'use client';
import type { HTMLAttributes } from 'react';
2023-06-09 18:21:18 +10:00
import Link from 'next/link';
import { usePathname } from 'next/navigation';
import { Braces, CreditCard, Lock, User, Users, Webhook } from 'lucide-react';
2023-06-09 18:21:18 +10:00
2023-09-20 13:48:30 +10:00
import { useFeatureFlags } from '@documenso/lib/client-only/providers/feature-flag';
2023-06-09 18:21:18 +10:00
import { cn } from '@documenso/ui/lib/utils';
import { Button } from '@documenso/ui/primitives/button';
export type DesktopNavProps = HTMLAttributes<HTMLDivElement>;
export const DesktopNav = ({ className, ...props }: DesktopNavProps) => {
const pathname = usePathname();
2023-08-18 20:05:14 +10:00
const { getFlag } = useFeatureFlags();
const isBillingEnabled = getFlag('app_billing');
2023-08-18 20:05:14 +10:00
2023-06-09 18:21:18 +10:00
return (
<div className={cn('flex flex-col gap-y-2', className)} {...props}>
<Link href="/settings/profile">
<Button
variant="ghost"
className={cn(
'w-full justify-start',
pathname?.startsWith('/settings/profile') && 'bg-secondary',
)}
>
<User className="mr-2 h-5 w-5" />
Profile
</Button>
</Link>
<Link href="/settings/teams">
<Button
variant="ghost"
className={cn(
'w-full justify-start',
pathname?.startsWith('/settings/teams') && 'bg-secondary',
)}
>
<Users className="mr-2 h-5 w-5" />
Teams
</Button>
</Link>
2024-02-26 22:24:23 +11:00
<Link href="/settings/security">
2024-02-06 16:00:28 +02:00
<Button
variant="ghost"
className={cn(
'w-full justify-start',
2024-02-26 22:24:23 +11:00
pathname?.startsWith('/settings/security') && 'bg-secondary',
2024-02-06 16:00:28 +02:00
)}
>
2024-02-26 22:24:23 +11:00
<Lock className="mr-2 h-5 w-5" />
Security
2024-02-06 16:00:28 +02:00
</Button>
</Link>
2024-02-26 22:24:23 +11:00
<Link href="/settings/tokens">
2023-06-09 18:21:18 +10:00
<Button
variant="ghost"
className={cn(
'w-full justify-start',
2024-02-26 22:24:23 +11:00
pathname?.startsWith('/settings/tokens') && 'bg-secondary',
2023-06-09 18:21:18 +10:00
)}
>
2024-02-26 22:24:23 +11:00
<Braces className="mr-2 h-5 w-5" />
API Tokens
2023-06-09 18:21:18 +10:00
</Button>
</Link>
2024-02-26 22:24:23 +11:00
<Link href="/settings/webhooks">
2023-11-24 13:59:33 +02:00
<Button
variant="ghost"
className={cn(
'w-full justify-start',
2024-02-26 22:24:23 +11:00
pathname?.startsWith('/settings/webhooks') && 'bg-secondary',
2023-11-24 13:59:33 +02:00
)}
>
2024-02-26 22:24:23 +11:00
<Webhook className="mr-2 h-5 w-5" />
Webhooks
2023-11-24 13:59:33 +02:00
</Button>
</Link>
2023-08-18 20:05:14 +10:00
{isBillingEnabled && (
2023-06-09 18:21:18 +10:00
<Link href="/settings/billing">
<Button
variant="ghost"
className={cn(
'w-full justify-start',
pathname?.startsWith('/settings/billing') && 'bg-secondary',
)}
>
<CreditCard className="mr-2 h-5 w-5" />
Billing
</Button>
</Link>
)}
</div>
);
};