mirror of
https://github.com/sudoxnym/habitica.git
synced 2026-07-21 19:24:15 +00:00
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:
parent
300c2bb0a8
commit
4f70a6fbf4
1 changed files with 7 additions and 12 deletions
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Reference in a new issue