change how we create/edit clients

This commit is contained in:
Carl-Gerhard Lindesvärd
2024-04-12 20:32:12 +02:00
committed by Carl-Gerhard Lindesvärd
parent 7f8d857508
commit bface463e2
16 changed files with 243 additions and 159 deletions

View File

@@ -1,7 +1,6 @@
import { Alert, AlertDescription, AlertTitle } from '@/components/ui/alert';
import { clipboard } from '@/utils/clipboard';
import { Copy, RocketIcon } from 'lucide-react';
import Link from 'next/link';
import type { IServiceClient } from '@openpanel/db';
@@ -19,17 +18,28 @@ export function CreateClientSuccess({ id, secret, cors }: Props) {
<Copy size={16} />
</div>
</button>
{secret ? (
<button className="text-left" onClick={() => clipboard(secret)}>
<Label>Secret</Label>
<div className="flex items-center justify-between rounded bg-gray-100 p-2 px-3">
{secret}
<Copy size={16} />
</div>
</button>
) : (
{secret && (
<div className="w-full">
<button
className="w-full text-left"
onClick={() => clipboard(secret)}
>
<Label>Client secret</Label>
<div className="flex items-center justify-between rounded bg-gray-100 p-2 px-3">
{secret}
<Copy size={16} />
</div>
</button>
{cors && (
<p className="mt-1 text-xs text-muted-foreground">
You will only need the secret if you want to send server events.
</p>
)}
</div>
)}
{cors && (
<div className="text-left">
<Label>Cors settings</Label>
<Label>CORS settings</Label>
<div className="flex items-center justify-between rounded bg-gray-100 p-2 px-3">
{cors}
</div>
@@ -39,7 +49,15 @@ export function CreateClientSuccess({ id, secret, cors }: Props) {
<RocketIcon className="h-4 w-4" />
<AlertTitle>Get started!</AlertTitle>
<AlertDescription>
Read our documentation to get started. Easy peasy!
Read our{' '}
<a
target="_blank"
href="https://docs.openpanel.dev"
className="underline"
>
documentation
</a>{' '}
to get started. Easy peasy!
</AlertDescription>
</Alert>
</div>

View File

@@ -14,7 +14,7 @@ export const columns: ColumnDef<IServiceClientWithProject>[] = [
<div>
<div>{row.original.name}</div>
<div className="text-sm text-muted-foreground">
{row.original.project.name}
{row.original.project?.name ?? 'No project'}
</div>
</div>
);