// PrinterSelect.js import PropTypes from 'prop-types' import { Progress, Flex, Space, Modal, Button, Typography } from 'antd' import StateTag from './StateTag' import InfoCircleIcon from '../../Icons/InfoCircleIcon' import { useState } from 'react' const { Text } = Typography const StateDisplay = ({ state, showProgress = true, showState = true, showMessage = true }) => { const loadingProgressTypes = [ 'loading', 'processing', 'queued', 'printing', 'used', 'deploying' ] const orangeProgressTypes = ['used', 'deploying', 'queued'] const activeProgressTypes = ['printing', 'deploying'] const currentState = state || { type: 'unknown', progress: 0 } const [showMessageModal, setShowMessageModal] = useState(false) return ( <> {showState && ( )} {showProgress && loadingProgressTypes.includes(currentState.type) && currentState?.progress && currentState?.progress > 0 ? ( ) : null} {showMessage && currentState?.message && ( )} setShowMessageModal(false)} footer={null} > {currentState.message} ) } StateDisplay.propTypes = { state: PropTypes.object, showProgress: PropTypes.bool, showState: PropTypes.bool, showMessage: PropTypes.bool } export default StateDisplay