Skip to content

Commit

Permalink
fix: order customized status names
Browse files Browse the repository at this point in the history
  • Loading branch information
BrianJiang2021 authored and CarlLiu2023 committed Aug 29, 2023
1 parent c1debf6 commit 24f5a88
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions apps/storefront/src/pages/orderDetail/OrderDetail.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import {
import {
AddressConfigItem,
OrderDetailsResponse,
OrderStatusItem,
OrderStatusResponse,
} from '../../types'
import OrderStatus from '../order/components/OrderStatus'
Expand Down Expand Up @@ -56,7 +57,13 @@ function OrderDetail() {
} = useContext(GlobaledContext)

const {
state: { poNumber, status = '', customStatus, orderSummary },
state: {
poNumber,
status = '',
customStatus,
orderSummary,
orderStatus = [],
},
state: detailsData,
dispatch,
} = useContext(OrderDetailsContext)
Expand Down Expand Up @@ -183,6 +190,10 @@ function OrderDetail() {
getAddressLabelPermission()
}, [])

const getOrderStatusLabel = (status: string) =>
orderStatus.find((item: OrderStatusItem) => item.systemLabel === status)
?.customLabel || customStatus

return (
<B3Sping isSpinning={isRequestLoading} background="rgba(255,255,255,0.2)">
<Box
Expand Down Expand Up @@ -243,7 +254,7 @@ function OrderDetail() {
{`Order #${orderId}`}
{poNumber && `, ${poNumber}`}
</Typography>
<OrderStatus code={status} text={customStatus} />
<OrderStatus code={status} text={getOrderStatusLabel(status)} />
</Grid>
<Grid
container
Expand Down

0 comments on commit 24f5a88

Please sign in to comment.