This commit is contained in:
2025-11-27 13:04:34 +03:00
parent 945c0e7a76
commit 6cc4f8fbb6
19 changed files with 362 additions and 69 deletions

View File

@@ -0,0 +1,46 @@
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
import { IconDefinition } from "@fortawesome/fontawesome-svg-core";
import { faCircle, faCircleCheck, faCircleNotch, faCircleXmark } from "@fortawesome/free-solid-svg-icons";
type Status = "idle" | "running" | "success" | "failed" | string | undefined;
const statusStyles: Record<
"idle" | "running" | "success" | "failed",
{ label: string; icon: IconDefinition; className: string; iconClassName?: string }
> = {
idle: {
label: "Idle",
icon: faCircle,
className: "bg-muted text-muted-foreground border border-border"
},
running: {
label: "Running",
icon: faCircleNotch,
className: "bg-amber-100 text-amber-800 border border-amber-200",
iconClassName: "animate-spin"
},
success: {
label: "Success",
icon: faCircleCheck,
className: "bg-emerald-100 text-emerald-800 border border-emerald-200"
},
failed: {
label: "Failed",
icon: faCircleXmark,
className: "bg-red-100 text-red-800 border border-red-200"
}
};
export function JobStatusBadge({ status }: { status: Status }) {
const normalized = (status || "idle") as keyof typeof statusStyles;
const style = statusStyles[normalized] || statusStyles.idle;
return (
<span
className={`inline-flex items-center gap-1 rounded-full px-3 py-1 text-xs font-semibold ${style.className}`}
>
<FontAwesomeIcon icon={style.icon} className={`h-3.5 w-3.5 ${style.iconClassName || ""}`} />
{style.label}
</span>
);
}

View File

@@ -1,21 +1,13 @@
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
import { faGithub, faGitlab } from "@fortawesome/free-brands-svg-icons";
import { faGithub } from "@fortawesome/free-brands-svg-icons";
import { faCodeBranch } from "@fortawesome/free-solid-svg-icons";
import giteaLogo from "../assets/gitea.png";
import gitlabLogo from "../assets/gitlab.png";
export function RepoIcon({ repoUrl }: { repoUrl: string }) {
const lower = repoUrl.toLowerCase();
if (lower.includes("github.com")) {
return <FontAwesomeIcon icon={faGithub} className="h-5 w-5 text-foreground" />;
}
if (lower.includes("gitlab.com")) {
return <FontAwesomeIcon icon={faGitlab} className="h-5 w-5 text-foreground" />;
}
if (lower.includes("gitea")) {
return (
<div className="flex h-5 w-5 items-center justify-center rounded-sm bg-emerald-600 text-[10px] font-semibold text-white">
Ge
</div>
);
}
if (lower.includes("github.com")) return <FontAwesomeIcon icon={faGithub} className="h-5 w-5 text-foreground" />;
if (lower.includes("gitlab")) return <img src={gitlabLogo} alt="GitLab" className="h-5 w-5 object-contain" />;
if (lower.includes("gitea")) return <img src={giteaLogo} alt="Gitea" className="h-5 w-5 object-contain" />;
return <FontAwesomeIcon icon={faCodeBranch} className="h-5 w-5 text-foreground" />;
}