Skip to content

Commit

Permalink
Add error message for time slot request errors
Browse files Browse the repository at this point in the history
  • Loading branch information
lyyder committed Aug 17, 2018
1 parent e64f0e7 commit 09991d2
Show file tree
Hide file tree
Showing 7 changed files with 25 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/containers/ListingPage/ListingPage.duck.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ const initialState = {
reviews: [],
fetchReviewsError: null,
timeSlots: null,
fetchTimesLotsError: null,
fetchTimeSlotsError: null,
sendEnquiryInProgress: false,
sendEnquiryError: null,
enquiryModalOpenForListingId: null,
Expand Down
2 changes: 2 additions & 0 deletions src/containers/ListingPage/ListingPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,7 @@ export class ListingPageComponent extends Component {
sendEnquiryInProgress,
sendEnquiryError,
timeSlots,
fetchTimeSlotsError,
categoriesConfig,
amenitiesConfig,
} = this.props;
Expand Down Expand Up @@ -479,6 +480,7 @@ export class ListingPageComponent extends Component {
handleMobileBookModalClose={handleMobileBookModalClose}
onManageDisableScrolling={onManageDisableScrolling}
timeSlots={timeSlots}
fetchTimeSlotsError={fetchTimeSlotsError}
/>
</div>
</div>
Expand Down
3 changes: 3 additions & 0 deletions src/containers/ListingPage/SectionBooking.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,10 @@ const SectionBooking = props => {
handleMobileBookModalClose,
onManageDisableScrolling,
timeSlots,
fetchTimeSlotsError,
} = props;
const showClosedListingHelpText = listing.id && isClosed;

return (
<div>
<ModalInMobile
Expand Down Expand Up @@ -70,6 +72,7 @@ const SectionBooking = props => {
price={price}
isOwnListing={isOwnListing}
timeSlots={timeSlots}
fetchTimeSlotsError={fetchTimeSlotsError}
/>
) : null}
</ModalInMobile>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -264,6 +264,7 @@ exports[`ListingPage matches snapshot 1`] = `
</div>
<SectionBooking
authorDisplayName="user-1 display name"
fetchTimeSlotsError={null}
formattedPrice={55}
handleBookButtonClick={[Function]}
handleBookingSubmit={[Function]}
Expand Down
10 changes: 10 additions & 0 deletions src/forms/BookingDatesForm/BookingDatesForm.css
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,16 @@
display: inline-block;
}

.timeSlotsError {
@apply --marketplaceH4FontStyles;
color: var(--failColor);
margin: 0 24px 12px 24px;

@media (--viewportMedium) {
margin: 0 0 12px 0;
}
}

.smallPrint {
@apply --marketplaceTinyFontStyles;
color: var(--matterColorAnti);
Expand Down
7 changes: 7 additions & 0 deletions src/forms/BookingDatesForm/BookingDatesForm.js
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ export class BookingDatesFormComponent extends Component {
unitType,
values,
timeSlots,
fetchTimeSlotsError,
} = fieldRenderProps;
const { startDate, endDate } = values && values.bookingDates ? values.bookingDates : {};

Expand All @@ -100,6 +101,11 @@ export class BookingDatesFormComponent extends Component {
const endDateErrorMessage = intl.formatMessage({
id: 'FieldDateRangeInput.invalidEndDate',
});
const timeSlotsError = fetchTimeSlotsError ? (
<p className={css.timeSlotsError}>
<FormattedMessage id="BookingDatesForm.timeSlotsError" />
</p>
) : null;

// This is the place to collect breakdown estimation data. See the
// EstimatedBreakdownMaybe component to change the calculations
Expand Down Expand Up @@ -148,6 +154,7 @@ export class BookingDatesFormComponent extends Component {

return (
<Form onSubmit={handleSubmit} className={classes}>
{timeSlotsError}
<FieldDateRangeInput
className={css.bookingDates}
name="bookingDates"
Expand Down
1 change: 1 addition & 0 deletions src/translations/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@
"BookingDatesForm.priceBreakdownTitle": "Booking breakdown",
"BookingDatesForm.requestToBook": "Request to book",
"BookingDatesForm.requiredDate": "Oops, make sure your date is correct!",
"BookingDatesForm.timeSlotsError": "Loading listing availability failed. Please refresh the page.",
"BookingDatesForm.youWontBeChargedInfo": "You won't be charged yet",
"CheckoutPage.bookingTimeNotAvailableMessage": "Unfortunately, the requested time is already booked.",
"CheckoutPage.errorlistingLinkText": "the sauna page",
Expand Down

0 comments on commit 09991d2

Please sign in to comment.