mirror of
https://github.com/kingomarnajjar/flex-template-web.git
synced 2026-07-26 06:47:17 +10:00
Merge pull request #579 from sharetribe/review-transitions
Fix review transition regression
This commit is contained in:
commit
f87eb49082
10 changed files with 86 additions and 58 deletions
|
|
@ -44,7 +44,7 @@
|
|||
|
||||
@media (--viewportMedium) {
|
||||
font-weight: 700;
|
||||
margin: -1px 0 0 10px;
|
||||
margin: 0 0 0 10px;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -79,6 +79,6 @@
|
|||
margin: 0 0 0 10px;
|
||||
|
||||
@media (--viewportMedium) {
|
||||
margin: 0 0 0 10px;
|
||||
margin: 2px 0 0 10px;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -102,7 +102,7 @@
|
|||
|
||||
@media (--viewportLarge) {
|
||||
max-width: 100%;
|
||||
margin: 175px 0 0 0;
|
||||
margin: 177px 0 0 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -176,7 +176,7 @@
|
|||
margin: 1px 0 0 0;
|
||||
|
||||
@media (--viewportLarge) {
|
||||
margin-top: 121px;
|
||||
margin-top: 123px;
|
||||
margin-left: 0;
|
||||
margin-right: 0;
|
||||
}
|
||||
|
|
@ -263,11 +263,7 @@
|
|||
}
|
||||
|
||||
.feed {
|
||||
margin-top: 17px;
|
||||
|
||||
@media (--viewportMedium) {
|
||||
margin-top: 19px;
|
||||
}
|
||||
margin-top: 20px;
|
||||
}
|
||||
|
||||
.sendMessageForm {
|
||||
|
|
@ -277,7 +273,7 @@
|
|||
box-shadow: var(--boxShadowBottomForm);
|
||||
|
||||
@media (--viewportLarge) {
|
||||
margin-top: 47px;
|
||||
margin-top: 46px;
|
||||
position: relative;
|
||||
box-shadow: none;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -57,15 +57,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;
|
||||
}
|
||||
|
|
@ -74,7 +96,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;
|
||||
|
|
|
|||
|
|
@ -712,9 +712,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={
|
||||
|
|
@ -2021,6 +2022,7 @@ exports[`OrderDetailsPanel declined matches snapshot 1`] = `
|
|||
id="OrderDetailsPanel.orderDeclinedTitle"
|
||||
values={
|
||||
Object {
|
||||
"customerName": "customer display name",
|
||||
"listingLink": <NamedLink
|
||||
name="ListingPage"
|
||||
params={
|
||||
|
|
@ -2668,6 +2670,7 @@ exports[`OrderDetailsPanel delivered matches snapshot 1`] = `
|
|||
id="OrderDetailsPanel.orderDeliveredTitle"
|
||||
values={
|
||||
Object {
|
||||
"customerName": "customer display name",
|
||||
"listingLink": <NamedLink
|
||||
name="ListingPage"
|
||||
params={
|
||||
|
|
@ -3344,7 +3347,7 @@ exports[`OrderDetailsPanel preauthorized matches snapshot 1`] = `
|
|||
</h1>
|
||||
<p>
|
||||
<FormattedMessage
|
||||
id="OrderDetailsPanel.orderPreauthorizedStatus"
|
||||
id="OrderDetailsPanel.orderPreauthorizedInfo"
|
||||
values={
|
||||
Object {
|
||||
"providerName": "provider display name",
|
||||
|
|
|
|||
|
|
@ -171,7 +171,7 @@
|
|||
|
||||
@media (--viewportLarge) {
|
||||
display: block;
|
||||
margin: 119px 0 0 0;
|
||||
margin: 120px 0 0 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -237,11 +237,7 @@
|
|||
}
|
||||
|
||||
.feed {
|
||||
margin-top: 17px;
|
||||
|
||||
@media (--viewportMedium) {
|
||||
margin-top: 20px;
|
||||
}
|
||||
margin-top: 20px;
|
||||
}
|
||||
|
||||
.sendMessageForm {
|
||||
|
|
|
|||
|
|
@ -38,42 +38,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 }}
|
||||
/>
|
||||
);
|
||||
|
|
@ -84,7 +88,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",
|
||||
|
|
@ -669,7 +669,7 @@ exports[`SaleDetailsPanel autodeclined matches snapshot 1`] = `
|
|||
</div>
|
||||
<h1>
|
||||
<FormattedMessage
|
||||
id="SaleDetailsPanel.listingDeclinedTitle"
|
||||
id="SaleDetailsPanel.saleDeclinedTitle"
|
||||
values={
|
||||
Object {
|
||||
"customerName": "customer1 display name",
|
||||
|
|
@ -1268,7 +1268,7 @@ exports[`SaleDetailsPanel canceled matches snapshot 1`] = `
|
|||
</div>
|
||||
<h1>
|
||||
<FormattedMessage
|
||||
id="SaleDetailsPanel.listingAcceptedTitle"
|
||||
id="SaleDetailsPanel.saleAcceptedTitle"
|
||||
values={
|
||||
Object {
|
||||
"customerName": "customer1 display name",
|
||||
|
|
@ -1867,7 +1867,7 @@ exports[`SaleDetailsPanel declined matches snapshot 1`] = `
|
|||
</div>
|
||||
<h1>
|
||||
<FormattedMessage
|
||||
id="SaleDetailsPanel.listingDeclinedTitle"
|
||||
id="SaleDetailsPanel.saleDeclinedTitle"
|
||||
values={
|
||||
Object {
|
||||
"customerName": "customer1 display name",
|
||||
|
|
@ -2466,7 +2466,7 @@ exports[`SaleDetailsPanel delivered matches snapshot 1`] = `
|
|||
</div>
|
||||
<h1>
|
||||
<FormattedMessage
|
||||
id="SaleDetailsPanel.listingDeliveredTitle"
|
||||
id="SaleDetailsPanel.saleDeliveredTitle"
|
||||
values={
|
||||
Object {
|
||||
"customerName": "customer1 display name",
|
||||
|
|
@ -3065,7 +3065,7 @@ exports[`SaleDetailsPanel preauthorized matches snapshot 1`] = `
|
|||
</div>
|
||||
<h1>
|
||||
<FormattedMessage
|
||||
id="SaleDetailsPanel.listingRequestedTitle"
|
||||
id="SaleDetailsPanel.saleRequestedTitle"
|
||||
values={
|
||||
Object {
|
||||
"customerName": "customer1 display name",
|
||||
|
|
@ -3086,7 +3086,7 @@ exports[`SaleDetailsPanel preauthorized matches snapshot 1`] = `
|
|||
</h1>
|
||||
<p>
|
||||
<FormattedMessage
|
||||
id="SaleDetailsPanel.saleRequestedStatus"
|
||||
id="SaleDetailsPanel.saleRequestedInfo"
|
||||
values={
|
||||
Object {
|
||||
"customerName": "customer1 display name",
|
||||
|
|
|
|||
|
|
@ -73,7 +73,11 @@ const txState = (intl, tx, isOrder) => {
|
|||
id: 'InboxPage.stateCanceled',
|
||||
}),
|
||||
};
|
||||
} else if (propTypes.txIsDelivered(tx)) {
|
||||
} else if (
|
||||
propTypes.txIsDelivered(tx) ||
|
||||
propTypes.txHasFirstReview(tx) ||
|
||||
propTypes.txIsReviewed(tx)
|
||||
) {
|
||||
return {
|
||||
nameClassName: css.nameDelivered,
|
||||
bookingClassName: css.bookingDelivered,
|
||||
|
|
|
|||
|
|
@ -284,14 +284,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.",
|
||||
|
|
@ -459,18 +458,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",
|
||||
|
|
|
|||
|
|
@ -220,12 +220,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