mirror of
https://github.com/momo5502/emulator.git
synced 2026-01-24 06:01:02 +00:00
49 lines
1.0 KiB
TypeScript
49 lines
1.0 KiB
TypeScript
import { Badge } from "@/components/ui/badge";
|
|
import { CircleFill } from "react-bootstrap-icons";
|
|
import { EmulationState as State } from "@/emulator";
|
|
|
|
function getStateName(state: State) {
|
|
switch (state) {
|
|
case State.Stopped:
|
|
return "Stopped";
|
|
case State.Paused:
|
|
return "Paused";
|
|
case State.Running:
|
|
return "Running";
|
|
default:
|
|
return "";
|
|
}
|
|
}
|
|
|
|
function getStateColor(state: State) {
|
|
switch (state) {
|
|
case State.Stopped:
|
|
return "bg-orange-600";
|
|
case State.Paused:
|
|
return "bg-amber-500";
|
|
case State.Running:
|
|
return "bg-lime-600";
|
|
default:
|
|
return "";
|
|
}
|
|
}
|
|
|
|
export interface StatusIndicatorProps {
|
|
state: State;
|
|
}
|
|
|
|
export function StatusIndicator(props: StatusIndicatorProps) {
|
|
return (
|
|
<Badge variant="outline">
|
|
<CircleFill
|
|
className={
|
|
getStateColor(props.state) +
|
|
" rounded-full mr-1 n duration-200 ease-in-out"
|
|
}
|
|
color="transparent"
|
|
/>
|
|
{getStateName(props.state)}
|
|
</Badge>
|
|
);
|
|
}
|