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!
This commit is contained in:
Emi Matchu 2021-02-03 01:47:39 -08:00
parent a293dc56b5
commit 6a4be0390a

View file

@ -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;