"use client"; import { IconCheck, IconX, IconRefresh } from "@tabler/icons-react"; import { Badge } from "@kandev/ui/badge"; import { Button } from "@kandev/ui/button"; import { Spinner } from "@kandev/ui/spinner"; import { useGitHubStatus } from "@/hooks/domains/github/use-github-status"; import type { AuthDiagnostics } from "@/lib/types/github"; function DiagnosticsOutput({ diagnostics }: { diagnostics: AuthDiagnostics }) { return (
{diagnostics.command} exit code: {diagnostics.exit_code}
{diagnostics.exit_code !== 0 && (

A non-zero exit code means the command failed. Review the output below for details.

)}
        {diagnostics.output.trim()}
      
); } export function GitHubStatusCard() { const { status, loaded, loading, refresh } = useGitHubStatus(); if (loading || !loaded) { return (
Checking GitHub connection...
); } if (!status || !status.authenticated) { return (
Not connected to GitHub Run gh auth login or add a GITHUB_TOKEN secret
{status?.diagnostics && }
); } return (
Connected as {status.username} {status.auth_method === "gh_cli" ? "gh CLI" : "PAT"}
); }