2023-06-09 18:21:18 +10:00
|
|
|
'use client';
|
|
|
|
|
|
2024-02-06 16:16:10 +11:00
|
|
|
import type { HTMLAttributes } from 'react';
|
2023-06-09 18:21:18 +10:00
|
|
|
|
|
|
|
|
import Link from 'next/link';
|
|
|
|
|
import { usePathname } from 'next/navigation';
|
|
|
|
|
|
2024-08-27 20:34:39 +09:00
|
|
|
import { Trans } from '@lingui/macro';
|
2024-06-06 14:46:48 +10:00
|
|
|
import { Braces, CreditCard, Globe2Icon, 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 MobileNavProps = HTMLAttributes<HTMLDivElement>;
|
|
|
|
|
|
|
|
|
|
export const MobileNav = ({ className, ...props }: MobileNavProps) => {
|
|
|
|
|
const pathname = usePathname();
|
|
|
|
|
|
2023-08-18 20:05:14 +10:00
|
|
|
const { getFlag } = useFeatureFlags();
|
|
|
|
|
|
2023-08-21 11:44:56 +10:00
|
|
|
const isBillingEnabled = getFlag('app_billing');
|
2024-06-06 14:46:48 +10:00
|
|
|
const isPublicProfileEnabled = getFlag('app_public_profile');
|
2023-08-18 20:05:14 +10:00
|
|
|
|
2023-06-09 18:21:18 +10:00
|
|
|
return (
|
|
|
|
|
<div
|
|
|
|
|
className={cn('flex flex-wrap items-center justify-start gap-x-2 gap-y-4', 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" />
|
2024-08-27 20:34:39 +09:00
|
|
|
<Trans>Profile</Trans>
|
2023-06-09 18:21:18 +10:00
|
|
|
</Button>
|
|
|
|
|
</Link>
|
|
|
|
|
|
2024-06-06 14:46:48 +10:00
|
|
|
{isPublicProfileEnabled && (
|
|
|
|
|
<Link href="/settings/public-profile">
|
|
|
|
|
<Button
|
|
|
|
|
variant="ghost"
|
|
|
|
|
className={cn(
|
|
|
|
|
'w-full justify-start',
|
|
|
|
|
pathname?.startsWith('/settings/public-profile') && 'bg-secondary',
|
|
|
|
|
)}
|
|
|
|
|
>
|
|
|
|
|
<Globe2Icon className="mr-2 h-5 w-5" />
|
2024-08-27 20:34:39 +09:00
|
|
|
<Trans>Public Profile</Trans>
|
2024-06-06 14:46:48 +10:00
|
|
|
</Button>
|
|
|
|
|
</Link>
|
|
|
|
|
)}
|
|
|
|
|
|
2024-03-05 22:06:48 +11:00
|
|
|
<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" />
|
2024-08-27 20:34:39 +09:00
|
|
|
<Trans>Teams</Trans>
|
2024-03-05 22:06:48 +11:00
|
|
|
</Button>
|
|
|
|
|
</Link>
|
2024-02-06 16:16:10 +11:00
|
|
|
|
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" />
|
2024-08-27 20:34:39 +09:00
|
|
|
<Trans>Security</Trans>
|
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" />
|
2024-08-27 20:34:39 +09:00
|
|
|
<Trans>API Tokens</Trans>
|
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" />
|
2024-08-27 20:34:39 +09:00
|
|
|
<Trans>Webhooks</Trans>
|
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" />
|
2024-08-27 20:34:39 +09:00
|
|
|
<Trans>Billing</Trans>
|
2023-06-09 18:21:18 +10:00
|
|
|
</Button>
|
|
|
|
|
</Link>
|
|
|
|
|
)}
|
|
|
|
|
</div>
|
|
|
|
|
);
|
|
|
|
|
};
|