Skip to content

armgit / kaneo

Public Imported from GitHub
0

⚡ Project management that doesn't become the project. Boards, Gantt charts, and GitHub integration. Self-host it or use Kaneo Cloud.

954 B
Raw Blame
import { CheckingLine } from "@/components/project/code-hosting/checking-line";
import {
  type AccessVerificationResult,
  accessVerificationTone,
} from "@/components/project/code-hosting/access-verification-tone";
import { StatusDotLine } from "@/components/project/code-hosting/status-dot-line";

type AccessStatusLineProps = {
  checking: boolean;
  result: AccessVerificationResult | undefined;
  error: unknown;
  fallbackError: string;
};

export function AccessStatusLine({
  checking,
  result,
  error,
  fallbackError,
}: AccessStatusLineProps) {
  if (checking) return <CheckingLine />;
  if (error) {
    return (
      <StatusDotLine tone="destructive">
        {error instanceof Error && error.message
          ? error.message
          : fallbackError}
      </StatusDotLine>
    );
  }
  if (!result) return null;

  return (
    <StatusDotLine tone={accessVerificationTone(result)}>
      {result.message}
    </StatusDotLine>
  );
}