PackagesStep: surface verified providers via 2-col MiniCard grid

The unverified-tier "similar packages" section previously rendered a list
of NearbyPackageCards — one per package. Swap to MiniCard, showing the
provider itself: image, verified badge, location, rating, "From $X".
2-col on sm+, 1-col on xs, capped at 4. Heading dropped "nearby" to
"Similar packages from verified providers".

Data shape renamed NearbyVerifiedPackage → NearbyVerifiedProvider;
`verified` is implicit (the section is verified-only by definition).
Callback renamed onNearbyPackageClick → onNearbyProviderClick, routing
directly on provider id. Demo fixture now derives the list from the
main providers fixture (filtered to verified + imageUrl).

NearbyPackageCard is now orphaned — kept in place pending registry
cleanup in a follow-up.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-04-23 13:32:06 +10:00
parent 4a0fcd0294
commit d2b648750f
5 changed files with 123 additions and 98 deletions

View File

@@ -1,10 +1,10 @@
import type { PackageData, NearbyVerifiedPackage } from '../../../components/pages/PackagesStep';
import type { PackageData, NearbyVerifiedProvider } from '../../../components/pages/PackagesStep';
import type { PackageSection, PackageLineItem } from '../../../components/organisms/PackageDetail';
import type {
ComparisonPackage,
ComparisonSection,
} from '../../../components/organisms/ComparisonTable';
import { providersById } from './providers';
import { providers, providersById } from './providers';
/**
* Packages live keyed by providerId. Each provider has TWO PackageData lists
@@ -876,33 +876,22 @@ export function resolveComparisonPackage(key: BasketKey): ComparisonPackage | nu
return bundle.forComparison.find((p) => p.id === parsed.packageId) ?? null;
}
/** "Nearby verified" cards shown under tier-3 / tier-2 lists. */
export const nearbyVerifiedSamples: NearbyVerifiedPackage[] = [
{
id: 'rankins:standard',
packageName: 'Standard Cremation Package',
price: rankinsForStep[0].price,
providerName: 'Rankins Funeral Services',
location: 'Wollongong, NSW',
rating: 4.8,
reviewCount: 23,
},
{
id: 'mannings:standard',
packageName: 'Standard Cremation Package',
price: manningsForStep[0].price,
providerName: 'Mannings Funerals',
location: 'Bega, NSW',
rating: 4.7,
reviewCount: 31,
},
{
id: 'killick:classic',
packageName: 'Classic Farewell Package',
price: killickForStep[0].price,
providerName: 'Killick Family Funerals',
location: 'Kingaroy, QLD',
rating: 4.9,
reviewCount: 15,
},
];
/**
* Verified providers surfaced under the "Similar packages from verified
* providers" grid on unverified tier-2 / tier-3 pages. Derived from the
* main `providers` fixture filtered to tier === 'verified', with
* `startingPrice` taken from their first matching package. Only providers
* that actually have an image in the fixture are eligible (MiniCard
* requires `imageUrl`).
*/
export const nearbyVerifiedProviders: NearbyVerifiedProvider[] = providers
.filter((p) => p.tier === 'verified' && p.imageUrl)
.map((p) => ({
id: p.id,
name: p.name,
imageUrl: p.imageUrl!,
location: p.location,
startingPrice: packagesByProvider[p.id]?.matching[0]?.price ?? p.startingPrice ?? 0,
rating: p.rating,
reviewCount: p.reviewCount,
}));