Only show the top supporters on hompage
Some checks failed
Deploy to GitHub Pages / build (push) Has been cancelled
Deploy to GitHub Pages / deploy (push) Has been cancelled

I no longer have time to maintain the full contributors list unfortunately
This commit is contained in:
Misode
2025-03-11 21:47:51 +01:00
parent b8c65edd83
commit 0138b54e0b
3 changed files with 123 additions and 1037 deletions

View File

@@ -1,5 +1,5 @@
import { useMemo } from 'preact/hooks'
import contributors from '../../contributors.json'
import supporters from '../../supporters.json'
import { Card, ChangelogEntry, Footer, GeneratorCard, Giscus, ToolCard, ToolGroup } from '../components/index.js'
import { WhatsNewTime } from '../components/whatsnew/WhatsNewTime.jsx'
import { useLocale, useTitle } from '../contexts/index.js'
@@ -7,7 +7,6 @@ import { useAsync } from '../hooks/useAsync.js'
import { useMediaQuery } from '../hooks/useMediaQuery.js'
import { fetchChangelogs, fetchVersions, fetchWhatsNew } from '../services/DataFetcher.js'
import { Store } from '../Store.js'
import { shuffle } from '../Utils.js'
const MIN_FAVORITES = 2
const MAX_FAVORITES = 5
@@ -153,32 +152,20 @@ function WhatsNew() {
}
function Contributors() {
const supporters = useMemo(() => {
return contributors.filter(c => c.types.includes('support') || c.types.includes('infrastructure'))
}, [])
const otherContributors = useMemo(() => {
return shuffle(contributors.filter(c => !supporters.includes(c)))
}, [])
return <div class="contributors">
<h3>Supporters</h3>
<ContributorsList list={supporters} large />
<h3>Contributors</h3>
<ContributorsList list={otherContributors} />
</div>
}
interface ContributorsListProps {
list: typeof contributors
list: typeof supporters
large?: boolean
}
function ContributorsList({ list, large }: ContributorsListProps) {
const { locale } = useLocale()
return <div class={`contributors-list ${large ? 'contributors-large' : ''}`}>
{list.map((c) =>
<a class="tooltipped tip-se" href={c.url} target="_blank" aria-label={`${c.name}\n${c.types.map(t => `${locale('contributor.' + t)}`).join('\n')}`}>
<a class="tooltipped tip-se" href={c.url} target="_blank" aria-label={c.name}>
<img width={large ? 48 : 32} height={large ? 48 : 32} src={c.avatar} alt={c.name} loading="lazy" />
</a>
)}