"use client"; import { useState } from "react"; import { IconCheck, IconCopy, IconExternalLink } from "@tabler/icons-react"; import { Button } from "@kandev/ui/button"; import { useCopyToClipboard } from "@/hooks/use-copy-to-clipboard"; import type { PrepareGitHubAppImportResponse } from "@/lib/types/github"; import { GitHubAppPolicyDialog } from "./github-app-policy-dialog"; const urlLabels: [keyof PrepareGitHubAppImportResponse, string][] = [ ["public_base_url", "Homepage URL"], ["personal_callback_url", "User authorization callback URL"], ["setup_url", "Setup URL"], ["webhook_url", "Webhook URL"], ]; export function GitHubAppImportGuide({ preparation, settingsUrl, }: { preparation: PrepareGitHubAppImportResponse; settingsUrl?: string; }) { const { copy } = useCopyToClipboard(); const [copied, setCopied] = useState(""); async function copyValue(value: string) { await copy(value); setCopied(value); } return (

Configure the existing App on GitHub

Set these exact URLs, create a client secret and webhook secret, and download a private key. This one-time setup expires {new Date(preparation.expires_at).toLocaleString()}.

For webhooks, choose application/json as the content type and keep SSL verification enabled.

{urlLabels.map(([key, label]) => { const value = String(preparation[key]); return (
{label}
{value}
); })}
{settingsUrl ? ( ) : ( )}
); }