Skip to content

Commit

Permalink
Merge pull request #515 from sharetribe/fix-in-page-anchor-for-Listin…
Browse files Browse the repository at this point in the history
…gPageVariant

ListingPageVariant: the #author anchor was pointing to ListingPage.
  • Loading branch information
Gnito authored Dec 9, 2024
2 parents 1ddd04e + c149696 commit 94a4fa4
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 4 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ way to update this template, but currently, we follow a pattern:

## Upcoming version 2024-XX-XX

- [fix] ListingPageVariant: the #author anchor was not pointing to ListingPageVariant.
[#515](https://github.com/sharetribe/web-template/pull/515)
- [fix] target element didn't seem to work well with scroll-margin.
[#513](https://github.com/sharetribe/web-template/pull/513)
- [change] Require account type when creating a Stripe account
Expand Down
5 changes: 3 additions & 2 deletions src/containers/ListingPage/ListingPageCarousel.js
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,7 @@ export const ListingPageComponent = props => {

const listingConfig = config.listing;
const listingId = new UUID(rawParams.id);
const isVariant = rawParams.variant != null;
const isPendingApprovalVariant = rawParams.variant === LISTING_PAGE_PENDING_APPROVAL_VARIANT;
const isDraftVariant = rawParams.variant === LISTING_PAGE_DRAFT_VARIANT;
const currentListing =
Expand Down Expand Up @@ -384,7 +385,7 @@ export const ListingPageComponent = props => {
authorLink={
<NamedLink
className={css.authorNameLink}
name="ListingPage"
name={isVariant ? 'ListingPageVariant' : 'ListingPage'}
params={params}
to={{ hash: '#author' }}
>
Expand Down Expand Up @@ -493,7 +494,7 @@ const EnhancedListingPage = props => {
const location = useLocation();

const showListingError = props.showListingError;
const isVariant = props.params?.variant?.length > 0;
const isVariant = props.params?.variant != null;
const currentUser = props.currentUser;
if (isForbiddenError(showListingError) && !isVariant && !currentUser) {
// This can happen if private marketplace mode is active
Expand Down
5 changes: 3 additions & 2 deletions src/containers/ListingPage/ListingPageCoverPhoto.js
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,7 @@ export const ListingPageComponent = props => {

const listingConfig = config.listing;
const listingId = new UUID(rawParams.id);
const isVariant = rawParams.variant != null;
const isPendingApprovalVariant = rawParams.variant === LISTING_PAGE_PENDING_APPROVAL_VARIANT;
const isDraftVariant = rawParams.variant === LISTING_PAGE_DRAFT_VARIANT;
const currentListing =
Expand Down Expand Up @@ -381,7 +382,7 @@ export const ListingPageComponent = props => {
authorLink={
<NamedLink
className={css.authorNameLink}
name="ListingPage"
name={isVariant ? 'ListingPageVariant' : 'ListingPage'}
params={params}
to={{ hash: '#author' }}
>
Expand Down Expand Up @@ -490,7 +491,7 @@ const EnhancedListingPage = props => {
const location = useLocation();

const showListingError = props.showListingError;
const isVariant = props.params?.variant?.length > 0;
const isVariant = props.params?.variant != null;
const currentUser = props.currentUser;
if (isForbiddenError(showListingError) && !isVariant && !currentUser) {
// This can happen if private marketplace mode is active
Expand Down

0 comments on commit 94a4fa4

Please sign in to comment.