mirror of
https://github.com/kingomarnajjar/flex-template-web.git
synced 2026-07-28 12:43:11 +10:00
Show info text only for preauthorized
This commit is contained in:
parent
14dc883544
commit
854322ae16
3 changed files with 11 additions and 105 deletions
|
|
@ -79,7 +79,7 @@
|
|||
}
|
||||
}
|
||||
|
||||
.message {
|
||||
.infoText {
|
||||
margin: 24px 24px 0 24px;
|
||||
|
||||
@media (--viewportLarge) {
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
import React from 'react';
|
||||
import PropTypes from 'prop-types';
|
||||
import { injectIntl, intlShape, FormattedDate, FormattedMessage } from 'react-intl';
|
||||
import { injectIntl, intlShape, FormattedMessage } from 'react-intl';
|
||||
import classNames from 'classnames';
|
||||
import * as propTypes from '../../util/propTypes';
|
||||
import { createSlug } from '../../util/urlHelpers';
|
||||
|
|
@ -73,37 +73,11 @@ const saleTitle = (transaction, listingLink, customerName) => {
|
|||
}
|
||||
};
|
||||
|
||||
const saleMessage = (transaction, customerName) => {
|
||||
const formattedDate = (
|
||||
<span className={css.nowrap}>
|
||||
<FormattedDate
|
||||
value={transaction.attributes.lastTransitionedAt}
|
||||
year="numeric"
|
||||
month="short"
|
||||
day="numeric"
|
||||
weekday="long"
|
||||
/>
|
||||
</span>
|
||||
);
|
||||
const saleInfoText = (transaction, customerName) => {
|
||||
if (propTypes.txIsPreauthorized(transaction)) {
|
||||
return <FormattedMessage id="SaleDetailsPanel.saleRequestedStatus" values={{ customerName }} />;
|
||||
} else if (propTypes.txIsAccepted(transaction)) {
|
||||
return <FormattedMessage id="SaleDetailsPanel.saleAcceptedStatus" values={{ formattedDate }} />;
|
||||
} else if (propTypes.txIsDeclined(transaction)) {
|
||||
return <FormattedMessage id="SaleDetailsPanel.saleDeclinedStatus" values={{ formattedDate }} />;
|
||||
} else if (propTypes.txIsAutodeclined(transaction)) {
|
||||
return (
|
||||
<FormattedMessage id="SaleDetailsPanel.saleAutoDeclinedStatus" values={{ formattedDate }} />
|
||||
);
|
||||
} else if (propTypes.txIsCanceled(transaction)) {
|
||||
return <FormattedMessage id="SaleDetailsPanel.saleCanceledStatus" values={{ formattedDate }} />;
|
||||
} else if (propTypes.txIsDelivered(transaction)) {
|
||||
return (
|
||||
<FormattedMessage id="SaleDetailsPanel.saleDeliveredStatus" values={{ formattedDate }} />
|
||||
);
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
return null;
|
||||
};
|
||||
|
||||
export const SaleDetailsPanelComponent = props => {
|
||||
|
|
@ -162,11 +136,11 @@ export const SaleDetailsPanelComponent = props => {
|
|||
const bookingInfo = breakdown(currentTransaction);
|
||||
|
||||
const title = saleTitle(currentTransaction, listingLink, customerDisplayName);
|
||||
const message = isCustomerBanned
|
||||
const infoText = isCustomerBanned
|
||||
? intl.formatMessage({
|
||||
id: 'SaleDetailsPanel.customerBannedStatus',
|
||||
})
|
||||
: saleMessage(currentTransaction, customerDisplayName);
|
||||
: saleInfoText(currentTransaction, customerDisplayName);
|
||||
|
||||
const listingTitle = currentListing.attributes.title;
|
||||
const firstImage =
|
||||
|
|
@ -238,7 +212,7 @@ export const SaleDetailsPanelComponent = props => {
|
|||
<AvatarLarge user={currentCustomer} className={css.avatarDesktop} />
|
||||
</div>
|
||||
<h1 className={css.title}>{title}</h1>
|
||||
<p className={css.message}>{message}</p>
|
||||
<p className={css.infoText}>{infoText}</p>
|
||||
<div className={css.errorMobile}>
|
||||
{acceptErrorMessage}
|
||||
{declineErrorMessage}
|
||||
|
|
|
|||
|
|
@ -89,24 +89,7 @@ exports[`SaleDetailsPanel accepted matches snapshot 1`] = `
|
|||
}
|
||||
/>
|
||||
</h1>
|
||||
<p>
|
||||
<FormattedMessage
|
||||
id="SaleDetailsPanel.saleAcceptedStatus"
|
||||
values={
|
||||
Object {
|
||||
"formattedDate": <span>
|
||||
<FormattedDate
|
||||
day="numeric"
|
||||
month="short"
|
||||
value={2017-06-10T00:00:00.000Z}
|
||||
weekday="long"
|
||||
year="numeric"
|
||||
/>
|
||||
</span>,
|
||||
}
|
||||
}
|
||||
/>
|
||||
</p>
|
||||
<p />
|
||||
<div />
|
||||
</div>
|
||||
<div>
|
||||
|
|
@ -460,24 +443,7 @@ exports[`SaleDetailsPanel autodeclined matches snapshot 1`] = `
|
|||
}
|
||||
/>
|
||||
</h1>
|
||||
<p>
|
||||
<FormattedMessage
|
||||
id="SaleDetailsPanel.saleAutoDeclinedStatus"
|
||||
values={
|
||||
Object {
|
||||
"formattedDate": <span>
|
||||
<FormattedDate
|
||||
day="numeric"
|
||||
month="short"
|
||||
value={2017-06-10T00:00:00.000Z}
|
||||
weekday="long"
|
||||
year="numeric"
|
||||
/>
|
||||
</span>,
|
||||
}
|
||||
}
|
||||
/>
|
||||
</p>
|
||||
<p />
|
||||
<div />
|
||||
</div>
|
||||
<div>
|
||||
|
|
@ -1217,24 +1183,7 @@ exports[`SaleDetailsPanel declined matches snapshot 1`] = `
|
|||
}
|
||||
/>
|
||||
</h1>
|
||||
<p>
|
||||
<FormattedMessage
|
||||
id="SaleDetailsPanel.saleDeclinedStatus"
|
||||
values={
|
||||
Object {
|
||||
"formattedDate": <span>
|
||||
<FormattedDate
|
||||
day="numeric"
|
||||
month="short"
|
||||
value={2017-06-10T00:00:00.000Z}
|
||||
weekday="long"
|
||||
year="numeric"
|
||||
/>
|
||||
</span>,
|
||||
}
|
||||
}
|
||||
/>
|
||||
</p>
|
||||
<p />
|
||||
<div />
|
||||
</div>
|
||||
<div>
|
||||
|
|
@ -1588,24 +1537,7 @@ exports[`SaleDetailsPanel delivered matches snapshot 1`] = `
|
|||
}
|
||||
/>
|
||||
</h1>
|
||||
<p>
|
||||
<FormattedMessage
|
||||
id="SaleDetailsPanel.saleDeliveredStatus"
|
||||
values={
|
||||
Object {
|
||||
"formattedDate": <span>
|
||||
<FormattedDate
|
||||
day="numeric"
|
||||
month="short"
|
||||
value={2017-06-10T00:00:00.000Z}
|
||||
weekday="long"
|
||||
year="numeric"
|
||||
/>
|
||||
</span>,
|
||||
}
|
||||
}
|
||||
/>
|
||||
</p>
|
||||
<p />
|
||||
<div />
|
||||
</div>
|
||||
<div>
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue