Skip to content

Commit

Permalink
Merge pull request #43 from sharetribe/edit-profile-page
Browse files Browse the repository at this point in the history
Remove listings section from profile page
  • Loading branch information
OtterleyW authored Nov 14, 2019
2 parents dbe10b4 + 132cfd4 commit 46e6221
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 41 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ https://github.com/sharetribe/flex-template-web/

## Upcoming version 2019-XX-XX

- [change] Remove listings section from `ProfilePage`.
[#43](https://github.com/sharetribe/ftw-time/pull/43)
- [fix] Fix proptype checks for FieldDateAndTimeInput and FieldDateInput.
[#39](https://github.com/sharetribe/ftw-time/pull/39)
- [fix] Fix same date detection on TimeRange component.
Expand Down
43 changes: 2 additions & 41 deletions src/containers/ProfilePage/ProfilePage.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import PropTypes from 'prop-types';
import { FormattedMessage, injectIntl, intlShape } from '../../util/reactIntl';
import { compose } from 'redux';
import { connect } from 'react-redux';
import classNames from 'classnames';
import { types as sdkTypes } from '../../util/sdkLoader';
import { REVIEW_TYPE_OF_PROVIDER, REVIEW_TYPE_OF_CUSTOMER, propTypes } from '../../util/types';
import { ensureCurrentUser, ensureUser } from '../../util/data';
Expand All @@ -20,7 +19,6 @@ import {
Footer,
AvatarLarge,
NamedLink,
ListingCard,
Reviews,
ButtonTabNavHorizontal,
} from '../../components';
Expand Down Expand Up @@ -64,8 +62,6 @@ export class ProfilePageComponent extends Component {
currentUser,
user,
userShowError,
queryListingsError,
listings,
reviews,
queryReviewsError,
viewport,
Expand All @@ -78,7 +74,6 @@ export class ProfilePageComponent extends Component {
const displayName = profileUser.attributes.profile.displayName;
const bio = profileUser.attributes.profile.bio;
const hasBio = !!bio;
const hasListings = listings.length > 0;
const isMobileLayout = viewport.width < MAX_MOBILE_SCREEN_WIDTH;

const editLinkMobile = isCurrentUser ? (
Expand All @@ -105,10 +100,6 @@ export class ProfilePageComponent extends Component {
</div>
);

const listingsContainerClasses = classNames(css.listingsContainer, {
[css.withBioMissingAbove]: !hasBio,
});

const reviewsError = (
<p className={css.error}>
<FormattedMessage id="ProfilePage.loadingReviewsFailed" />
Expand Down Expand Up @@ -187,23 +178,6 @@ export class ProfilePageComponent extends Component {
<FormattedMessage id="ProfilePage.desktopHeading" values={{ name: displayName }} />
</h1>
{hasBio ? <p className={css.bio}>{bio}</p> : null}
{hasListings ? (
<div className={listingsContainerClasses}>
<h2 className={css.listingsTitle}>
<FormattedMessage
id="ProfilePage.listingsTitle"
values={{ count: listings.length }}
/>
</h2>
<ul className={css.listings}>
{listings.map(l => (
<li className={css.listing} key={l.id.uuid}>
<ListingCard listing={l} />
</li>
))}
</ul>
</div>
) : null}
{isMobileLayout ? mobileReviews : desktopReviews}
</div>
);
Expand All @@ -212,7 +186,7 @@ export class ProfilePageComponent extends Component {

if (userShowError && userShowError.status === 404) {
return <NotFoundPage />;
} else if (userShowError || queryListingsError) {
} else if (userShowError) {
content = (
<p className={css.error}>
<FormattedMessage id="ProfilePage.loadingDataFailed" />
Expand Down Expand Up @@ -261,7 +235,6 @@ ProfilePageComponent.defaultProps = {
currentUser: null,
user: null,
userShowError: null,
queryListingsError: null,
reviews: [],
queryReviewsError: null,
};
Expand All @@ -273,8 +246,6 @@ ProfilePageComponent.propTypes = {
currentUser: propTypes.currentUser,
user: propTypes.user,
userShowError: propTypes.error,
queryListingsError: propTypes.error,
listings: arrayOf(propTypes.listing).isRequired,
reviews: arrayOf(propTypes.review),
queryReviewsError: propTypes.error,

Expand All @@ -290,24 +261,14 @@ ProfilePageComponent.propTypes = {

const mapStateToProps = state => {
const { currentUser } = state.user;
const {
userId,
userShowError,
queryListingsError,
userListingRefs,
reviews,
queryReviewsError,
} = state.ProfilePage;
const { userId, userShowError, reviews, queryReviewsError } = state.ProfilePage;
const userMatches = getMarketplaceEntities(state, [{ type: 'user', id: userId }]);
const user = userMatches.length === 1 ? userMatches[0] : null;
const listings = getMarketplaceEntities(state, userListingRefs);
return {
scrollingDisabled: isScrollingDisabled(state),
currentUser,
user,
userShowError,
queryListingsError,
listings,
reviews,
queryReviewsError,
};
Expand Down

0 comments on commit 46e6221

Please sign in to comment.