Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ export const OrderManualTransactionRefundPage = ({
<Box marginBottom={"auto"}>
<Reason />
</Box>
<DashboardCard.Content>
<DashboardCard.Content marginTop={4}>
<OrderManualTransactionRefundWarning />
</DashboardCard.Content>
</Box>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -290,17 +290,16 @@ const OrderTransactionRefundPage = ({
<OrderTransactionTiles transactions={order?.transactions} control={control} />
</DetailPageLayout.Content>
<DetailPageLayout.RightSidebar>
<Box __width="400px" display="flex" flexDirection="column" height="100%">
<Box __width="400px" display="flex" flexDirection="column" height="100%" gap={8}>
<OrderTransactionSummary
amountError={amountError || formErrors.amount}
control={control}
selectedProductsValue={selectedProductsValue}
canRefundShipping={canRefundShipping(order, draftRefund)}
shippingCost={order?.shippingPrice.gross}
currency={order?.total.gross.currency}
marginBottom={12}
/>
<Box marginBottom={12}>
<Box>
<DashboardCard>
<DashboardCard.Header>
<DashboardCard.Title>Refund reason</DashboardCard.Title>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,21 @@ interface OrderTransactionSummaryProps extends BoxProps {
currency: string | undefined;
}

// For usage in grid that exceeds our 16px padding for full background line
const FullWidthLine = () => {
return (
<Box gridColumn="full" position="relative">
<Box
borderBottomStyle="solid"
borderBottomWidth={1}
borderColor="default1"
position="absolute"
style={{ left: -16, right: -16, bottom: 0, height: "1px" }}
/>
</Box>
);
};

export const OrderTransactionSummary = ({
amountError,
control,
Expand Down Expand Up @@ -49,38 +64,36 @@ export const OrderTransactionSummary = ({
<Text as="p">
<FormattedMessage {...messages.amountDescription} />
</Text>
<Box display="flex" flexDirection="column" backgroundColor="default2" borderRadius={3}>
<Box backgroundColor="default2" borderRadius={3} padding={4}>
<Box
display="flex"
justifyContent="space-between"
display="grid"
__columnGap="6px"
rowGap={4}
__gridTemplateColumns="auto 1fr auto"
alignItems="center"
borderBottomStyle="solid"
borderBottomWidth={1}
borderColor="default1"
paddingY={4}
>
<Text size={3}>
{/* Selected products row - no checkbox */}
<Text gridColumnStart="2" size={3}>
<FormattedMessage {...messages.selectedProducts} />
</Text>
{currency ? (
<Money money={{ currency, amount: selectedProductsValue }} />
) : (
<Box display="flex" width={20}>
<Skeleton />
</Box>
)}
</Box>
<Box
display="flex"
justifyContent="space-between"
alignItems="center"
borderBottomStyle="solid"
borderBottomWidth={1}
borderColor="default1"
paddingY={4}
>
<Box display="flex" justifyContent="flex-end">
{currency ? (
<Money money={{ currency, amount: selectedProductsValue }} />
) : (
<Box display="flex" width={20}>
<Skeleton />
</Box>
)}
</Box>

<FullWidthLine />

{canRefundShipping ? (
<Checkbox checked={shippingField.value} onCheckedChange={shippingField.onChange}>
<Checkbox
display="contents"
checked={shippingField.value}
onCheckedChange={shippingField.onChange}
>
<Text size={3}>
<FormattedMessage {...messages.shipping} />
</Text>
Expand All @@ -89,6 +102,7 @@ export const OrderTransactionSummary = ({
<Tooltip>
<Tooltip.Trigger>
<Checkbox
display="contents"
disabled
checked={shippingField.value}
onCheckedChange={shippingField.onChange}
Expand All @@ -105,21 +119,20 @@ export const OrderTransactionSummary = ({
</Tooltip.Content>
</Tooltip>
)}
{shippingCost ? (
<Money money={shippingCost} />
) : (
<Box display="flex" width={20}>
<Skeleton />
</Box>
)}
</Box>
<Box
display="flex"
justifyContent="space-between"
paddingTop={4}
paddingBottom={amountError ? 2 : 4}
>
<Text size={5} display="flex" alignItems="center">
<Box display="flex" justifyContent="flex-end">
{shippingCost ? (
<Money money={shippingCost} />
) : (
<Box display="flex" width={20}>
<Skeleton />
</Box>
)}
</Box>

<FullWidthLine />

{/* Total row */}
<Text gridColumnStart="2" size={5}>
<FormattedMessage {...messages.totalAmount} />
</Text>
<Input
Expand All @@ -131,14 +144,20 @@ export const OrderTransactionSummary = ({
__width={100}
endAdornment={currency}
/>

{/* Error message */}
{!!amountError && (
<>
<Box />
<Box />
<Box textAlign="right">
<Text color="critical1" size={1}>
{amountError.message}
</Text>
</Box>
</>
)}
</Box>
{!!amountError && (
<Box textAlign="right" paddingBottom={4}>
<Text color="critical1" size={1}>
{amountError.message}
</Text>
</Box>
)}
</Box>
</DashboardCard.Content>
</DashboardCard>
Expand Down
Loading