ComparisonTable: unverified providers show 'Unknown', not em-dash
Absence of data means different things for verified vs unverified: - Verified providers itemise everything; a missing Optional/Extra is an explicit "Not Included" and a missing Essential is an (unlikely) gap. - Unverified providers have scraped/estimated data; a missing cell just means "we don't know." Route the two via `pkg.provider.verified` in lookupValue — unverified packages now render missing cells as the existing "Unknown" + info-icon treatment (already used by explicit `type: 'unknown'` cells). Verified paths unchanged. Drop the "Some providers have not provided an itemised pricing breakdown" footer — the "Unknown" treatment is self-explanatory, and the disclaimer was tied to the em-dash convention that no longer applies. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -346,7 +346,7 @@ export const MixedVerified: Story = {
|
|||||||
|
|
||||||
// --- Missing Itemised Data ---------------------------------------------------
|
// --- Missing Itemised Data ---------------------------------------------------
|
||||||
|
|
||||||
/** One provider has no itemised breakdown — cells show "—" */
|
/** One provider has no itemised breakdown — unverified cells show "Unknown" */
|
||||||
export const MissingData: Story = {
|
export const MissingData: Story = {
|
||||||
args: {
|
args: {
|
||||||
packages: [pkgWollongong, pkgNoItemised, pkgMackay],
|
packages: [pkgWollongong, pkgNoItemised, pkgMackay],
|
||||||
|
|||||||
@@ -226,11 +226,20 @@ function lookupValue(
|
|||||||
sectionHeading: string,
|
sectionHeading: string,
|
||||||
itemName: string,
|
itemName: string,
|
||||||
): ComparisonCellValue {
|
): ComparisonCellValue {
|
||||||
if (pkg.itemizedAvailable === false) return { type: 'unavailable' };
|
// For unverified providers, absence means "we don't know" — data is
|
||||||
|
// scraped/estimated. For verified providers, absence means the package
|
||||||
|
// explicitly doesn't include this item (→ "Not Included" in Optionals/
|
||||||
|
// Extras; em-dash in Essentials as a safety net — canonical-essentials
|
||||||
|
// rule says every verified package has all 9, so this path shouldn't
|
||||||
|
// fire in practice).
|
||||||
|
const missing: ComparisonCellValue = pkg.provider.verified
|
||||||
|
? { type: 'unavailable' }
|
||||||
|
: { type: 'unknown' };
|
||||||
|
if (pkg.itemizedAvailable === false) return missing;
|
||||||
const section = pkg.sections.find((s) => s.heading === sectionHeading);
|
const section = pkg.sections.find((s) => s.heading === sectionHeading);
|
||||||
if (!section) return { type: 'unavailable' };
|
if (!section) return missing;
|
||||||
const item = section.items.find((i) => i.name === itemName);
|
const item = section.items.find((i) => i.name === itemName);
|
||||||
if (!item) return { type: 'unavailable' };
|
if (!item) return missing;
|
||||||
return item.value;
|
return item.value;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -493,13 +502,6 @@ export const ComparisonTable = React.forwardRef<HTMLDivElement, ComparisonTableP
|
|||||||
))}
|
))}
|
||||||
</Box>
|
</Box>
|
||||||
))}
|
))}
|
||||||
|
|
||||||
{packages.some((p) => p.itemizedAvailable === false) && mergedSections.length > 0 && (
|
|
||||||
<Typography variant="caption" color="text.secondary" sx={{ fontStyle: 'italic' }}>
|
|
||||||
* Some providers have not provided an itemised pricing breakdown. Their items are shown
|
|
||||||
as "—" above.
|
|
||||||
</Typography>
|
|
||||||
)}
|
|
||||||
</Box>
|
</Box>
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
|
|||||||
Reference in New Issue
Block a user