Some checks reported errors
farmcontrol/farmcontrol-server/pipeline/head Something is wrong with the build of this commit
37 lines
861 B
JavaScript
37 lines
861 B
JavaScript
// PrinterSelect.js
|
|
import PropTypes from "prop-types";
|
|
import { Progress, Flex, Space } from "antd";
|
|
import StateTag from "./StateTag";
|
|
|
|
const StateDisplay = ({ state, showProgress = true, showState = true }) => {
|
|
const currentState = state || {
|
|
type: "unknown",
|
|
progress: 0,
|
|
};
|
|
|
|
return (
|
|
<Flex gap="small" align={"center"}>
|
|
{showState && (
|
|
<Space>
|
|
<StateTag state={currentState.type} />
|
|
</Space>
|
|
)}
|
|
{showProgress && currentState?.percent > 0 ? (
|
|
<Progress
|
|
percent={Math.round(currentState.percent)}
|
|
status="active"
|
|
style={{ width: "150px", marginBottom: "2px" }}
|
|
/>
|
|
) : null}
|
|
</Flex>
|
|
);
|
|
};
|
|
|
|
StateDisplay.propTypes = {
|
|
state: PropTypes.object,
|
|
showProgress: PropTypes.bool,
|
|
showState: PropTypes.bool,
|
|
};
|
|
|
|
export default StateDisplay;
|