'use client';
import { Copy, ExternalLink, KeyRound, RefreshCw } from 'lucide-react';
import { Button } from '@/components/ui/button';
import { Dialog, DialogContent, DialogHeader, DialogTitle } from '@/components/ui/dialog';
import { OAuthClient } from '@/lib/api';
import { OAuthEndpoints, buildAuthorizeUrl } from '@/lib/oauth-url';
function CopyRow({ label, value, onCopy }: { label: string; value: string; onCopy: (value: string, label: string) => void }) {
return (
{label}
{value}
);
}
export function OAuthClientDetailDialog({
client,
endpoints,
open,
onOpenChange,
onCopy,
onRotateSecret,
onToggleActive
}: {
client: OAuthClient | null;
endpoints: OAuthEndpoints;
open: boolean;
onOpenChange: (open: boolean) => void;
onCopy: (value: string, label: string) => void;
onRotateSecret: (clientId: string) => void;
onToggleActive: (client: OAuthClient) => void;
}) {
if (!client) return null;
const primaryRedirect = client.redirectUris[0] ?? 'https://app.example.com/oauth/callback';
const scope = client.scopes.join(' ');
const sampleAuthorizeUrl = buildAuthorizeUrl(endpoints.issuer, {
clientId: client.clientId,
redirectUri: primaryRedirect,
scope
});
return (
);
}