Skip to content

Commit 0f3d8e6

Browse files
sokraskipjack
authored andcommitted
feat(sponsors): highlight latest sponsors/backers (#1628)
1 parent e064e70 commit 0f3d8e6

File tree

3 files changed

+20
-1
lines changed

3 files changed

+20
-1
lines changed

src/components/Splash/Splash.jsx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,9 @@ const Splash = () => (
2828

2929
<p>Through contributions, donations, and sponsorship, you allow webpack to thrive. Your donations directly support office hours, continued enhancements, and most importantly, great documentation and learning material!</p>
3030

31+
<h2>Latest Sponsors</h2>
32+
<Support rank="latest" />
33+
3134
<h2>Platinum Sponsors</h2>
3235
<Support rank="platinum" />
3336

src/components/Support/Support.jsx

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,9 @@ const ranks = {
2222
backer: {
2323
maximum: 200
2424
},
25+
latest: {
26+
maxAge: 14 * 24 * 60 * 60 * 1000
27+
},
2528
bronze: {
2629
minimum: 200,
2730
maximum: 2000
@@ -52,11 +55,12 @@ export default class Support extends React.Component {
5255
let { rank } = this.props;
5356

5457
let supporters = SUPPORTERS;
55-
let minimum, maximum;
58+
let minimum, maximum, maxAge;
5659

5760
if (rank && ranks[rank]) {
5861
minimum = ranks[rank].minimum;
5962
maximum = ranks[rank].maximum;
63+
maxAge = ranks[rank].maxAge;
6064
}
6165

6266
if (typeof minimum === 'number') {
@@ -67,13 +71,20 @@ export default class Support extends React.Component {
6771
supporters = supporters.filter(item => item.totalDonations < maximum * 100);
6872
}
6973

74+
if (typeof maxAge === 'number') {
75+
const now = Date.now();
76+
supporters = supporters.filter(item => item.firstDonation && (now - new Date(item.firstDonation).getTime() < maxAge));
77+
}
78+
7079
return (
7180
<div className="support">
7281
<div className="support__description">
7382
{ rank === 'backer' ? (
7483
<p>
7584
The following <b>Backers</b> are individuals who have contributed various amounts of money in order to help support webpack. Every little bit helps, and we appreciate even the smallest contributions.
7685
</p>
86+
) : rank === 'latest' ? (
87+
<p>The following persons/organizations made their first donation in the last {Math.round(maxAge / (1000 * 60 * 60 * 24))} days.</p>
7788
) : (
7889
<p>
7990
<b className="support__rank">{ rank } sponsors</b>

src/components/Support/Support.scss

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,11 @@
2222
margin: 0 2px 2px 2px;
2323
}
2424

25+
&__latest-avatar {
26+
height: 64px;
27+
max-width: 192px;
28+
}
29+
2530
&__bronze-avatar {
2631
height: 32px;
2732
max-width: 96px;

0 commit comments

Comments
 (0)