From 014d50257fd72af56f552dd548ead6f33f2acd93 Mon Sep 17 00:00:00 2001 From: Vesa Luusua Date: Thu, 6 Jul 2017 20:03:42 +0300 Subject: [PATCH 1/2] Revert "Revert "Review changes"" --- .../BookingBreakdown/BookingBreakdown.js | 21 +++++++++++++++++-- .../AuthenticationPage/AuthenticationPage.css | 11 +++++++++- .../AuthenticationPage/AuthenticationPage.js | 10 +++------ .../PayoutDetailsForm/PayoutDetailsForm.js | 2 +- .../StripePaymentForm/StripePaymentForm.js | 3 +++ src/translations/en.json | 2 ++ 6 files changed, 38 insertions(+), 11 deletions(-) diff --git a/src/components/BookingBreakdown/BookingBreakdown.js b/src/components/BookingBreakdown/BookingBreakdown.js index 4f30bdfb..80fe79b8 100644 --- a/src/components/BookingBreakdown/BookingBreakdown.js +++ b/src/components/BookingBreakdown/BookingBreakdown.js @@ -73,13 +73,26 @@ export const BookingBreakdownComponent = props => { const formattedUnitPrice = intl.formatNumber(unitPriceAsNumber, currencyConfig); // If commission is passed it will be shown as a fee already reduces from the total price + let subTotalInfo = null; let commissionInfo = null; if (userRole === 'provider') { + const subTotal = new Decimal(nightCount).times(unitPriceAsNumber); + const formattedSubTotal = intl.formatNumber(subTotal, currencyConfig); + + subTotalInfo = ( +
+ + + + {formattedSubTotal} +
+ ); + const commission = providerCommission.lineTotal; const commissionAsNumber = commission ? convertMoneyToNumber(commission, subUnitDivisor) : 0; const formattedCommission = commission - ? intl.formatNumber(new Decimal(commissionAsNumber).negated().toNumber(), currencyConfig) + ? intl.formatNumber(new Decimal(commissionAsNumber).toNumber(), currencyConfig) : null; commissionInfo = ( @@ -114,11 +127,15 @@ export const BookingBreakdownComponent = props => { {nightCountMessage} + {subTotalInfo} {commissionInfo}
- + {userRole === 'customer' + ? + : + }
{formattedTotalPrice} diff --git a/src/containers/AuthenticationPage/AuthenticationPage.css b/src/containers/AuthenticationPage/AuthenticationPage.css index d7ef0962..bbd3400d 100644 --- a/src/containers/AuthenticationPage/AuthenticationPage.css +++ b/src/containers/AuthenticationPage/AuthenticationPage.css @@ -4,7 +4,16 @@ display: flex; flex-direction: column; flex: 1; - padding: 35px 24px 98px 24px; + padding: 30px 24px 98px 24px; +} + +.tabs { + width: 198px; +} + +.tab { + margin-top: 0; + margin-bottom: 0; } .form { diff --git a/src/containers/AuthenticationPage/AuthenticationPage.js b/src/containers/AuthenticationPage/AuthenticationPage.js index 3cc74842..b2909825 100644 --- a/src/containers/AuthenticationPage/AuthenticationPage.js +++ b/src/containers/AuthenticationPage/AuthenticationPage.js @@ -79,9 +79,7 @@ export const AuthenticationPageComponent = props => { const tabs = [ { - text: intl.formatMessage({ - id: 'AuthenticationPage.signupLinkText', - }), + text:

, selected: !isLogin, linkProps: { name: 'SignupPage', @@ -89,9 +87,7 @@ export const AuthenticationPageComponent = props => { }, }, { - text: intl.formatMessage({ - id: 'AuthenticationPage.loginLinkText', - }), + text:

, selected: isLogin, linkProps: { name: 'LoginPage', @@ -104,7 +100,7 @@ export const AuthenticationPageComponent = props => {
- + {loginError ? loginErrorMessage : null} {signupError ? signupErrorMessage : null} {isLogin diff --git a/src/containers/PayoutDetailsForm/PayoutDetailsForm.js b/src/containers/PayoutDetailsForm/PayoutDetailsForm.js index be1c88a5..80f0db97 100644 --- a/src/containers/PayoutDetailsForm/PayoutDetailsForm.js +++ b/src/containers/PayoutDetailsForm/PayoutDetailsForm.js @@ -217,7 +217,7 @@ const PayoutDetailsFormComponent = props => { {supportedCountries.map(c => ( ))} diff --git a/src/containers/StripePaymentForm/StripePaymentForm.js b/src/containers/StripePaymentForm/StripePaymentForm.js index 0cecc81c..0ec06216 100644 --- a/src/containers/StripePaymentForm/StripePaymentForm.js +++ b/src/containers/StripePaymentForm/StripePaymentForm.js @@ -60,6 +60,9 @@ const cardStyles = { lineHeight: '24px', letterSpacing: '-0.1px', color: '#4A4A4A', + '::placeholder': { + color: '#B2B2B2', + }, }, }; diff --git a/src/translations/en.json b/src/translations/en.json index 4d75782b..e9ca5ecd 100644 --- a/src/translations/en.json +++ b/src/translations/en.json @@ -13,6 +13,8 @@ "BookingBreakdown.commission": "Saunatime fee:", "BookingBreakdown.nightCount": "× {count, number} {count, plural, one {night} other {nights}}", "BookingBreakdown.pricePerNight": "Price per night", + "BookingBreakdown.providerTotal":"Happy days! You just made…", + "BookingBreakdown.subTotal": "Subtotal:", "BookingBreakdown.total": "Total price", "BookingDatesForm.bookingEndTitle": "End date", "BookingDatesForm.bookingStartTitle": "Start date", From 20962c7c0ffac8a38a835b032e73a48a8ebbb064 Mon Sep 17 00:00:00 2001 From: Vesa Luusua Date: Thu, 6 Jul 2017 20:21:32 +0300 Subject: [PATCH 2/2] Update snapshots and run prettier --- .../BookingBreakdown/BookingBreakdown.js | 5 ++--- .../__snapshots__/BookingBreakdown.test.js.snap | 17 +++++++++++++++-- .../AuthenticationPage/AuthenticationPage.js | 4 +++- .../AuthenticationPage.test.js.snap | 12 ++++++++++-- .../StripePaymentForm/StripePaymentForm.js | 2 +- 5 files changed, 31 insertions(+), 9 deletions(-) diff --git a/src/components/BookingBreakdown/BookingBreakdown.js b/src/components/BookingBreakdown/BookingBreakdown.js index 80fe79b8..5066b009 100644 --- a/src/components/BookingBreakdown/BookingBreakdown.js +++ b/src/components/BookingBreakdown/BookingBreakdown.js @@ -77,7 +77,7 @@ export const BookingBreakdownComponent = props => { let commissionInfo = null; if (userRole === 'provider') { - const subTotal = new Decimal(nightCount).times(unitPriceAsNumber); + const subTotal = new Decimal(nightCount).times(unitPriceAsNumber).toNumber(); const formattedSubTotal = intl.formatNumber(subTotal, currencyConfig); subTotalInfo = ( @@ -134,8 +134,7 @@ export const BookingBreakdownComponent = props => {
{userRole === 'customer' ? - : - } + : }
{formattedTotalPrice} diff --git a/src/components/BookingBreakdown/__snapshots__/BookingBreakdown.test.js.snap b/src/components/BookingBreakdown/__snapshots__/BookingBreakdown.test.js.snap index 737fbcc0..51cfedc4 100644 --- a/src/components/BookingBreakdown/__snapshots__/BookingBreakdown.test.js.snap +++ b/src/components/BookingBreakdown/__snapshots__/BookingBreakdown.test.js.snap @@ -160,6 +160,19 @@ exports[`BookingBreakdown provider transaction data matches snapshot 1`] = ` } />
+
+ + + Subtotal: + + + + 20 + +
- 2 + -2

- Total price + Happy days! You just made…
{ const tabs = [ { - text:

, + text: ( +

+ ), selected: !isLogin, linkProps: { name: 'SignupPage', diff --git a/src/containers/AuthenticationPage/__snapshots__/AuthenticationPage.test.js.snap b/src/containers/AuthenticationPage/__snapshots__/AuthenticationPage.test.js.snap index 31486bf8..225dee2c 100644 --- a/src/containers/AuthenticationPage/__snapshots__/AuthenticationPage.test.js.snap +++ b/src/containers/AuthenticationPage/__snapshots__/AuthenticationPage.test.js.snap @@ -31,7 +31,11 @@ exports[`AuthenticationPageComponent matches snapshot 1`] = ` }, }, "selected": false, - "text": "AuthenticationPage.signupLinkText", + "text":

+ +

, }, Object { "linkProps": Object { @@ -43,7 +47,11 @@ exports[`AuthenticationPageComponent matches snapshot 1`] = ` }, }, "selected": true, - "text": "AuthenticationPage.loginLinkText", + "text":

+ +

, }, ] } /> diff --git a/src/containers/StripePaymentForm/StripePaymentForm.js b/src/containers/StripePaymentForm/StripePaymentForm.js index 0ec06216..2b163164 100644 --- a/src/containers/StripePaymentForm/StripePaymentForm.js +++ b/src/containers/StripePaymentForm/StripePaymentForm.js @@ -49,7 +49,7 @@ const stripeElementsOptions = { weight: 500, src: 'local("sofiapro"), local("SofiaPro"), local("Sofia Pro"), url("https://assets-sharetribecom.sharetribe.com/webfonts/sofiapro/sofiapro-medium-webfont.woff2") format("woff2")', }, - ] + ], }; const cardStyles = {