Skip to content

Commit

Permalink
feat: add Steps component to the ShippingParcels component
Browse files Browse the repository at this point in the history
  • Loading branch information
marcomontalbano committed Aug 16, 2023
1 parent 2b55fe9 commit b6d1ad3
Showing 1 changed file with 24 additions and 1 deletion.
25 changes: 24 additions & 1 deletion packages/app-elements/src/ui/resources/ShipmentParcels.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import { Legend } from '#ui/atoms/Legend'
import { withSkeletonTemplate } from '#ui/atoms/SkeletonTemplate'
import { Spacer } from '#ui/atoms/Spacer'
import { Stack } from '#ui/atoms/Stack'
import { Steps } from '#ui/atoms/Steps'
import { Text } from '#ui/atoms/Text'
import { CardDialog } from '#ui/composite/CardDialog'
import { PageLayout } from '#ui/composite/PageLayout'
Expand Down Expand Up @@ -302,8 +303,30 @@ const TrackingDetails = withSkeletonTemplate<{
return sortAndGroupByDate(events)
}, [parcel])

const lastEvent = Object.values(groupedEvents)[0][0]

return (
<>
<Steps
steps={[
{
label: 'Pre-Transit',
active: lastEvent.tracking.status === 'pre_transit'
},
{
label: 'In Transit',
active: lastEvent.tracking.status === 'in_transit'
},
{
label: 'Out for delivery',
active: lastEvent.tracking.status === 'out_for_delivery'
},
{
label: 'Delivered',
active: lastEvent.tracking.status === 'delivered'
}
]}
/>
<Spacer top='12' bottom='14'>
<Stack>
<div>
Expand Down Expand Up @@ -351,7 +374,7 @@ const TrackingDetails = withSkeletonTemplate<{
Last update:{' '}
<Text weight='bold'>
{formatDate({
isoDate: Object.values(groupedEvents)[0][0].date,
isoDate: lastEvent.date,
format: 'full',
timezone: user?.timezone
})}
Expand Down

0 comments on commit b6d1ad3

Please sign in to comment.