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'
|
import StateTag from './StateTag'
|
||||||
|
|
||||||
const StateDisplay = ({ state, showProgress = true, showState = true }) => {
|
const StateDisplay = ({ state, showProgress = true, showState = true }) => {
|
||||||
|
const loadingProgressTypes = ['loading', 'processing', 'queued', 'printing']
|
||||||
const currentState = state || {
|
const currentState = state || {
|
||||||
type: 'unknown',
|
type: 'unknown',
|
||||||
progress: 0
|
progress: 0
|
||||||
@ -16,7 +17,10 @@ const StateDisplay = ({ state, showProgress = true, showState = true }) => {
|
|||||||
<StateTag state={currentState.type} />
|
<StateTag state={currentState.type} />
|
||||||
</Space>
|
</Space>
|
||||||
)}
|
)}
|
||||||
{showProgress && currentState?.progress && currentState?.progress > 0 ? (
|
{showProgress &&
|
||||||
|
loadingProgressTypes.includes(currentState.type) &&
|
||||||
|
currentState?.progress &&
|
||||||
|
currentState?.progress > 0 ? (
|
||||||
<Progress
|
<Progress
|
||||||
percent={Math.round(currentState.progress * 100)}
|
percent={Math.round(currentState.progress * 100)}
|
||||||
status='active'
|
status='active'
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user