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.

774 B
Raw Blame
import type { GithubVerificationOutcome } from "@/components/project/github-integration/describe-github-verification";

type Translate = (key: string, options?: Record<string, unknown>) => string;

export function githubVerificationMessage(
  outcome: GithubVerificationOutcome,
  fallback: string,
  t: Translate,
) {
  if (outcome.kind === "ready")
    return t("settings:githubIntegration.verifyReady");
  if (outcome.kind === "notInstalled")
    return t("settings:githubIntegration.verifyNotInstalled");
  if (outcome.kind === "missingPermissions" && outcome.permissions.length)
    return t("settings:githubIntegration.verifyMissingPermissions", {
      list: outcome.permissions.join(", "),
    });
  return outcome.kind === "message" ? outcome.message : fallback;
}