import { Card, Badge, Button } from "../atoms";
import type { Profile, Instance } from "../../types";
interface Props {
profile: Profile;
instance?: Instance;
onLaunch: () => void;
onStop?: () => void;
onDetails?: () => void;
}
function InfoRow({ label, value }: { label: string; value: string }) {
return (
{label}
{value}
);
}
export default function ProfileCard({
profile,
instance,
onLaunch,
onStop,
onDetails,
}: Props) {
const isRunning = instance?.status === "running";
const isError = instance?.status === "error";
const accountText = profile.accountEmail || profile.accountName || "—";
const sizeText = profile.sizeMB ? `${profile.sizeMB.toFixed(0)} MB` : "—";
return (
{/* Header */}
{profile.name}
{isRunning ? (
:{instance.port}
) : isError ? (
error
) : (
stopped
)}
{/* Body */}
{profile.useWhen && (
Use when
{profile.useWhen}
)}
{isError && instance?.error && (
{instance.error}
)}
{/* Actions */}
{onDetails && (
)}
{isRunning ? (
) : (
)}
);
}