Skip to content

Commit 1d04c4a

Browse files
docs: ability to add custom information for supporters and improve the one
1 parent fb0ad77 commit 1d04c4a

4 files changed

Lines changed: 34 additions & 13 deletions

File tree

71.7 KB
Loading

src/components/Support/Support.jsx

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -252,9 +252,11 @@ export default class Support extends Component {
252252
: SmallIcon
253253
}
254254
alt={
255-
supporter.name || supporter.slug
256-
? `${supporter.name || supporter.slug}'s avatar`
257-
: 'avatar'
255+
supporter.alt
256+
? supporter.alt
257+
: supporter.name || supporter.slug
258+
? `${supporter.name || supporter.slug}'s avatar`
259+
: 'avatar'
258260
}
259261
onError={this._handleImgError}
260262
/>

src/utilities/fetch-supporters.mjs

Lines changed: 25 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -81,15 +81,30 @@ const transactionsGraphqlQuery = `query transactions($dateFrom: DateTime, $limit
8181
}
8282
}`;
8383

84-
const nodeToSupporter = (node) => ({
85-
name: node.account.name,
86-
slug: node.account.slug,
87-
website: node.account.website,
88-
avatar: node.account.imageUrl,
89-
firstDonation: node.createdAt,
90-
totalDonations: node.totalDonations.value * 100,
91-
monthlyDonations: 0,
92-
});
84+
const additionalInformation = {
85+
'gem-m': {
86+
website: 'https://www.noneedtostudy.com/take-my-praxis-test-for-me',
87+
avatar:
88+
'https://webpack.js.org/assets/supporters-logo-noneedtostudy.com-logo-medium.png',
89+
alt: 'Take My Praxis Test For Me - NoNeedToStudy.com Praxis Tutors',
90+
},
91+
};
92+
93+
const nodeToSupporter = (node) => {
94+
const { slug } = node.account;
95+
const info = additionalInformation[slug];
96+
97+
return {
98+
name: node.account.name,
99+
website: node.account.website,
100+
avatar: node.account.imageUrl,
101+
...info,
102+
slug: slug,
103+
firstDonation: node.createdAt,
104+
totalDonations: node.totalDonations.value * 100,
105+
monthlyDonations: 0,
106+
};
107+
};
93108

94109
const getAllNodes = async (graphqlQuery, getNodes) => {
95110
const body = {
@@ -113,7 +128,7 @@ const getAllNodes = async (graphqlQuery, getNodes) => {
113128
remaining = 100;
114129
}
115130
// Handling pagination if necessary
116-
131+
117132
while (true) {
118133
if (remaining === 0) {
119134
console.log(`Rate limit exceeded. Sleeping until ${new Date(reset)}.`);

webpack.ssg.mjs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,10 @@ export default (env) =>
115115
from: './assets/icon-square-big.svg',
116116
to: './assets/',
117117
},
118+
{
119+
from: './assets/supporters-*.png',
120+
to: './assets/',
121+
},
118122
{
119123
from: './assets/robots.txt',
120124
to: './',

0 commit comments

Comments
 (0)