import React from 'react'; import Box from '@mui/material/Box'; import Tooltip from '@mui/material/Tooltip'; import InfoOutlinedIcon from '@mui/icons-material/InfoOutlined'; import CheckCircleOutlineIcon from '@mui/icons-material/CheckCircleOutline'; import LocationOnOutlinedIcon from '@mui/icons-material/LocationOnOutlined'; import StarRoundedIcon from '@mui/icons-material/StarRounded'; import VerifiedOutlinedIcon from '@mui/icons-material/VerifiedOutlined'; import type { SxProps, Theme } from '@mui/material/styles'; import { Typography } from '../../atoms/Typography'; import { Button } from '../../atoms/Button'; import { Badge } from '../../atoms/Badge'; import { Divider } from '../../atoms/Divider'; import { Card } from '../../atoms/Card'; import type { ComparisonPackage, ComparisonCellValue } from '../../organisms/ComparisonTable'; // ─── Types ─────────────────────────────────────────────────────────────────── export interface ComparisonPackageCardProps { /** Package data to render — same shape used by ComparisonTable */ pkg: ComparisonPackage; /** Called when the user clicks the CTA (Make Arrangement / Make Enquiry) */ onArrange: (packageId: string) => void; /** MUI sx prop for container overrides */ sx?: SxProps; } // ─── Helpers ──────────────────────────────────────────────────────────────── function formatPrice(amount: number): string { return `$${amount.toLocaleString('en-AU', { minimumFractionDigits: amount % 1 !== 0 ? 2 : 0 })}`; } function CellValue({ value }: { value: ComparisonCellValue }) { switch (value.type) { case 'price': return ( {formatPrice(value.amount)} ); case 'allowance': return ( {formatPrice(value.amount)}* ); case 'complimentary': return ( Complimentary ); case 'included': return ( Included ); case 'poa': return ( Price On Application ); case 'unknown': return ( Unknown ); case 'unavailable': return ( ); } } // ─── Component ────────────────────────────────────────────────────────────── /** * Mobile package card for the ComparisonPage mobile tab panel view. * * Full-width card with provider header (verified badge, name, location, rating, * package name, price, CTA) and the package's itemised sections below. Used as * the content of each mobile tabpanel — one card visible at a time, selected * via the tab rail. * * Shared by ComparisonPage (V2) and ComparisonPageV1 so that card-level tweaks * land in a single file. */ export const ComparisonPackageCard = React.forwardRef( ({ pkg, onArrange, sx }, ref) => { return ( {/* Recommended banner */} {pkg.isRecommended && ( Recommended )} {/* Provider header */} {/* Verified badge */} {pkg.provider.verified && ( } sx={{ mb: 1 }} > Verified )} {/* Provider name */} {pkg.provider.name} {/* Location + Rating */} {pkg.provider.location} {pkg.provider.rating != null && ( {pkg.provider.rating} {pkg.provider.reviewCount != null && ` (${pkg.provider.reviewCount})`} )} {/* Package name + price */} {pkg.name} Total package price {formatPrice(pkg.price)} {/* Sections — with left accent borders on headings */} {pkg.itemizedAvailable === false ? ( Itemised pricing not available for this provider. ) : ( pkg.sections.map((section, sIdx) => ( {/* Section heading with left accent */} 0 ? 1 : 0, }} > {section.heading} {section.items.map((item) => ( {item.name} {item.info && ( {'\u00A0'} )} ))} )) )} ); }, ); ComparisonPackageCard.displayName = 'ComparisonPackageCard'; export default ComparisonPackageCard;