Skip to content

Commit cfd2ae6

Browse files
committed
Revert Eggs to default API chronological sort
1 parent a22bdae commit cfd2ae6

101 files changed

Lines changed: 393 additions & 2 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

example-web/react2/src/components/CollectionConfigIndex.tsx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -486,11 +486,13 @@ const CollectionConfigIndex: React.FC<CollectionConfigIndexProps> = () => {
486486
return true;
487487
});
488488

489-
if (collectionName === "Zones") {
489+
const numericallySortedCollections = new Set(["Zones", "Upgrades", "Achievements"]);
490+
491+
if (numericallySortedCollections.has(collectionName)) {
490492
finalItems.sort((a, b) => {
491493
const aId = parseInt(a.configName.split(" | ")[0], 10) || 0;
492494
const bId = parseInt(b.configName.split(" | ")[0], 10) || 0;
493-
return bId - aId; // Descending to show newest zones first
495+
return bId - aId; // Descending to show newest zones/eggs first
494496
});
495497
} else {
496498
finalItems.reverse();

example-web/react2/test.js

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
function getRouteId(collectionName, item) {
2+
const configName = item.configName;
3+
if (configName.includes(' | ')) {
4+
const parts = configName.split(' | ');
5+
if (collectionName !== 'Eggs' && collectionName !== 'Zones') {
6+
return parts[1];
7+
}
8+
if (collectionName === 'Zones') {
9+
return parts[0];
10+
}
11+
const cat = item.category || '';
12+
if (cat === 'Release' || cat.startsWith('World ') || cat.startsWith('Update ')) {
13+
return parts[0];
14+
}
15+
return parts[1];
16+
}
17+
if (collectionName === 'Worlds' && configName.startsWith('World ')) {
18+
return configName.replace('World ', '');
19+
}
20+
return configName;
21+
}
22+
console.log('Buffs Output:', getRouteId('Buffs', { configName: 'Buff | Ultra Pet Token Boost' }));
23+
console.log('Eggs Output:', getRouteId('Eggs', { configName: '8 | Present Egg', category: 'Event' }));

example-web/react2/test_bundle.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
const fs = require('fs');
2+
const bundle = fs.readFileSync('./dist/bundle.js', 'utf8');
3+
4+
const regex = /function[^{]+\(e,t\)\{.*?return.*?}/;
5+
// let's try to extract the getRouteId function logic to see what it does
6+
// Actually let's just grep for something very specific again

example-web/react2/tmp-www/125.bundle.js

Lines changed: 2 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

example-web/react2/tmp-www/13.bundle.js

Lines changed: 2 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

example-web/react2/tmp-www/144.bundle.js

Lines changed: 2 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

example-web/react2/tmp-www/176.bundle.js

Lines changed: 2 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

example-web/react2/tmp-www/178.bundle.js

Lines changed: 2 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

example-web/react2/tmp-www/240.bundle.js

Lines changed: 2 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)