"use client"; import { useCallback, useEffect, useState } from "react"; import { IconPlug } from "@tabler/icons-react"; import { Button } from "@kandev/ui/button"; import { Dialog, DialogContent, DialogDescription, DialogHeader, DialogTitle, DialogTrigger, } from "@kandev/ui/dialog"; import { Drawer, DrawerContent, DrawerDescription, DrawerHeader, DrawerTitle, DrawerTrigger, } from "@kandev/ui/drawer"; import { useResponsiveBreakpoint } from "@/hooks/use-responsive-breakpoint"; import type { GitHubStatus } from "@/lib/types/github"; import { GitHubAuthMethodList, type GitHubAutomationMethod } from "./github-auth-method-list"; import { GitHubAppConnectionPanel } from "./github-app-connection-panel"; import { GitHubCLIForm } from "./github-cli-form"; import { GitHubPATForm } from "./github-pat-form"; function methodForStatus(status: GitHubStatus): GitHubAutomationMethod { if (status.automation?.source === "github_app_installation") return "app"; if (status.automation?.source === "gh_cli") return "cli"; return "pat"; } const description = "This workspace uses one credential for repository sync, watches, background jobs, and managed agent GitHub access. Executor profile credentials can still take precedence."; function ConnectionBody({ method, workspaceId, onMethodChange, onSaved, }: { method: GitHubAutomationMethod; workspaceId: string; onMethodChange: (method: GitHubAutomationMethod) => void; onSaved: () => void; }) { return (