Enhance StateDisplay component to conditionally show progress for specific loading types

This commit is contained in:
Tom Butcher 2025-11-23 13:22:51 +00:00
parent b12d230a8e
commit 5cb586246f

View File

@ -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'