now grouping the stable A-Z sortBy option by first letter so that Show More functionality works like the other sort types (#14304)

This commit is contained in:
Adam Fitzgibbon 2022-11-18 14:44:58 -08:00 committed by GitHub
parent 300c2bb0a8
commit 4f70a6fbf4
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -787,18 +787,15 @@ export default {
if (sortBy === 'sortByColor') {
groupKey = 'potionKey';
} else if (sortBy === 'AZ') {
groupKey = '';
groupKey = i => i.eggName[0];
} else if (sortBy === 'sortByHatchable') {
groupKey = i => (i.isHatchable() ? 0 : 1);
}
const groupedPets = groupBy(pets, groupKey);
// Pets are rendered as grouped "rows". Count helps decide if show more button is necessary.
if (sortBy === 'AZ') {
this.petRowCount[animalGroup.key] = 1;
} else {
this.petRowCount[animalGroup.key] = Object.keys(groupedPets).length;
}
this.petRowCount[animalGroup.key] = Object.keys(groupedPets).length;
return groupedPets;
},
mounts (animalGroup, hideMissing, sortBy, searchText) {
@ -814,14 +811,12 @@ export default {
if (sortBy === 'sortByColor') {
groupKey = 'potionKey';
} else if (sortBy === 'AZ') {
groupKey = '';
groupKey = i => i.eggName[0];
}
const groupedMounts = groupBy(mounts, groupKey);
if (sortBy === 'AZ') {
this.mountRowCount[animalGroup.key] = 1;
} else {
this.mountRowCount[animalGroup.key] = Object.keys(groupedMounts).length;
}
this.mountRowCount[animalGroup.key] = Object.keys(groupedMounts).length;
return groupedMounts;
},
// Actions