LGTM
This commit is contained in:
parent
9248e26af2
commit
f2a2651b8a
95 changed files with 3993 additions and 1471 deletions
|
|
@ -2,6 +2,7 @@ import { useMemo } from 'react';
|
|||
import { useTranslation } from 'react-i18next';
|
||||
import type { FeatureFilters } from '../../types';
|
||||
import {
|
||||
buildRightmoveExactPostcodeRedirectUrl,
|
||||
buildPropertySearchUrls,
|
||||
H3_RADIUS_MILES,
|
||||
type HexagonLocation,
|
||||
|
|
@ -30,6 +31,11 @@ export default function ExternalSearchLinks({
|
|||
() => buildPropertySearchUrls({ location, filters, rightmoveLocationId }),
|
||||
[location, filters, rightmoveLocationId]
|
||||
);
|
||||
const rightmoveHref = useMemo(() => {
|
||||
if (!urls?.rightmove) return null;
|
||||
if (!location.isPostcode || !location.postcode) return urls.rightmove;
|
||||
return buildRightmoveExactPostcodeRedirectUrl(location.postcode, urls.rightmove);
|
||||
}, [location.isPostcode, location.postcode, urls?.rightmove]);
|
||||
const radiusMiles = location.isPostcode ? 0 : (H3_RADIUS_MILES[location.resolution] ?? 1);
|
||||
const label = radiusMiles === 0 ? t('externalSearch.exact') : `${radiusMiles}mi radius`;
|
||||
|
||||
|
|
@ -46,8 +52,8 @@ export default function ExternalSearchLinks({
|
|||
{t('externalSearch.searchOn', { radius: label })}
|
||||
</h3>
|
||||
<div className="flex flex-wrap gap-2">
|
||||
{urls.rightmove ? (
|
||||
<a href={urls.rightmove} target="_blank" rel="noopener noreferrer" className={linkClass}>
|
||||
{rightmoveHref ? (
|
||||
<a href={rightmoveHref} target="_blank" rel="noopener noreferrer" className={linkClass}>
|
||||
Rightmove
|
||||
</a>
|
||||
) : (
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue