Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
205 changes: 205 additions & 0 deletions src/assets/contributors.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,205 @@
[
"marvinhagemeister",
"developit",
"andrewiggins",
"JoviDeCroock",
"robertknight",
"cristianbote",
"ForsakenHarmony",
"prateekbh",
"jviide",
"AlexGalays",
"rpetrich",
"pmkroeker",
"sventschui",
"k1r0s",
"38elements",
"NekR",
"mochiya98",
"mkxml",
"wardpeet",
"valotas",
"AimWhy",
"rschristian",
"tanhauhau",
"braddunbar",
"KevinDoughty",
"reznord",
"kristoferbaxter",
"gpoitch",
"natevw",
"jmrog",
"Rafi993",
"egdbear",
"mhmdanas",
"garybernhardt",
"harish2704",
"Download",
"yaodingyd",
"zouhir",
"vutran",
"billneff79",
"calebeby",
"Alexendoo",
"Almo7aya",
"aralroca",
"btm6084",
"btk5h",
"gcraftyg",
"guybedford",
"hadeeb",
"hbroer",
"jakearchibald",
"johakr",
"programbo",
"jridgewell",
"LukasBombach",
"lukeed",
"mxstbr",
"ngyikp",
"JiLiZART",
"kitten",
"sangupta",
"staeke",
"yuqianma",
"paranoidjk",
"ouzhenkun",
"Connormiha",
"craftedsystems",
"amilajack",
"andybons",
"4cm4k1",
"bmeurer",
"cmlenz",
"vaneenige",
"impronunciable",
"btd",
"feross",
"jackmoore",
"scurker",
"jeremy-coleman",
"jdanford",
"jmfirth",
"matthewp",
"kruczy",
"namankheterpal",
"mitranim",
"siddharthkp",
"niedzielski",
"futantan",
"teodragovic",
"utkarshkukreti",
"boarwell",
"intrnl",
"juicelink",
"mseddon",
"polemius",
"rmacklin",
"wojtczal",
"asolove",
"danielbayerlein",
"ddayguerrero",
"ivantm",
"jamesb3ll",
"jrf0110",
"RRDAWLX",
"9renpoto",
"wildlyinaccurate",
"mikestead",
"squidfunk",
"kaisermann",
"ctrlplusb",
"z11h",
"AlexanderOtavka",
"toniopelo",
"firatsarlar",
"david-nordvall",
"hikouki",
"vitormalencar",
"lcxfs1991",
"hassanbazzi",
"joaolucasl",
"rosskhanas",
"ddprrt",
"huruji",
"pazguille",
"addyosmani",
"helloworld-hellohyeon",
"tao1991123",
"blenderskool",
"ArsProgramma",
"David-zzg",
"sapegin",
"dandv",
"Marabyte",
"shaedrich",
"Worble",
"rykdesjardins",
"whitebackdoor",
"alexkrolick",
"Otto-AA",
"Anwardo",
"BartWaardenburg",
"guaiamum",
"belohlavek",
"Duske",
"montogeek",
"Jinex2012",
"joeldenning",
"Khaledgarbaya",
"ofgo",
"mbrukman",
"mozmorris",
"pradeepb6",
"digitalica",
"yhau1989",
"darvi-sh",
"Vrq",
"kuldeepkeshwar",
"mikaturk",
"malcolmyu",
"pl12133",
"thawkin3",
"bspaulding",
"ooade",
"zgoda",
"kolodziejczakM",
"PuruVJ",
"rkostrzewski",
"jgierer12",
"psabharwal123",
"jamesgeorge007",
"jonathantneal",
"StephanBijzitter",
"harshitkumar31",
"thangngoc89",
"SaraVieira",
"knight-bubble",
"DenysVuika",
"johnhaitas",
"davi-mbatista",
"framp",
"VanTanev",
"lwakefield",
"TheElegantDev",
"Akiyamka",
"pimdewit",
"heithemmoumni",
"bz2",
"SolarLiner",
"fisker",
"MichaelDeBoey",
"seroy",
"yyx990803",
"FredKSchott",
"PepsRyuu",
"piotr-cz",
"sidujjain",
"EmilTholin",
"matiasperz",
"AjayPoshak",
"michael-erskine",
"dbetteridge",
"jbt",
"ElMassimo"
]
53 changes: 36 additions & 17 deletions src/components/footer/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,22 +6,39 @@ import style from './style.module.less';
import { useLanguage } from '../../lib/i18n';

/*
* To update this list, on https://github.com/preactjs/preact/graphs/contributors run:
* $$('.contrib-person [data-hovercard-type="user"]:nth-of-type(2)').map(p=>p.textContent).filter(x => !/-bot$/.test(x)).join(' ')
* To update the list, run:
*
* const api = u => fetch(`https://api.github.com${u}`).then(r=>r.json());
* async function getContribs(org, repo, page=1) {
* let c = (await api(`/repos/${org}/${repo}/contributors?per_page=100&page=${page}`)).filter(u => u.contributions>1).map(u => u.login);
* if (c.length===100) c = c.concat(await getContribs(org, repo, page+1));
* return c;
* }
* const repos = await api('/orgs/preactjs/repos?per_page=100');
* const list = new Set((await Promise.all(repos.map(r => getContribs(r.owner.login, r.name)))).flat().filter(n => !n.endsWith('-bot') && !n.endsWith('[bot]')));
* copy(JSON.stringify(list, null, 2));
*
* And paste the results into src/assets/contributors.json
*/
const CONTRIBS = 'developit marvinhagemeister andrewiggins k1r0s cristianbote sventschui JoviDeCroock AlexGalays rpetrich valotas robertknight wardpeet kruczy pmkroeker NekR ForsakenHarmony jviide juicelink billneff79 yaodingyd prateekbh vutran rmacklin impronunciable zouhir scurker SolarLiner mseddon vaneenige lukeed kristoferbaxter reznord'.split(
' '
);

/**
* Display a random contributor of the list above.
* @param {any[]} deps
*/
export function useContributors(deps) {
const [value, setValue] = useState(CONTRIBS[new Date().getMonth()]);
function useContributors(deps) {
const [contributors, setContributors] = useState([]);
const [value, setValue] = useState(
contributors ? contributors[new Date().getMonth()] : undefined
);
useEffect(() => {
fetch('/assets/contributors.json')
.then(r => r.json())
.then(d => setContributors(d));
}, []);
useEffect(() => {
setValue(CONTRIBS[(Math.random() * (CONTRIBS.length - 1)) | 0]);
}, deps);
if (contributors)
setValue(contributors[(Math.random() * (contributors.length - 1)) | 0]);
}, [...deps, contributors]);
return value;
}

Expand Down Expand Up @@ -56,15 +73,17 @@ export default function Footer() {
rel="noopener noreferrer"
>
lovely people
</a>{' '}
like{' '}
<a
href={'https://github.com/' + contrib}
target="_blank"
rel="noopener noreferrer"
>
@{contrib}
</a>
{contrib && [
' like ',
<a
href={'https://github.com/' + contrib}
target="_blank"
rel="noopener noreferrer"
>
@{contrib}
</a>
]}
.
</p>
</div>
Expand Down