import { Input } from "@kandev/ui/input"; import { Label } from "@kandev/ui/label"; import { RadioGroup, RadioGroupItem } from "@kandev/ui/radio-group"; import { Textarea } from "@kandev/ui/textarea"; import type { GitHubAppOwnerType, GitHubAppVisibility } from "@/lib/types/github"; import type { AppSetupErrors } from "./github-app-onboarding-model"; export type GitHubAppImportValues = { displayName: string; ownerLogin: string; ownerType: GitHubAppOwnerType; publicBaseUrl: string; visibility: GitHubAppVisibility; appId: string; clientId: string; clientSecret: string; privateKey: string; webhookSecret: string; slug: string; }; type Update = (name: keyof GitHubAppImportValues, value: string) => void; export function GitHubAppImportIdentityFields({ values, errors, update, }: { values: GitHubAppImportValues; errors: AppSetupErrors; update: Update; }) { return (
update("displayName", e.target.value)} /> update("slug", e.target.value)} /> update("ownerLogin", e.target.value)} />
update("ownerType", value)} className="flex min-h-11 flex-wrap items-center gap-5" >
); } export function GitHubAppImportSecretFields({ values, errors, update, }: { values: GitHubAppImportValues; errors: AppSetupErrors; update: Update; }) { const labels = { appId: "App ID", clientId: "Client ID", clientSecret: "Client secret", webhookSecret: "Webhook secret", } as const; return (
{(Object.keys(labels) as (keyof typeof labels)[]).map((name) => ( update(name, event.target.value)} /> ))}