Enhance StateDisplay component to conditionally show progress for specific loading types
This commit is contained in:
parent
b12d230a8e
commit
5cb586246f
@ -4,6 +4,7 @@ import { Progress, Flex, Space } from 'antd'
|
||||
import StateTag from './StateTag'
|
||||
|
||||
const StateDisplay = ({ state, showProgress = true, showState = true }) => {
|
||||
const loadingProgressTypes = ['loading', 'processing', 'queued', 'printing']
|
||||
const currentState = state || {
|
||||
type: 'unknown',
|
||||
progress: 0
|
||||
@ -16,7 +17,10 @@ const StateDisplay = ({ state, showProgress = true, showState = true }) => {
|
||||
<StateTag state={currentState.type} />
|
||||
</Space>
|
||||
)}
|
||||
{showProgress && currentState?.progress && currentState?.progress > 0 ? (
|
||||
{showProgress &&
|
||||
loadingProgressTypes.includes(currentState.type) &&
|
||||
currentState?.progress &&
|
||||
currentState?.progress > 0 ? (
|
||||
<Progress
|
||||
percent={Math.round(currentState.progress * 100)}
|
||||
status='active'
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user