health score
This commit is contained in:
@@ -43,9 +43,29 @@ export function HealthScorePanel({ product }: { product: Product }) {
|
|||||||
retry: false,
|
retry: false,
|
||||||
});
|
});
|
||||||
|
|
||||||
// Nothing to look up. Not an error and not worth a line of chrome saying so:
|
/*
|
||||||
// most products in this catalogue were typed in or imported from a sheet.
|
* No catalogue link, so there is nothing to look up.
|
||||||
if (!brand || !imageId) return null;
|
*
|
||||||
|
* This used to render nothing at all, on the reasoning that most products
|
||||||
|
* here were typed in or imported from a sheet and a line of chrome on every
|
||||||
|
* one of them is noise. That was wrong in the way that matters: somebody who
|
||||||
|
* has been told the console shows health scores opens a product, sees no
|
||||||
|
* section whatsoever, and concludes the feature is broken. Silence and
|
||||||
|
* failure look identical.
|
||||||
|
*
|
||||||
|
* One quiet line costs a few pixels in a drawer and answers the question.
|
||||||
|
*/
|
||||||
|
if (!brand || !imageId) {
|
||||||
|
return (
|
||||||
|
<VStack gap={1}>
|
||||||
|
<Label />
|
||||||
|
<Text type="body" size="sm" color="secondary" style={{ lineHeight: 1.6 }}>
|
||||||
|
This product is not linked to the global catalogue, so there is no health score for it.
|
||||||
|
Products imported from the catalogue carry one.
|
||||||
|
</Text>
|
||||||
|
</VStack>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
if (query.isLoading) {
|
if (query.isLoading) {
|
||||||
return (
|
return (
|
||||||
@@ -60,7 +80,18 @@ export function HealthScorePanel({ product }: { product: Product }) {
|
|||||||
|
|
||||||
const shown = present(query.data ?? null);
|
const shown = present(query.data ?? null);
|
||||||
|
|
||||||
if (shown.isEmpty) return null;
|
// The service has never heard of this product — a different answer from
|
||||||
|
// "known but unscored", and said differently, for the same reason as above.
|
||||||
|
if (shown.isEmpty) {
|
||||||
|
return (
|
||||||
|
<VStack gap={1}>
|
||||||
|
<Label />
|
||||||
|
<Text type="body" size="sm" color="secondary" style={{ lineHeight: 1.6 }}>
|
||||||
|
No health score available for this product yet.
|
||||||
|
</Text>
|
||||||
|
</VStack>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
if (shown.isPending) {
|
if (shown.isPending) {
|
||||||
return (
|
return (
|
||||||
|
|||||||
Reference in New Issue
Block a user