From 6a4be0390ae9fc8ab81451e1b2783bfff39af5fb Mon Sep 17 00:00:00 2001 From: Matchu Date: Wed, 3 Feb 2021 01:47:39 -0800 Subject: [PATCH] Show a fallback face for valid face options Sometimes we just don't have the image! Don't let that stop people from clicking it tho! --- src/app/ItemPage.js | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/app/ItemPage.js b/src/app/ItemPage.js index 77a1b1d..2651d3a 100644 --- a/src/app/ItemPage.js +++ b/src/app/ItemPage.js @@ -841,12 +841,17 @@ function SpeciesFacesPicker({ const providedSpeciesFace = speciesFacesFromData.find( (f) => f.species.id === defaultSpeciesFace.speciesId ); - if (providedSpeciesFace && providedSpeciesFace.neopetsImageHash) { + if (providedSpeciesFace) { return { ...defaultSpeciesFace, colorId: selectedColorId, bodyId: providedSpeciesFace.body.id, - neopetsImageHash: providedSpeciesFace.neopetsImageHash, + // If this species/color pair exists, but without an image hash, then + // we want to provide a face so that it's enabled, but use the fallback + // image even though it's wrong, so that it looks like _something_. + neopetsImageHash: + providedSpeciesFace.neopetsImageHash || + defaultSpeciesFace.neopetsImageHash, }; } else { return defaultSpeciesFace;