Skip to content

Commit b343a4b

Browse files
Fixed sponsors' tiers resolving (axios#196)
* feat: add sponsor list generator; * feat: added deploy action; * fix: fixed layout; * fix: use utm links inside tooltips; * fix(CI): set engine version; * chore: reverted the start button title change; * fix: add the ability to retry the request to get a list of sponsors; * chore: change sponsors config & fix sponsor card layout; * chore: hide 'incognito' sponsor from the list of sponsors; * chore: add Route4Me sponsor; * chore: fixed resolution of utm link for manually added sponsors; * chore: fixed sponsors' tiers resolving;
1 parent ff09c54 commit b343a4b

File tree

2 files changed

+29
-4
lines changed

2 files changed

+29
-4
lines changed

data/sponsors.json

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,18 +5,32 @@
55
"scoreTierPriceFactor": 0.70,
66
"scoreTotalAmountFactor": 0.2,
77
"tiers": {
8-
"$49 a month": {
8+
"bronze": {
99
"price": 49,
1010
"benefits": {
1111
"showAtSponsorList": true
1212
}
1313
},
14-
"$99 a month" : {
14+
"silver" : {
1515
"price": 99,
1616
"benefits": {
1717
"showAtSponsorList": true,
1818
"showAtPages": true
1919
}
20+
},
21+
"gold" : {
22+
"price": 299,
23+
"benefits": {
24+
"showAtSponsorList": true,
25+
"showAtPages": true
26+
}
27+
},
28+
"platinum" : {
29+
"price": 599,
30+
"benefits": {
31+
"showAtSponsorList": true,
32+
"showAtPages": true
33+
}
2034
}
2135
},
2236
"sponsors": {

scripts/updateData.js

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -273,11 +273,12 @@ const processSponsors = async (sponsorsData, sponsorsConfig = './data/sponsors.j
273273
const averageMonthlyContribution = sponsor.totalAmountDonated / (monthsPassed || 1);
274274

275275
const {isActive} = sponsor;
276-
const tier = isActive && sponsor.tier;
277-
const hasActiveTier = tier && tier !== 'Backer';
276+
const tier = isActive && String(sponsor.tier || '').toLowerCase();
277+
const hasActiveTier = !!(tier && tier !== 'backer');
278278
const {price = 0, benefits = null} = tier && tiers[tier] || {};
279279

280280
sponsor.benefits = {
281+
// backers without active tier
281282
showAtSponsorList: sponsor.totalAmountDonated >= totalAmountDonatedThreshold && averageMonthlyContribution >= monthlyContributionThreshold,
282283
...benefits
283284
};
@@ -288,6 +289,16 @@ const processSponsors = async (sponsorsData, sponsorsConfig = './data/sponsors.j
288289
opacity: hasActiveTier ? 1 : Math.max(0.5, Math.min(1, creditLeft / disappearCredit)).toFixed(1)
289290
}
290291

292+
console.log(
293+
`Add sponsor badge [${sponsor.displayName}]
294+
- tier: ${tier ? tier + '(' + price + '$)' : '< none >'}
295+
- total amount donated: ${sponsor.totalAmountDonated}$
296+
- website: ${sponsor.website}
297+
- credit left: ${creditLeft}$
298+
- has active tier: ${hasActiveTier}
299+
- showAtSponsorList: ${sponsor.benefits.showAtSponsorList}
300+
`);
301+
291302
return {
292303
...sponsor,
293304
averageMonthlyContribution: Math.round(averageMonthlyContribution),

0 commit comments

Comments
 (0)