Align card links with price sources
This commit is contained in:
File diff suppressed because one or more lines are too long
2
client/dist/index.html
vendored
2
client/dist/index.html
vendored
@@ -4,7 +4,7 @@
|
|||||||
<meta charset="UTF-8" />
|
<meta charset="UTF-8" />
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||||
<title>Cabo Bachelor Party</title>
|
<title>Cabo Bachelor Party</title>
|
||||||
<script type="module" crossorigin src="/assets/index-P6j6uqrQ.js"></script>
|
<script type="module" crossorigin src="/assets/index-CY3ZP8YS.js"></script>
|
||||||
<link rel="stylesheet" crossorigin href="/assets/index-B5xoFPr6.css">
|
<link rel="stylesheet" crossorigin href="/assets/index-B5xoFPr6.css">
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
|
|||||||
@@ -82,10 +82,10 @@ function cx(...classes) {
|
|||||||
return classes.filter(Boolean).join(' ')
|
return classes.filter(Boolean).join(' ')
|
||||||
}
|
}
|
||||||
|
|
||||||
function getOptionImageUrl(option) {
|
function getOptionImageUrl(option, bookingUrl) {
|
||||||
if (option.imageUrl) return option.imageUrl
|
const sourceUrl = bookingUrl || option.bookingUrl || option.url || option.links?.[0]?.url || ''
|
||||||
const bookingUrl = option.bookingUrl || option.url || option.links?.[0]?.url || ''
|
if (sourceUrl) return `/api/preview-image?url=${encodeURIComponent(sourceUrl)}`
|
||||||
return bookingUrl ? `/api/preview-image?url=${encodeURIComponent(bookingUrl)}` : ''
|
return option.imageUrl || ''
|
||||||
}
|
}
|
||||||
|
|
||||||
function useCaboData() {
|
function useCaboData() {
|
||||||
@@ -443,7 +443,7 @@ function OptionCard({ option, tabId, guest, token, send }) {
|
|||||||
const latestPoint = getLatestPoint(option, tabId)
|
const latestPoint = getLatestPoint(option, tabId)
|
||||||
const source = getAvailableSources(option, tabId)[0]
|
const source = getAvailableSources(option, tabId)[0]
|
||||||
const bookingUrl = getBookingUrl(option, tabId)
|
const bookingUrl = getBookingUrl(option, tabId)
|
||||||
const imageUrl = getOptionImageUrl({ ...option, bookingUrl })
|
const imageUrl = getOptionImageUrl(option, bookingUrl)
|
||||||
const links = getVisibleLinks(option, tabId)
|
const links = getVisibleLinks(option, tabId)
|
||||||
const price = latestPoint?.displayPrice || (typeof latestPoint?.price === 'number' ? formatMoney(latestPoint.price, latestPoint.currency) : source?.latestDisplayPrice || '')
|
const price = latestPoint?.displayPrice || (typeof latestPoint?.price === 'number' ? formatMoney(latestPoint.price, latestPoint.currency) : source?.latestDisplayPrice || '')
|
||||||
const dates = [formatDate(latestPoint?.tripCheckIn), formatDate(latestPoint?.tripCheckOut)].filter(Boolean).join(' to ')
|
const dates = [formatDate(latestPoint?.tripCheckIn), formatDate(latestPoint?.tripCheckOut)].filter(Boolean).join(' to ')
|
||||||
@@ -498,7 +498,7 @@ function OptionCard({ option, tabId, guest, token, send }) {
|
|||||||
<div className="mt-4 flex flex-wrap gap-2">
|
<div className="mt-4 flex flex-wrap gap-2">
|
||||||
{bookingUrl && (
|
{bookingUrl && (
|
||||||
<a href={bookingUrl} target="_blank" rel="noreferrer" className="rounded-full border border-gold/40 bg-gold/10 px-3 py-2 text-xs font-black text-amber-100 hover:bg-gold/20">
|
<a href={bookingUrl} target="_blank" rel="noreferrer" className="rounded-full border border-gold/40 bg-gold/10 px-3 py-2 text-xs font-black text-amber-100 hover:bg-gold/20">
|
||||||
Book / quote
|
Open {source?.sourceLabel || 'booking'} quote
|
||||||
</a>
|
</a>
|
||||||
)}
|
)}
|
||||||
{links.slice(0, 4).map((link) => (
|
{links.slice(0, 4).map((link) => (
|
||||||
|
|||||||
@@ -623,7 +623,7 @@ function buildPriceHistoryBySource(priceHistory) {
|
|||||||
return {
|
return {
|
||||||
sourceKey: bucket.sourceKey,
|
sourceKey: bucket.sourceKey,
|
||||||
sourceLabel: bucket.sourceLabel,
|
sourceLabel: bucket.sourceLabel,
|
||||||
sourceUrl: bucket.sourceUrl,
|
sourceUrl: latestPoint?.sourceUrl || bucket.sourceUrl,
|
||||||
bookingType: latestPoint?.bookingType || null,
|
bookingType: latestPoint?.bookingType || null,
|
||||||
priceBasis: latestPoint?.priceBasis || null,
|
priceBasis: latestPoint?.priceBasis || null,
|
||||||
pointCount: bucket.points.length,
|
pointCount: bucket.points.length,
|
||||||
|
|||||||
Reference in New Issue
Block a user