Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change badge colors #970

Merged
merged 1 commit into from
Oct 14, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 17 additions & 15 deletions skyvern-frontend/src/components/StatusBadge.tsx
Original file line number Diff line number Diff line change
@@ -1,29 +1,31 @@
import { Status } from "@/api/types";
import { Badge } from "./ui/badge";
import { cn } from "@/util/utils";

type Props = {
status: Status;
};

function StatusBadge({ status }: Props) {
let variant: "default" | "success" | "destructive" | "warning" = "default";
if (status === "completed") {
variant = "success";
} else if (
status === "failed" ||
status === "terminated" ||
status === "timed_out" ||
status === "canceled"
) {
variant = "destructive";
} else if (status === "running") {
variant = "warning";
}

const statusText = status === "timed_out" ? "timed out" : status;

return (
<Badge className="flex h-7 w-24 justify-center" variant={variant}>
<Badge
className={cn("flex h-7 w-24 justify-center", {
"bg-green-900 text-green-50 hover:bg-green-900/80":
status === Status.Completed,
"bg-orange-900 text-orange-50 hover:bg-orange-900/80":
status === Status.Terminated,
"bg-gray-900 text-gray-50 hover:bg-gray-900/80":
status === Status.Created,
"bg-red-900 text-red-50 hover:bg-red-900/80":
status === Status.Failed ||
status === Status.Canceled ||
status === Status.TimedOut,
"bg-yellow-900 text-yellow-50 hover:bg-yellow-900/80":
status === Status.Running || status === Status.Queued,
})}
>
{statusText}
</Badge>
);
Expand Down
Loading