Skip to content

Commit

Permalink
fix: Display and calculation of sponsors (#656)
Browse files Browse the repository at this point in the history
* fix: Display and calculation of sponsors

* Fix sponsors.json
  • Loading branch information
nzakas authored Oct 31, 2024
1 parent c10654b commit 919428d
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 13 deletions.
20 changes: 10 additions & 10 deletions src/_data/sponsors.json
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,15 @@
}
],
"bronze": [
{
"name": "Cybozu",
"url": "https://cybozu.co.jp/",
"image": "https://images.opencollective.com/cybozu/933e46d/logo.png",
"monthlyDonation": 350,
"totalDonations": 19964,
"source": "opencollective",
"tier": "bronze-sponsor"
},
{
"name": "WordHint",
"url": "https://www.wordhint.net/",
Expand Down Expand Up @@ -135,15 +144,6 @@
}
],
"backers": [
{
"name": "Cybozu",
"url": "https://cybozu.co.jp/",
"image": "https://images.opencollective.com/cybozu/933e46d/logo.png",
"monthlyDonation": 350,
"totalDonations": 19964,
"source": "opencollective",
"tier": null
},
{
"name": "Principal Financial Group",
"url": "https://www.principal.com/about-us",
Expand Down Expand Up @@ -1659,4 +1659,4 @@
"tier": "backer"
}
]
}
}
5 changes: 3 additions & 2 deletions src/content/pages/sponsors.html
Original file line number Diff line number Diff line change
Expand Up @@ -222,11 +222,12 @@ <h2 class="section-title h3">{{ site.sponsors_page.tiers.backers.title }}</h2>
</div>
<div class="grid">
<ul role="list" class="sponsors span-1-12 sponsors--backers">
{% set fallback_image = '/assets/images/people/_placeholder-avatar.svg' %}
{% for sponsor in sponsors.backers %}
<li>
<a href="{{ sponsor.url | url }}" class="sponsor-link" rel="nofollow noopener sponsored" target="_blank">
<img loading="lazy" decoding="async" src="{{ sponsor.image }}" height="48" width="48"
onerror="this.src = '/assets/images/people/_placeholder-avatar.svg'"
<img loading="lazy" decoding="async" src="{{ sponsor.image if sponsor.image else fallback_image }}" height="48" width="48"
onerror="this.src = '{{fallback_image}}'"
alt="{{ sponsor.name if sponsor.name else "Anonymous" }} is donating {{ sponsor.monthlyDonation | dollars }} each month"
title="{{ sponsor.name if sponsor.name else "Anonymous" }} is donating {{ sponsor.monthlyDonation | dollars }} each month" />
</a>
Expand Down
2 changes: 1 addition & 1 deletion tools/fetch-sponsors.js
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ async function fetchOpenCollectiveData() {
: order.amount.value,
totalDonations: order.totalDonations.value,
source: "opencollective",
tier: order.tier ? order.tier.slug : null,
tier: order.tier ? order.tier.slug : getTierSlug(order.amount.value),
}));

const donations = payload.data.donations.nodes
Expand Down

0 comments on commit 919428d

Please sign in to comment.