mirror of
https://github.com/kingomarnajjar/flex-template-web.git
synced 2026-07-30 18:16:48 +10:00
Hide edit listing link
This commit is contained in:
parent
00224c34f2
commit
a679c946eb
2 changed files with 9 additions and 12 deletions
|
|
@ -1,5 +1,5 @@
|
|||
import React, { Component, PropTypes } from 'react';
|
||||
import { FormattedMessage, intlShape, injectIntl } from 'react-intl';
|
||||
import { intlShape, injectIntl } from 'react-intl';
|
||||
import { connect } from 'react-redux';
|
||||
import { withRouter } from 'react-router-dom';
|
||||
import { union, without } from 'lodash';
|
||||
|
|
@ -9,7 +9,7 @@ import { types } from '../../util/sdkLoader';
|
|||
import { createSlug } from '../../util/urlHelpers';
|
||||
import { convertMoneyToNumber } from '../../util/currency';
|
||||
import { createResourceLocatorString, findRouteByRouteName } from '../../util/routes';
|
||||
import { Button, Map, ModalInMobile, PageLayout, NamedLink } from '../../components';
|
||||
import { Button, Map, ModalInMobile, PageLayout } from '../../components';
|
||||
import { BookingDatesForm } from '../../containers';
|
||||
import { getListingsById } from '../../ducks/sdk.duck';
|
||||
import { showListing } from './ListingPage.duck';
|
||||
|
|
@ -130,10 +130,10 @@ export class ListingPageComponent extends Component {
|
|||
</div>
|
||||
: null;
|
||||
|
||||
const isOwnListing = currentUser &&
|
||||
currentListing &&
|
||||
currentListing.author &&
|
||||
const userAndListingAuthorAvailable = currentUser && currentListing && currentListing.author;
|
||||
const isOwnListing = userAndListingAuthorAvailable &&
|
||||
currentListing.author.id.uuid === currentUser.id.uuid;
|
||||
const showBookButton = !isOwnListing;
|
||||
|
||||
const pageContent = (
|
||||
<PageLayout title={`${title} ${formattedPrice}`} className={this.state.pageClassNames}>
|
||||
|
|
@ -156,15 +156,13 @@ export class ListingPageComponent extends Component {
|
|||
<BookingDatesForm className={css.bookingForm} onSubmit={this.onSubmit} price={price} />
|
||||
</ModalInMobile>
|
||||
{map ? <div className={css.map}>{map}</div> : null}
|
||||
{isOwnListing
|
||||
? <NamedLink className={css.editListing} name="EditListingPage" params={params}>
|
||||
<FormattedMessage id="ListingPage.editListing" />
|
||||
</NamedLink>
|
||||
: <div className={css.openBookingForm}>
|
||||
{showBookButton
|
||||
? <div className={css.openBookingForm}>
|
||||
<Button onClick={() => this.setState({ isBookingModalOpenOnMobile: true })}>
|
||||
{bookBtnMessage}
|
||||
</Button>
|
||||
</div>}
|
||||
</div>
|
||||
: null}
|
||||
</div>
|
||||
</PageLayout>
|
||||
);
|
||||
|
|
|
|||
|
|
@ -54,7 +54,6 @@
|
|||
"InboxPage.stateRejected": "Rejected",
|
||||
"InboxPage.title": "Inbox",
|
||||
"ListingPage.ctaButtonMessage": "Book {title}",
|
||||
"ListingPage.editListing": "Edit listing",
|
||||
"ListingPage.loadingListingData": "Loading listing data",
|
||||
"ListingPage.noListingData": "Could not find listing data",
|
||||
"LoginForm.emailLabel": "Email",
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue