Files
sign/apps/remix/app/components/general/settings-nav-desktop.tsx

116 lines
3.2 KiB
TypeScript
Raw Normal View History

import type { HTMLAttributes } from 'react';
2023-06-09 18:21:18 +10:00
2025-01-02 15:33:37 +11:00
import { Trans } from '@lingui/react/macro';
2024-06-06 14:46:48 +10:00
import { Braces, CreditCard, Globe2Icon, Lock, User, Users, Webhook } from 'lucide-react';
2025-01-02 15:33:37 +11:00
import { useLocation } from 'react-router';
import { Link } from 'react-router';
2023-06-09 18:21:18 +10:00
2025-01-02 15:33:37 +11:00
import { IS_BILLING_ENABLED } from '@documenso/lib/constants/app';
2023-06-09 18:21:18 +10:00
import { cn } from '@documenso/ui/lib/utils';
import { Button } from '@documenso/ui/primitives/button';
2025-01-02 15:33:37 +11:00
export type SettingsDesktopNavProps = HTMLAttributes<HTMLDivElement>;
2023-06-09 18:21:18 +10:00
2025-01-02 15:33:37 +11:00
export const SettingsDesktopNav = ({ className, ...props }: SettingsDesktopNavProps) => {
const { pathname } = useLocation();
2023-08-18 20:05:14 +10:00
2025-01-02 15:33:37 +11:00
const isBillingEnabled = IS_BILLING_ENABLED();
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}>
2025-01-02 15:33:37 +11:00
<Link to="/settings/profile">
2023-06-09 18:21:18 +10:00
<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>
2025-01-02 15:33:37 +11:00
<Link to="/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" />
<Trans>Public Profile</Trans>
</Button>
</Link>
2024-06-06 14:46:48 +10:00
2025-01-02 15:33:37 +11:00
<Link to="/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>
</Button>
</Link>
2025-01-02 15:33:37 +11:00
<Link to="/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>
2025-01-02 15:33:37 +11:00
<Link to="/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>
2025-01-02 15:33:37 +11:00
<Link to="/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 && (
2025-01-02 15:33:37 +11:00
<Link to="/settings/billing">
2023-06-09 18:21:18 +10:00
<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>
);
};