Align card links with price sources

This commit is contained in:
TopherMayor
2026-06-12 11:19:05 -07:00
parent 4cce703544
commit ecf1859821
4 changed files with 9 additions and 9 deletions

File diff suppressed because one or more lines are too long

View File

@@ -4,7 +4,7 @@
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<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">
</head>
<body>

View File

@@ -82,10 +82,10 @@ function cx(...classes) {
return classes.filter(Boolean).join(' ')
}
function getOptionImageUrl(option) {
if (option.imageUrl) return option.imageUrl
const bookingUrl = option.bookingUrl || option.url || option.links?.[0]?.url || ''
return bookingUrl ? `/api/preview-image?url=${encodeURIComponent(bookingUrl)}` : ''
function getOptionImageUrl(option, bookingUrl) {
const sourceUrl = bookingUrl || option.bookingUrl || option.url || option.links?.[0]?.url || ''
if (sourceUrl) return `/api/preview-image?url=${encodeURIComponent(sourceUrl)}`
return option.imageUrl || ''
}
function useCaboData() {
@@ -443,7 +443,7 @@ function OptionCard({ option, tabId, guest, token, send }) {
const latestPoint = getLatestPoint(option, tabId)
const source = getAvailableSources(option, tabId)[0]
const bookingUrl = getBookingUrl(option, tabId)
const imageUrl = getOptionImageUrl({ ...option, bookingUrl })
const imageUrl = getOptionImageUrl(option, bookingUrl)
const links = getVisibleLinks(option, tabId)
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 ')
@@ -498,7 +498,7 @@ function OptionCard({ option, tabId, guest, token, send }) {
<div className="mt-4 flex flex-wrap gap-2">
{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">
Book / quote
Open {source?.sourceLabel || 'booking'} quote
</a>
)}
{links.slice(0, 4).map((link) => (

View File

@@ -623,7 +623,7 @@ function buildPriceHistoryBySource(priceHistory) {
return {
sourceKey: bucket.sourceKey,
sourceLabel: bucket.sourceLabel,
sourceUrl: bucket.sourceUrl,
sourceUrl: latestPoint?.sourceUrl || bucket.sourceUrl,
bookingType: latestPoint?.bookingType || null,
priceBasis: latestPoint?.priceBasis || null,
pointCount: bucket.points.length,