diff --git a/src/components/TransactionPanel/TransactionPanel.css b/src/components/TransactionPanel/TransactionPanel.css index f80a233a05..e1e8c44bb2 100644 --- a/src/components/TransactionPanel/TransactionPanel.css +++ b/src/components/TransactionPanel/TransactionPanel.css @@ -214,13 +214,12 @@ .detailCardSubtitle { @apply --marketplaceH5FontStyles; - color: var(--matterColorAnti); margin-top: 0; margin-bottom: 0; @media (--viewportLarge) { - margin-top: 1px; + margin-top: 9px; margin-bottom: 0; } } diff --git a/src/components/TransactionPanel/TransactionPanel.helpers.js b/src/components/TransactionPanel/TransactionPanel.helpers.js index 6dba6daf10..463b83b4c0 100644 --- a/src/components/TransactionPanel/TransactionPanel.helpers.js +++ b/src/components/TransactionPanel/TransactionPanel.helpers.js @@ -154,7 +154,7 @@ const createListingLink = (listing, label, searchParams = {}, className = '') => // Functional component as a helper to build detail card headings export const DetailCardHeadingsMaybe = props => { - const { authorDisplayName, transaction, transactionRole, listing, listingTitle } = props; + const { transaction, transactionRole, listing, listingTitle, subTitle } = props; const isCustomer = transactionRole === 'customer'; const canShowDetailCardHeadings = isCustomer && !txIsEnquired(transaction); @@ -162,9 +162,7 @@ export const DetailCardHeadingsMaybe = props => { return canShowDetailCardHeadings ? (

{listingTitle}

-

- -

+

{subTitle}

{ transactionRole, listing, listingTitle, + subTitle, provider, onManageDisableScrolling, timeSlots, @@ -200,6 +199,7 @@ export const BookingPanelMaybe = props => { listing={listing} handleBookingSubmit={() => console.log('submit')} title={listingTitle} + subTitle={subTitle} authorDisplayName={authorDisplayName} onManageDisableScrolling={onManageDisableScrolling} timeSlots={timeSlots} diff --git a/src/components/TransactionPanel/TransactionPanel.js b/src/components/TransactionPanel/TransactionPanel.js index 84989a6b80..8e736c2aa0 100644 --- a/src/components/TransactionPanel/TransactionPanel.js +++ b/src/components/TransactionPanel/TransactionPanel.js @@ -2,11 +2,13 @@ import React, { Component } from 'react'; import PropTypes from 'prop-types'; import { injectIntl, intlShape } from 'react-intl'; import classNames from 'classnames'; -import { txIsRequested, propTypes } from '../../util/types'; +import { txIsRequested, LINE_ITEM_NIGHT, LINE_ITEM_DAY, propTypes } from '../../util/types'; import { ensureListing, ensureTransaction, ensureUser } from '../../util/data'; import { isMobileSafari } from '../../util/userAgent'; +import { formatMoney } from '../../util/currency'; import { AvatarMedium, AvatarLarge, ResponsiveImage, ReviewModal } from '../../components'; import { SendMessageForm } from '../../forms'; +import config from '../../config'; // These are internal components that make this file more readable. import { @@ -164,6 +166,20 @@ export class TransactionPanelComponent extends Component { ? deletedListingTitle : currentListing.attributes.title; + const unitType = config.bookingUnitType; + const isNightly = unitType === LINE_ITEM_NIGHT; + const isDaily = unitType === LINE_ITEM_DAY; + + const unitTranslationKey = isNightly + ? 'TransactionPanel.perNight' + : isDaily + ? 'TransactionPanel.perDay' + : 'TransactionPanel.perUnit'; + + const price = currentListing.attributes.price; + const formattedPrice = formatMoney(intl, price); + const bookingSubTitle = `${formattedPrice} ${intl.formatMessage({ id: unitTranslationKey })}`; + const firstImage = currentListing.images && currentListing.images.length > 0 ? currentListing.images[0] : null; @@ -300,11 +316,11 @@ export class TransactionPanelComponent extends Component { ) : null}