feat: api token page in the settings

This commit is contained in:
Catalin Pit
2023-11-24 13:59:33 +02:00
parent 2ccede72ea
commit 80fe7ccdf5
6 changed files with 131 additions and 4 deletions

View File

@ -0,0 +1,21 @@
import { getRequiredServerComponentSession } from '@documenso/lib/next-auth/get-server-component-session';
import { ApiTokenForm } from '~/components/forms/token';
export default async function ApiToken() {
const { user } = await getRequiredServerComponentSession();
return (
<div>
<h3 className="text-lg font-medium">API Token</h3>
<p className="text-muted-foreground mt-2 text-sm">
On this page, you can create new API tokens and manage the existing ones.
</p>
<hr className="my-4" />
<ApiTokenForm user={user} className="max-w-xl" />
</div>
);
}

View File

@ -1,11 +1,11 @@
'use client';
import { HTMLAttributes } from 'react';
import type { HTMLAttributes } from 'react';
import Link from 'next/link';
import { usePathname } from 'next/navigation';
import { CreditCard, Key, User } from 'lucide-react';
import { Braces, CreditCard, Key, User } from 'lucide-react';
import { useFeatureFlags } from '@documenso/lib/client-only/providers/feature-flag';
import { cn } from '@documenso/ui/lib/utils';
@ -48,6 +48,19 @@ export const DesktopNav = ({ className, ...props }: DesktopNavProps) => {
</Button>
</Link>
<Link href="/settings/token">
<Button
variant="ghost"
className={cn(
'w-full justify-start',
pathname?.startsWith('/settings/token') && 'bg-secondary',
)}
>
<Braces className="mr-2 h-5 w-5" />
API Token
</Button>
</Link>
{isBillingEnabled && (
<Link href="/settings/billing">
<Button

View File

@ -1,11 +1,11 @@
'use client';
import { HTMLAttributes } from 'react';
import type { HTMLAttributes } from 'react';
import Link from 'next/link';
import { usePathname } from 'next/navigation';
import { CreditCard, Key, User } from 'lucide-react';
import { Braces, CreditCard, Key, User } from 'lucide-react';
import { useFeatureFlags } from '@documenso/lib/client-only/providers/feature-flag';
import { cn } from '@documenso/ui/lib/utils';
@ -51,6 +51,19 @@ export const MobileNav = ({ className, ...props }: MobileNavProps) => {
</Button>
</Link>
<Link href="/settings/token">
<Button
variant="ghost"
className={cn(
'w-full justify-start',
pathname?.startsWith('/settings/token') && 'bg-secondary',
)}
>
<Braces className="mr-2 h-5 w-5" />
API Token
</Button>
</Link>
{isBillingEnabled && (
<Link href="/settings/billing">
<Button