Skip to content

Commit

Permalink
Add "Back to main list" link to bottom of listing page
Browse files Browse the repository at this point in the history
  • Loading branch information
DinerIsmail committed Dec 19, 2024
1 parent 5695c83 commit 7332f2d
Showing 1 changed file with 13 additions and 6 deletions.
19 changes: 13 additions & 6 deletions components/listing/Listing.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,9 @@ function Listing({ listing }) {
const goBack = useCallback(() => {
const referrer = document.referrer
if (referrer.includes('google') || referrer.includes('bing')) {
void router.push(`${PROTOCOL}://${subdomain}.${REMOTE_HOSTNAME}`)
router.push(`${PROTOCOL}://${subdomain}.${REMOTE_HOSTNAME}`)
} else {
router.back()
router.push('/')
}
}, [router, subdomain])

Expand Down Expand Up @@ -267,10 +267,6 @@ function Listing({ listing }) {
<Item
categoriesIndexes={categoriesIndexes}
dataItem={relatedListing}
handleClick={() => {
const individualListingLink = `${PROTOCOL}://${subdomain}.${REMOTE_HOSTNAME}/${relatedListing.slug}`
router.push(individualListingLink)
}}
key={relatedListing.id}
simplified
/>
Expand All @@ -280,6 +276,17 @@ function Listing({ listing }) {
</>
)}
</Box>

<Button
leftIcon={<HiArrowLeft />}
name="Back"
mb="1rem"
onClick={goBack}
variant="link"
color="gray.700"
>
Back to main list
</Button>
</Box>
<Box position="fixed" bottom="2rem" right="2rem" zIndex={10}>
<Link href={`${REMOTE_URL}/edit/${subdomain}/${listing.slug}`}>
Expand Down

0 comments on commit 7332f2d

Please sign in to comment.