Add additional states to StateTag component

- Introduced new states: 'sent', 'acknowledged', 'ordered', 'received', 'invoiced', 'planned', 'partiallyShipped', 'shipped', 'delivered', and 'paid' with corresponding badge statuses and texts.
- Updated badge properties to handle custom colors for non-standard statuses.
This commit is contained in:
Tom Butcher 2025-12-27 13:51:10 +00:00
parent 50bc816e97
commit 57e90e2b6f

View File

@ -96,6 +96,46 @@ const StateTag = ({ state, showBadge = true, style = {} }) => {
status = 'success' status = 'success'
text = 'Unconsumed' text = 'Unconsumed'
break break
case 'sent':
status = 'cyan'
text = 'Sent'
break
case 'acknowledged':
status = 'processing'
text = 'Acknowledged'
break
case 'ordered':
status = 'cyan'
text = 'Ordered'
break
case 'received':
status = 'success'
text = 'Received'
break
case 'invoiced':
status = 'warning'
text = 'Invoiced'
break
case 'planned':
status = 'warning'
text = 'Planned'
break
case 'partiallyShipped':
status = 'processing'
text = 'Partially Shipped'
break
case 'shipped':
status = 'processing'
text = 'Shipped'
break
case 'delivered':
status = 'success'
text = 'Delivered'
break
case 'paid':
status = 'success'
text = 'Paid'
break
default: default:
status = 'default' status = 'default'
text = state || 'Unknown' text = state || 'Unknown'
@ -104,10 +144,22 @@ const StateTag = ({ state, showBadge = true, style = {} }) => {
return { badgeStatus: status, badgeText: text } return { badgeStatus: status, badgeText: text }
}, [state]) }, [state])
var badgeProps = {
status: badgeStatus
}
if (
!['success', 'warning', 'error', 'processing', 'default'].includes(
badgeStatus
)
) {
badgeProps = { color: badgeStatus }
}
return ( return (
<Tag color={badgeStatus} style={{ marginRight: 0, ...style }}> <Tag color={badgeStatus} style={{ marginRight: 0, ...style }}>
<Flex gap={6}> <Flex gap={6}>
{showBadge && <Badge status={badgeStatus} />} {showBadge && <Badge {...badgeProps} />}
{badgeText} {badgeText}
</Flex> </Flex>
</Tag> </Tag>