
* Update schema, remove transaction specific files * Merge `.transaction` queries and mutations into regular files * Merge OrderDetails fragments * Remove usage of `.transaction` graphl types * Update fixtures * Remove usage of useFlag, remove duplicated queries & mutations * Fix displayed event type for INFO * Remove type alias from order/types.ts, remove type casting * Fix failing tests * Add preview label and better description in Channel settings * Update button in GrantRefund page * Fix missing data-test-id * Extract messages * Visual fixes * Revert changes to generated files * Revert changes to generated files * Fix psp reference hover * Fix colors on manu refunds screen * Revert "Fix colors on manu refunds screen" This reverts commit 02302930ab502a4fdc3c71558532a2d74f2e32c9. --------- Co-authored-by: andrzejewsky <vox3r69@gmail.com> Co-authored-by: Michal Miszczyszyn <michal@mmiszy.pl>
66 lines
1.7 KiB
TypeScript
66 lines
1.7 KiB
TypeScript
import { DateTime } from "@dashboard/components/Date";
|
|
import { Pill } from "@dashboard/components/Pill";
|
|
import { OrderDetailsFragment } from "@dashboard/graphql";
|
|
import { transformOrderStatus } from "@dashboard/misc";
|
|
import { Typography } from "@material-ui/core";
|
|
import { Skeleton } from "@material-ui/lab";
|
|
import { makeStyles } from "@saleor/macaw-ui";
|
|
import { Box } from "@saleor/macaw-ui/next";
|
|
import React from "react";
|
|
import { useIntl } from "react-intl";
|
|
|
|
export interface TitleProps {
|
|
order?: OrderDetailsFragment;
|
|
}
|
|
|
|
const useStyles = makeStyles(
|
|
theme => ({
|
|
container: {
|
|
alignItems: "center",
|
|
display: "flex",
|
|
gap: theme.spacing(2),
|
|
},
|
|
statusContainer: {
|
|
marginLeft: theme.spacing(2),
|
|
},
|
|
}),
|
|
{ name: "OrderDetailsTitle" },
|
|
);
|
|
|
|
const Title: React.FC<TitleProps> = props => {
|
|
const intl = useIntl();
|
|
const classes = useStyles(props);
|
|
const { order } = props;
|
|
|
|
if (!order) {
|
|
return null;
|
|
}
|
|
|
|
const { localized, status } = transformOrderStatus(order.status, intl);
|
|
|
|
return (
|
|
<div className={classes.container}>
|
|
<Box display="flex" justifyContent="center" alignItems="center">
|
|
{intl.formatMessage(
|
|
{ id: "AqXzM2", defaultMessage: "Order #{orderNumber}" },
|
|
{ orderNumber: order?.number },
|
|
)}
|
|
<div className={classes.statusContainer}>
|
|
<Pill label={localized} color={status} />
|
|
</div>
|
|
</Box>
|
|
|
|
<div>
|
|
{order && order.created ? (
|
|
<Typography variant="body2">
|
|
<DateTime date={order.created} plain />
|
|
</Typography>
|
|
) : (
|
|
<Skeleton style={{ width: "10em" }} />
|
|
)}
|
|
</div>
|
|
</div>
|
|
);
|
|
};
|
|
|
|
export default Title;
|