mirror of
https://github.com/kingomarnajjar/flex-template-web.git
synced 2026-07-27 09:13:14 +10:00
Fix titles or order and sale pages
Also unify translations.
This commit is contained in:
parent
a49a841205
commit
86fe4e0fd1
6 changed files with 73 additions and 41 deletions
|
|
@ -56,15 +56,37 @@ const orderTitle = (transaction, listingLink, customerName) => {
|
|||
</span>
|
||||
);
|
||||
} else if (propTypes.txIsDeclined(transaction)) {
|
||||
return <FormattedMessage id="OrderDetailsPanel.orderDeclinedTitle" values={{ listingLink }} />;
|
||||
return (
|
||||
<FormattedMessage
|
||||
id="OrderDetailsPanel.orderDeclinedTitle"
|
||||
values={{ customerName, listingLink }}
|
||||
/>
|
||||
);
|
||||
} else if (propTypes.txIsAutodeclined(transaction)) {
|
||||
return (
|
||||
<FormattedMessage id="OrderDetailsPanel.orderAutoDeclinedTitle" values={{ listingLink }} />
|
||||
<FormattedMessage
|
||||
id="OrderDetailsPanel.orderDeclinedTitle"
|
||||
values={{ customerName, listingLink }}
|
||||
/>
|
||||
);
|
||||
} else if (propTypes.txIsCanceled(transaction)) {
|
||||
return <FormattedMessage id="OrderDetailsPanel.orderCanceledTitle" values={{ listingLink }} />;
|
||||
} else if (propTypes.txIsDelivered(transaction)) {
|
||||
return <FormattedMessage id="OrderDetailsPanel.orderDeliveredTitle" values={{ listingLink }} />;
|
||||
return (
|
||||
<FormattedMessage
|
||||
id="OrderDetailsPanel.orderCancelledTitle"
|
||||
values={{ customerName, listingLink }}
|
||||
/>
|
||||
);
|
||||
} else if (
|
||||
propTypes.txIsDelivered(transaction) ||
|
||||
propTypes.txHasFirstReview(transaction) ||
|
||||
propTypes.txIsReviewed(transaction)
|
||||
) {
|
||||
return (
|
||||
<FormattedMessage
|
||||
id="OrderDetailsPanel.orderDeliveredTitle"
|
||||
values={{ customerName, listingLink }}
|
||||
/>
|
||||
);
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
|
|
@ -73,7 +95,7 @@ const orderTitle = (transaction, listingLink, customerName) => {
|
|||
const orderMessage = (transaction, providerName) => {
|
||||
if (propTypes.txIsPreauthorized(transaction)) {
|
||||
return (
|
||||
<FormattedMessage id="OrderDetailsPanel.orderPreauthorizedStatus" values={{ providerName }} />
|
||||
<FormattedMessage id="OrderDetailsPanel.orderPreauthorizedInfo" values={{ providerName }} />
|
||||
);
|
||||
}
|
||||
return null;
|
||||
|
|
|
|||
|
|
@ -700,9 +700,10 @@ exports[`OrderDetailsPanel autodeclined matches snapshot 1`] = `
|
|||
</div>
|
||||
<h1>
|
||||
<FormattedMessage
|
||||
id="OrderDetailsPanel.orderAutoDeclinedTitle"
|
||||
id="OrderDetailsPanel.orderDeclinedTitle"
|
||||
values={
|
||||
Object {
|
||||
"customerName": "customer display name",
|
||||
"listingLink": <NamedLink
|
||||
name="ListingPage"
|
||||
params={
|
||||
|
|
@ -1985,6 +1986,7 @@ exports[`OrderDetailsPanel declined matches snapshot 1`] = `
|
|||
id="OrderDetailsPanel.orderDeclinedTitle"
|
||||
values={
|
||||
Object {
|
||||
"customerName": "customer display name",
|
||||
"listingLink": <NamedLink
|
||||
name="ListingPage"
|
||||
params={
|
||||
|
|
@ -2620,6 +2622,7 @@ exports[`OrderDetailsPanel delivered matches snapshot 1`] = `
|
|||
id="OrderDetailsPanel.orderDeliveredTitle"
|
||||
values={
|
||||
Object {
|
||||
"customerName": "customer display name",
|
||||
"listingLink": <NamedLink
|
||||
name="ListingPage"
|
||||
params={
|
||||
|
|
@ -3284,7 +3287,7 @@ exports[`OrderDetailsPanel preauthorized matches snapshot 1`] = `
|
|||
</h1>
|
||||
<p>
|
||||
<FormattedMessage
|
||||
id="OrderDetailsPanel.orderPreauthorizedStatus"
|
||||
id="OrderDetailsPanel.orderPreauthorizedInfo"
|
||||
values={
|
||||
Object {
|
||||
"providerName": "provider display name",
|
||||
|
|
|
|||
|
|
@ -37,42 +37,46 @@ const saleTitle = (transaction, listingLink, customerName) => {
|
|||
if (propTypes.txIsPreauthorized(transaction)) {
|
||||
return (
|
||||
<FormattedMessage
|
||||
id="SaleDetailsPanel.listingRequestedTitle"
|
||||
id="SaleDetailsPanel.saleRequestedTitle"
|
||||
values={{ customerName, listingLink }}
|
||||
/>
|
||||
);
|
||||
} else if (propTypes.txIsAccepted(transaction)) {
|
||||
return (
|
||||
<FormattedMessage
|
||||
id="SaleDetailsPanel.listingAcceptedTitle"
|
||||
id="SaleDetailsPanel.saleAcceptedTitle"
|
||||
values={{ customerName, listingLink }}
|
||||
/>
|
||||
);
|
||||
} else if (propTypes.txIsDeclined(transaction)) {
|
||||
return (
|
||||
<FormattedMessage
|
||||
id="SaleDetailsPanel.listingDeclinedTitle"
|
||||
id="SaleDetailsPanel.saleDeclinedTitle"
|
||||
values={{ customerName, listingLink }}
|
||||
/>
|
||||
);
|
||||
} else if (propTypes.txIsAutodeclined(transaction)) {
|
||||
return (
|
||||
<FormattedMessage
|
||||
id="SaleDetailsPanel.listingDeclinedTitle"
|
||||
id="SaleDetailsPanel.saleDeclinedTitle"
|
||||
values={{ customerName, listingLink }}
|
||||
/>
|
||||
);
|
||||
} else if (propTypes.txIsCanceled(transaction)) {
|
||||
return (
|
||||
<FormattedMessage
|
||||
id="SaleDetailsPanel.listingCanceledTitle"
|
||||
id="SaleDetailsPanel.saleCancelledTitle"
|
||||
values={{ customerName, listingLink }}
|
||||
/>
|
||||
);
|
||||
} else if (propTypes.txIsDelivered(transaction)) {
|
||||
} else if (
|
||||
propTypes.txIsDelivered(transaction) ||
|
||||
propTypes.txHasFirstReview(transaction) ||
|
||||
propTypes.txIsReviewed(transaction)
|
||||
) {
|
||||
return (
|
||||
<FormattedMessage
|
||||
id="SaleDetailsPanel.listingDeliveredTitle"
|
||||
id="SaleDetailsPanel.saleDeliveredTitle"
|
||||
values={{ customerName, listingLink }}
|
||||
/>
|
||||
);
|
||||
|
|
@ -83,7 +87,7 @@ const saleTitle = (transaction, listingLink, customerName) => {
|
|||
|
||||
const saleInfoText = (transaction, customerName) => {
|
||||
if (propTypes.txIsPreauthorized(transaction)) {
|
||||
return <FormattedMessage id="SaleDetailsPanel.saleRequestedStatus" values={{ customerName }} />;
|
||||
return <FormattedMessage id="SaleDetailsPanel.saleRequestedInfo" values={{ customerName }} />;
|
||||
}
|
||||
return null;
|
||||
};
|
||||
|
|
|
|||
|
|
@ -70,7 +70,7 @@ exports[`SaleDetailsPanel accepted matches snapshot 1`] = `
|
|||
</div>
|
||||
<h1>
|
||||
<FormattedMessage
|
||||
id="SaleDetailsPanel.listingAcceptedTitle"
|
||||
id="SaleDetailsPanel.saleAcceptedTitle"
|
||||
values={
|
||||
Object {
|
||||
"customerName": "customer1 display name",
|
||||
|
|
@ -657,7 +657,7 @@ exports[`SaleDetailsPanel autodeclined matches snapshot 1`] = `
|
|||
</div>
|
||||
<h1>
|
||||
<FormattedMessage
|
||||
id="SaleDetailsPanel.listingDeclinedTitle"
|
||||
id="SaleDetailsPanel.saleDeclinedTitle"
|
||||
values={
|
||||
Object {
|
||||
"customerName": "customer1 display name",
|
||||
|
|
@ -1244,7 +1244,7 @@ exports[`SaleDetailsPanel canceled matches snapshot 1`] = `
|
|||
</div>
|
||||
<h1>
|
||||
<FormattedMessage
|
||||
id="SaleDetailsPanel.listingAcceptedTitle"
|
||||
id="SaleDetailsPanel.saleAcceptedTitle"
|
||||
values={
|
||||
Object {
|
||||
"customerName": "customer1 display name",
|
||||
|
|
@ -1831,7 +1831,7 @@ exports[`SaleDetailsPanel declined matches snapshot 1`] = `
|
|||
</div>
|
||||
<h1>
|
||||
<FormattedMessage
|
||||
id="SaleDetailsPanel.listingDeclinedTitle"
|
||||
id="SaleDetailsPanel.saleDeclinedTitle"
|
||||
values={
|
||||
Object {
|
||||
"customerName": "customer1 display name",
|
||||
|
|
@ -2418,7 +2418,7 @@ exports[`SaleDetailsPanel delivered matches snapshot 1`] = `
|
|||
</div>
|
||||
<h1>
|
||||
<FormattedMessage
|
||||
id="SaleDetailsPanel.listingDeliveredTitle"
|
||||
id="SaleDetailsPanel.saleDeliveredTitle"
|
||||
values={
|
||||
Object {
|
||||
"customerName": "customer1 display name",
|
||||
|
|
@ -3005,7 +3005,7 @@ exports[`SaleDetailsPanel preauthorized matches snapshot 1`] = `
|
|||
</div>
|
||||
<h1>
|
||||
<FormattedMessage
|
||||
id="SaleDetailsPanel.listingRequestedTitle"
|
||||
id="SaleDetailsPanel.saleRequestedTitle"
|
||||
values={
|
||||
Object {
|
||||
"customerName": "customer1 display name",
|
||||
|
|
@ -3026,7 +3026,7 @@ exports[`SaleDetailsPanel preauthorized matches snapshot 1`] = `
|
|||
</h1>
|
||||
<p>
|
||||
<FormattedMessage
|
||||
id="SaleDetailsPanel.saleRequestedStatus"
|
||||
id="SaleDetailsPanel.saleRequestedInfo"
|
||||
values={
|
||||
Object {
|
||||
"customerName": "customer1 display name",
|
||||
|
|
|
|||
|
|
@ -279,14 +279,13 @@
|
|||
"OrderDetailsPanel.initialMessageFailed": "Whoops, failed to send message from checkout.",
|
||||
"OrderDetailsPanel.messageDeletedListing": "However, the listing is deleted and cannot be viewed anymore.",
|
||||
"OrderDetailsPanel.messageLoadingFailed": "Something went wrong when loading messages. Please refresh the page and try again.",
|
||||
"OrderDetailsPanel.orderAcceptedSubtitle": "You have booked {listingLink}",
|
||||
"OrderDetailsPanel.orderAcceptedSubtitle": "Your booking for {listingLink} has been accepted.",
|
||||
"OrderDetailsPanel.orderAcceptedTitle": "Woohoo {customerName}!",
|
||||
"OrderDetailsPanel.orderAutoDeclinedTitle": "You requested to book {listingLink}",
|
||||
"OrderDetailsPanel.orderCanceledTitle": "You booked {listingLink}",
|
||||
"OrderDetailsPanel.orderDeclinedTitle": "You requested to book {listingLink}",
|
||||
"OrderDetailsPanel.orderDeliveredTitle": "The booking period has ended",
|
||||
"OrderDetailsPanel.orderPreauthorizedStatus": "{providerName} has been notified about the booking request. Sit back and relax.",
|
||||
"OrderDetailsPanel.orderPreauthorizedSubtitle": "You have requested to book {listingLink}",
|
||||
"OrderDetailsPanel.orderCancelledTitle": "{customerName}, your booking for {listingLink} has been cancelled.",
|
||||
"OrderDetailsPanel.orderDeclinedTitle": "{customerName}, your booking for {listingLink} has been declined.",
|
||||
"OrderDetailsPanel.orderDeliveredTitle": "{customerName}, your booking for {listingLink} has been completed.",
|
||||
"OrderDetailsPanel.orderPreauthorizedInfo": "{providerName} has been notified about the booking request. Sit back and relax.",
|
||||
"OrderDetailsPanel.orderPreauthorizedSubtitle": "You have requested to book {listingLink}.",
|
||||
"OrderDetailsPanel.orderPreauthorizedTitle": "Great success, {customerName}!",
|
||||
"OrderDetailsPanel.sendMessagePlaceholder": "Send a message to {name}…",
|
||||
"OrderPage.fetchOrderFailed": "Fetching order data failed.",
|
||||
|
|
@ -443,18 +442,13 @@
|
|||
"SaleDetailsPanel.bookingBreakdownTitle": "Booking breakdown",
|
||||
"SaleDetailsPanel.customerBannedStatus": "The user made the request, but was later banned.",
|
||||
"SaleDetailsPanel.declineSaleFailed": "Oops, declining failed. Please try again.",
|
||||
"SaleDetailsPanel.listingAcceptedTitle": "Woohoo! You accepted a request from {customerName} for {listingLink}",
|
||||
"SaleDetailsPanel.listingCanceledTitle": "{customerName} booked {listingLink}",
|
||||
"SaleDetailsPanel.listingDeclinedTitle": "{customerName} requested to book {listingLink}",
|
||||
"SaleDetailsPanel.listingDeliveredTitle": "{customerName} booked {listingLink}",
|
||||
"SaleDetailsPanel.listingRequestedTitle": "{customerName} has requested to book {listingLink}",
|
||||
"SaleDetailsPanel.messageLoadingFailed": "Something went wrong when loading messages. Please refresh the page and try again.",
|
||||
"SaleDetailsPanel.saleAcceptedStatus": "You accepted the request on {formattedDate}.",
|
||||
"SaleDetailsPanel.saleAutoDeclinedStatus": "You did not react to the request on time. The request expired on {formattedDate}.",
|
||||
"SaleDetailsPanel.saleCanceledStatus": "The request was cancelled on {formattedDate}.",
|
||||
"SaleDetailsPanel.saleDeclinedStatus": "You declined the request on {formattedDate}.",
|
||||
"SaleDetailsPanel.saleDeliveredStatus": "You delivered the order on {formattedDate}.",
|
||||
"SaleDetailsPanel.saleRequestedStatus": "{customerName} is waiting for your response.",
|
||||
"SaleDetailsPanel.saleAcceptedTitle": "You accepted a request from {customerName} to book {listingLink}.",
|
||||
"SaleDetailsPanel.saleCancelledTitle": "The booking from {customerName} for {listingLink} has been cancelled.",
|
||||
"SaleDetailsPanel.saleDeclinedTitle": "The request from {customerName} to book {listingLink} has been declined.",
|
||||
"SaleDetailsPanel.saleDeliveredTitle": "The booking from {customerName} for {listingLink} has been completed.",
|
||||
"SaleDetailsPanel.saleRequestedInfo": "{customerName} is waiting for your response.",
|
||||
"SaleDetailsPanel.saleRequestedTitle": "{customerName} has requested to book {listingLink}.",
|
||||
"SaleDetailsPanel.sendMessagePlaceholder": "Send a message to {name}…",
|
||||
"SalePage.acceptButton": "Accept",
|
||||
"SalePage.declineButton": "Decline",
|
||||
|
|
|
|||
|
|
@ -218,12 +218,21 @@ export const txIsCanceled = tx => txLastTransition(tx) === TX_TRANSITION_CANCEL;
|
|||
|
||||
export const txIsDelivered = tx => txLastTransition(tx) === TX_TRANSITION_MARK_DELIVERED;
|
||||
|
||||
export const txHasFirstReview = tx => firstReviewTransitions.includes(txLastTransition(tx));
|
||||
|
||||
export const txIsReviewed = tx => areReviewsCompleted(txLastTransition(tx));
|
||||
|
||||
export const txTransition = shape({
|
||||
at: instanceOf(Date).isRequired,
|
||||
by: oneOf(TX_TRANSITION_ACTORS).isRequired,
|
||||
transition: oneOf(TX_TRANSITIONS).isRequired,
|
||||
});
|
||||
|
||||
const firstReviewTransitions = [
|
||||
TX_TRANSITION_REVIEW_BY_PROVIDER_FIRST,
|
||||
TX_TRANSITION_REVIEW_BY_CUSTOMER_FIRST,
|
||||
];
|
||||
|
||||
// Check if tx transition is followed by a state where
|
||||
// reviews are completed
|
||||
export const areReviewsCompleted = transition => {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue