Show absolute dates (#3186)

This commit is contained in:
Paweł Chyła 2023-02-28 10:50:54 +01:00 committed by GitHub
parent 9c88e17f34
commit 67c674126a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
14 changed files with 59 additions and 58 deletions

View file

@ -42,19 +42,17 @@ export const ChannelCreateView = ({}) => {
},
});
const [
reorderChannelWarehouses,
reorderChannelWarehousesOpts,
] = useChannelReorderWarehousesMutation({
onCompleted: data => {
const errors = data.channelReorderWarehouses.errors;
if (errors.length) {
errors.forEach(error => handleError(error));
}
const [reorderChannelWarehouses, reorderChannelWarehousesOpts] =
useChannelReorderWarehousesMutation({
onCompleted: data => {
const errors = data.channelReorderWarehouses.errors;
if (errors.length) {
errors.forEach(error => handleError(error));
}
navigate(channelPath(data.channelReorderWarehouses.channel?.id));
},
});
navigate(channelPath(data.channelReorderWarehouses.channel?.id));
},
});
const handleSubmit = async ({
shippingZonesIdsToAdd,

View file

@ -84,29 +84,25 @@ export const ChannelDetails: React.FC<ChannelDetailsProps> = ({
},
});
const [
deactivateChannel,
deactivateChannelOpts,
] = useChannelDeactivateMutation({
onCompleted: data => {
const errors = data.channelDeactivate.errors;
if (errors.length) {
errors.forEach(error => handleError(error));
}
},
});
const [deactivateChannel, deactivateChannelOpts] =
useChannelDeactivateMutation({
onCompleted: data => {
const errors = data.channelDeactivate.errors;
if (errors.length) {
errors.forEach(error => handleError(error));
}
},
});
const [
reorderChannelWarehouses,
reorderChannelWarehousesOpts,
] = useChannelReorderWarehousesMutation({
onCompleted: data => {
const errors = data.channelReorderWarehouses.errors;
if (errors.length) {
errors.forEach(error => handleError(error));
}
},
});
const [reorderChannelWarehouses, reorderChannelWarehousesOpts] =
useChannelReorderWarehousesMutation({
onCompleted: data => {
const errors = data.channelReorderWarehouses.errors;
if (errors.length) {
errors.forEach(error => handleError(error));
}
},
});
const handleSubmit = async ({
name,

View file

@ -71,6 +71,7 @@ interface TimelineNoteProps {
firstName?: string;
lastName?: string;
};
hasPlainDate?: boolean;
}
interface NoteMessageProps {
@ -90,7 +91,7 @@ const NoteMessage: React.FC<NoteMessageProps> = ({ message }) => (
);
export const TimelineNote: React.FC<TimelineNoteProps> = props => {
const { date, user, message } = props;
const { date, user, message, hasPlainDate } = props;
const { user: currentUser } = useUser();
const classes = useStyles(props);
@ -127,7 +128,7 @@ export const TimelineNote: React.FC<TimelineNoteProps> = props => {
<div className={classes.title}>
<Typography>{getUserTitleOrEmail()}</Typography>
<Typography>
<DateTime date={date} />
<DateTime date={date} plain={hasPlainDate} />
</Typography>
</div>
<Card className={classes.card} elevation={16}>

View file

@ -76,10 +76,8 @@ const CustomerListPage: React.FC<CustomerListPageProps> = ({
const userPermissions = useUserPermissions();
const structure = createFilterStructure(intl, filterOpts, userPermissions);
const {
CUSTOMER_OVERVIEW_CREATE,
CUSTOMER_OVERVIEW_MORE_ACTIONS,
} = useExtensions(extensionMountPoints.CUSTOMER_LIST);
const { CUSTOMER_OVERVIEW_CREATE, CUSTOMER_OVERVIEW_MORE_ACTIONS } =
useExtensions(extensionMountPoints.CUSTOMER_LIST);
const extensionMenuItems = mapToMenuItemsForCustomerOverviewActions(
CUSTOMER_OVERVIEW_MORE_ACTIONS,
selectedCustomerIds,

View file

@ -49,7 +49,7 @@ const CustomerStats: React.FC<CustomerStatsProps> = props => {
{customer.lastLogin === null ? (
"-"
) : (
<DateTime date={customer.lastLogin} />
<DateTime date={customer.lastLogin} plain />
)}
</Typography>
) : (
@ -69,6 +69,7 @@ const CustomerStats: React.FC<CustomerStatsProps> = props => {
) : (
<DateTime
date={customer.lastPlacedOrder.edges[0].node.created}
plain
/>
)}
</Typography>

View file

@ -214,14 +214,14 @@ const SaleList: React.FC<SaleListProps> = props => {
</TableCell>
<TableCell className={classes.colStart}>
{sale && sale.startDate ? (
<Date date={sale.startDate} />
<Date date={sale.startDate} plain />
) : (
<Skeleton />
)}
</TableCell>
<TableCell className={classes.colEnd}>
{sale && sale.endDate ? (
<Date date={sale.endDate} />
<Date date={sale.endDate} plain />
) : sale && sale.endDate === null ? (
"-"
) : (

View file

@ -281,14 +281,14 @@ const VoucherList: React.FC<VoucherListProps> = props => {
</TableCell>
<TableCell className={classes.colStart}>
{voucher?.startDate ? (
<Date date={voucher.startDate} />
<Date date={voucher.startDate} plain />
) : (
<Skeleton />
)}
</TableCell>
<TableCell className={classes.colEnd}>
{voucher?.endDate ? (
<Date date={voucher.endDate} />
<Date date={voucher.endDate} plain />
) : voucher && voucher.endDate === null ? (
"-"
) : (

View file

@ -87,6 +87,7 @@ const GiftCardHistory: React.FC = () => {
user={user}
message={message}
key={id}
hasPlainDate
/>
);
}

View file

@ -122,7 +122,13 @@ const GiftCardTimelineEvent: React.FC<GiftCardTimelineEventProps> = ({
event,
}) => {
const intl = useIntl();
return <TimelineEvent date={date} title={getEventMessage(event, intl)} />;
return (
<TimelineEvent
date={date}
title={getEventMessage(event, intl)}
hasPlainDate
/>
);
};
export default GiftCardTimelineEvent;

View file

@ -16,11 +16,8 @@ const GiftCardsListHeader: React.FC = () => {
const intl = useIntl();
const navigate = useNavigator();
const {
openCreateDialog,
openBulkCreateDialog,
openExportDialog,
} = useGiftCardListDialogs();
const { openCreateDialog, openBulkCreateDialog, openExportDialog } =
useGiftCardListDialogs();
const openSettings = () => navigate(giftCardSettingsUrl);

View file

@ -68,7 +68,7 @@ const HomeActivityCard: React.FC<HomeActivityCardProps> = props => {
{getActivityMessage(activity, intl)}
</Typography>
}
secondary={<DateTime date={activity.date} />}
secondary={<DateTime date={activity.date} plain />}
/>
) : (
<ListItemText className={classes.loadingProducts}>

View file

@ -416,7 +416,7 @@ export const ProductList: React.FC<ProductListProps> = props => {
>
<TableCell className={classes.colDate} data-test-id="date">
{product?.updatedAt ? (
<Date date={product.updatedAt} />
<Date date={product.updatedAt} plain />
) : (
<Skeleton />
)}

View file

@ -27,7 +27,8 @@ export interface TranslationsEntitiesFilters {
onMenuItemsTabClick: () => void;
}
export type TranslationsEntitiesListFilterTab = keyof typeof TranslatableEntities;
export type TranslationsEntitiesListFilterTab =
keyof typeof TranslatableEntities;
const tabs: TranslationsEntitiesListFilterTab[] = [
"categories",
@ -41,7 +42,9 @@ const tabs: TranslationsEntitiesListFilterTab[] = [
"menuItems",
];
const TranslationsEntitiesListPage: React.FC<TranslationsEntitiesListPageProps> = props => {
const TranslationsEntitiesListPage: React.FC<
TranslationsEntitiesListPageProps
> = props => {
const { filters, language, children } = props;
const intl = useIntl();

View file

@ -9,9 +9,9 @@ export interface TranslationsLanguageListPageProps {
languages: LanguageFragment[];
}
const TranslationsLanguageListPage: React.FC<TranslationsLanguageListPageProps> = ({
languages,
}) => {
const TranslationsLanguageListPage: React.FC<
TranslationsLanguageListPageProps
> = ({ languages }) => {
const intl = useIntl();
return (