mirror of
https://github.com/nicotsx/ironmount.git
synced 2025-12-10 12:10:51 +01:00
* refactor: unify backend and frontend servers * refactor: correct paths for openapi & drizzle * refactor: move api-client to client * fix: drizzle paths * chore: fix linting issues * fix: form reset issue
50 lines
1.2 KiB
TypeScript
50 lines
1.2 KiB
TypeScript
import type { VolumeStatus } from "~/client/lib/types";
|
|
import { cn } from "~/client/lib/utils";
|
|
import { Tooltip, TooltipContent, TooltipTrigger } from "./ui/tooltip";
|
|
|
|
export const StatusDot = ({ status }: { status: VolumeStatus }) => {
|
|
const statusMapping = {
|
|
mounted: {
|
|
color: "bg-green-500",
|
|
colorLight: "bg-emerald-400",
|
|
animated: true,
|
|
},
|
|
unmounted: {
|
|
color: "bg-gray-500",
|
|
colorLight: "bg-gray-400",
|
|
animated: false,
|
|
},
|
|
error: {
|
|
color: "bg-red-500",
|
|
colorLight: "bg-amber-700",
|
|
animated: true,
|
|
},
|
|
unknown: {
|
|
color: "bg-yellow-500",
|
|
colorLight: "bg-yellow-400",
|
|
animated: true,
|
|
},
|
|
}[status];
|
|
|
|
return (
|
|
<Tooltip>
|
|
<TooltipTrigger>
|
|
<span className="relative flex size-3 mx-auto">
|
|
{statusMapping.animated && (
|
|
<span
|
|
className={cn(
|
|
"absolute inline-flex h-full w-full animate-ping rounded-full opacity-75",
|
|
`${statusMapping.colorLight}`,
|
|
)}
|
|
/>
|
|
)}
|
|
<span className={cn("relative inline-flex size-3 rounded-full", `${statusMapping.color}`)} />
|
|
</span>
|
|
</TooltipTrigger>
|
|
<TooltipContent>
|
|
<p className="capitalize">{status}</p>
|
|
</TooltipContent>
|
|
</Tooltip>
|
|
);
|
|
};
|