blob: b35d10750aeec8dc4fee543dcee866713be04b27 [file]
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="styles.css?v=1793826697">
<script src="js/jquery.js"></script>
<script src="js/script.js?v=1793826592"></script>
<title>Help me choose an Apache project</title>
<style>
#chooser { max-width: 820px; margin: 0 auto; }
.progress { height: 6px; background: #eee; border-radius: 3px; margin: 10px 0 20px; }
.progress div { height: 6px; background: #c6262e; border-radius: 3px; transition: width .3s; }
.q h2 { margin-bottom: 4px; }
.q .hint { color: #666; font-size: 90%; margin-bottom: 14px; }
.opts { display: flex; flex-wrap: wrap; gap: 8px; }
.opt { border: 1px solid #bbb; border-radius: 18px; padding: 7px 14px; cursor: pointer;
background: #fff; font-size: 95%; }
.opt:hover { border-color: #c6262e; }
.opt.on { background: #c6262e; color: #fff; border-color: #c6262e; }
.opt .n { opacity: .6; font-size: 85%; margin-left: 4px; }
.bar { margin-top: 20px; display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.btn { padding: 8px 16px; border-radius: 4px; border: 1px solid #c6262e; background: #c6262e;
color: #fff; cursor: pointer; }
.btn.sec { background: #fff; color: #c6262e; }
.btn:disabled { opacity: .4; cursor: default; }
.remaining { color: #555; margin-left: auto; }
.answers { font-size: 90%; color: #555; margin: 10px 0; }
.answers span { background: #f3f3f3; border-radius: 3px; padding: 2px 6px; margin-right: 4px; }
.result { border: 1px solid #ddd; border-radius: 6px; padding: 12px 16px; margin: 10px 0; }
.result { display: flex; gap: 14px; align-items: flex-start; }
.result .logo { flex: 0 0 72px; width: 72px; height: 72px; display: flex; align-items: center; justify-content: center; }
.result .logo img { max-width: 72px; max-height: 72px; }
.result .logo .mono { width: 56px; height: 56px; border-radius: 8px; background: #eef0fc; color: #5a5f8c;
font: bold 24px Capriola, Helvetica, sans-serif; display: flex; align-items: center; justify-content: center; }
.result .body { flex: 1; min-width: 0; }
.result .desc { color: #333; }
.result h3 { margin: 0 0 4px; }
.result .why { font-size: 85%; color: #666; margin-top: 6px; }
.result .links a { margin-right: 12px; font-size: 90%; }
.result.new { animation: fadein .4s; }
@keyframes fadein { from { opacity: 0; transform: translateY(-4px); } }
#matches-h { margin-top: 28px; margin-bottom: 4px; }
#shown { color: #666; font-size: 90%; margin-top: 0; }
.opt .ico { margin-right: 6px; }
.score { float: right; font-size: 85%; color: #c6262e; }
.mock { background: #fff6d5; border: 1px solid #e6c84f; padding: 8px 12px; border-radius: 4px; font-size: 90%; }
</style>
</head>
<body>
<div id="logo"><h1><div style="padding-top: 30px;">Projects Directory</div></h1></div>
<div id="cssmenu"></div>
<div id="contents">
<div id="chooser">
<p class="mock">Recommendations are built from the
<a href="https://release-catalog.apache.org/project_releases.json">ASF release catalog</a> and foundation data. If your project is missing or
mis-described, its committers can update its metadata (programming languages, categories, description) in <a href="https://releases.apache.org/">Apache Trusted Releases</a>.</p>
<h1>Help me choose a project</h1>
<p>Answer a few questions and we'll suggest Apache project communities you might enjoy contributing to. Each committee or podling appears once, even if it makes many separate releases.
You don't need to write code to contribute - projects need documentation, testing, user
support, design, translation and outreach just as much. Skip anything you don't care about.</p>
<div class="progress"><div id="prog" style="width:0"></div></div>
<div id="stage">Loading project data&hellip;</div>
<div id="matches" hidden>
<h2 id="matches-h"></h2>
<p class="hint" id="shown"></p>
<div id="list"></div>
<p id="empty" hidden>No matches - try going back and loosening an answer.</p>
</div>
<div id="advice"></div>
<p class="answers" id="generated"></p>
</div>
</div>
<div id="footer">
Managed by the <a href="https://community.apache.org">Apache Community Development Project</a>.<br/>
Copyright&copy; the Apache Software Foundation. Licensed under the <a href="https://www.apache.org/licenses/LICENSE-2.0">Apache License, Version 2.0</a><br/>
Apache&reg; and the Apache logo are trademarks of The Apache Software Foundation.
</div>
<script>
/*
* Adaptive question flow. Data comes from json/foundation/chooser.json,
* generated nightly by scripts/cronjobs/buildchooser.py.
*
* - The next question is the unanswered one that best splits the projects
* still in contention (a greedy decision tree, rebuilt from the data).
* - Answers are soft: a project scores a point per matched question, so
* projects with incomplete metadata aren't thrown out entirely.
* - We stop when few enough projects remain, or questions run out.
*/
const STOP_AT = 8, SHOW = 10;
let DATA, answers = {}, history = [];
const preselect = {}; // qid -> values to show already selected (from the URL)
const $s = () => document.getElementById('stage');
const esc = s => String(s || '').replace(/[&<>"]/g, c => ({'&':'&amp;','<':'&lt;','>':'&gt;','"':'&quot;'}[c]));
const Q = id => DATA.questions.find(q => q.id === id);
const isFilter = qid => (Q(qid) || {}).filter !== false;
function matches(p, qid, vals) { return !isFilter(qid) || vals.some(v => (p[qid] || []).includes(v)); }
// a question is only relevant if its 'requires' condition is met
function eligible(q) {
return Object.entries(q.requires || {}).every(([qid, vals]) =>
(answers[qid] || []).some(v => vals.includes(v)));
}
function score(p, ans) {
let s = 0;
for (const [qid, vals] of Object.entries(ans)) {
if (vals.length && isFilter(qid) && matches(p, qid, vals)) s++;
}
return s;
}
// Small icons for the option chips (same set as the front-page mockup D)
const ICONS = {
area: {
'Databases & storage': '\u{1F5C4}\uFE0F', 'Big data & analytics': '\u{1F4CA}', 'Web, HTTP & APIs': '\u{1F310}',
'Streaming & messaging': '\u{1F4E8}', 'Cloud & infrastructure': '\u2601\uFE0F', 'Content, search & documents': '\u{1F4C4}',
'Integration & workflow': '\u{1F517}', 'Security & identity': '\u{1F512}', 'Build, testing & dev tools': '\u{1F6E0}\uFE0F',
'IoT & edge': '\u{1F4E1}', 'Machine learning & AI': '\u{1F916}', 'Geospatial & science': '\u{1F30D}',
},
contribute: {
code: '\u{1F4BB}', docs: '\u{1F4DD}', users: '\u{1F4AC}', testing: '\u{1F9EA}', design: '\u{1F3A8}',
translate: '\u{1F5E3}\uFE0F', outreach: '\u{1F4E3}', unsure: '\u{1F914}',
},
};
const icon = (qid, v) => (ICONS[qid] && ICONS[qid][v]) ? `<span class="ico" aria-hidden="true">${ICONS[qid][v]}</span>` : '';
function labelFor(qid, v) {
const q = DATA.questions.find(q => q.id === qid);
const o = q && q.options.find(o => o.value === v);
return o ? o.label.split(' - ')[0] : v;
}
// projects matching every non-skipped answer
function candidates(ans = answers) {
return DATA.projects.filter(p =>
Object.entries(ans).every(([qid, vals]) => !vals.length || matches(p, qid, vals)));
}
// entropy of a question's split over the current candidates
function splitQuality(q, cands) {
const counts = q.options.map(o => cands.filter(p => (p[q.id] || []).includes(o.value)).length)
.filter(n => n > 0);
if (counts.length < 2) return 0;
const tot = counts.reduce((a, b) => a + b, 0);
return -counts.reduce((h, n) => h + (n / tot) * Math.log2(n / tot), 0);
}
function nextQuestion(cands) {
const open = DATA.questions.filter(q => !(q.id in answers) && eligible(q));
// Start with what the project is *about*, then how the person wants to help.
// Only after that do we let the data pick the most useful question.
for (const id of ['area', 'contribute']) { const q = open.find(q => q.id === id); if (q) return q; }
let best = null, bq = 0;
for (const q of open.filter(q => q.filter !== false)) { const h = splitQuality(q, cands); if (h > bq) { bq = h; best = q; } }
return best;
}
function render() {
const cands = candidates();
// keep asking the fixed opening questions even if the pool is already small
const q = (cands.length > STOP_AT || history.length < 2) ? nextQuestion(cands) : null;
document.getElementById('prog').style.width =
Math.round(100 * history.length / DATA.questions.filter(eligible).length) + '%';
if (!q) return showResults();
document.getElementById('advice').innerHTML = '';
// options preselected from the URL (only the first time this question shows)
const sel = new Set(preselect[q.id] || []);
delete preselect[q.id];
const opts = q.options.map(o => {
if (q.filter === false) return `<span class="opt${sel.has(o.value) ? ' on' : ''}" data-v="${esc(o.value)}">${icon(q.id, o.value)}${esc(o.label)}</span>`;
const n = cands.filter(p => (p[q.id] || []).includes(o.value)).length;
return n ? `<span class="opt${sel.has(o.value) ? ' on' : ''}" data-v="${esc(o.value)}">${icon(q.id, o.value)}${esc(o.label)}<span class="n">${n}</span></span>` : '';
}).join('');
$s().innerHTML = `<div class="q">
<h2>${esc(q.text)}</h2>
<div class="hint">${q.multi ? 'Pick as many as you like.' : 'Pick one.'}</div>
<div class="opts">${opts}</div>
<div class="bar">
<button class="btn" id="next">Next</button>
<button class="btn sec" id="skip">Skip / no preference</button>
${history.length ? '<button class="btn sec" id="back">Back</button>' : ''}
<button class="btn sec" id="now">Show matches now</button>
<span class="remaining" id="remaining"></span>
</div></div>` + answerSummary();
// Toggling an option previews its effect on the match list straight away;
// Next commits it and moves on to the following question.
const pending = () => sel.size ? {...answers, [q.id]: [...sel]} : answers;
const preview = () => {
document.getElementById('remaining').textContent =
`${candidates(pending()).length} communities match so far`;
showMatches(pending(), 'matches so far');
};
$s().querySelectorAll('.opt').forEach(el => el.onclick = () => {
const v = el.dataset.v;
if (!q.multi) { sel.clear(); $s().querySelectorAll('.opt').forEach(e => e.classList.remove('on')); }
if (sel.has(v)) { sel.delete(v); el.classList.remove('on'); } else { sel.add(v); el.classList.add('on'); }
if (!q.multi) answer(q, [...sel]); else preview();
});
document.getElementById('next').onclick = () => answer(q, [...sel]);
document.getElementById('skip').onclick = () => answer(q, []);
document.getElementById('now').onclick = () => {
if (sel.size) { answers[q.id] = [...sel]; history.push(q.id); }
showResults();
};
const b = document.getElementById('back'); if (b) b.onclick = back;
preview();
}
function answer(q, vals) { answers[q.id] = vals; history.push(q.id); render(); }
function back() { delete answers[history.pop()]; render(); }
function answerSummary() {
const parts = history.filter(id => answers[id].length)
.map(id => answers[id].map(v => `<span>${esc(labelFor(id, v))}</span>`).join(''));
return parts.length ? `<p class="answers">Your choices: ${parts.join(' ')}</p>` : '';
}
// Equal scores are ordered randomly, so the biggest communities (Hadoop...)
// don't always top the list. The key is fixed per page load, so the order
// stays stable while answers are toggled, and changes on each refresh.
const shuffleKeys = new Map();
function shuffleKey(p) {
if (!shuffleKeys.has(p.id)) shuffleKeys.set(p.id, Math.random());
return shuffleKeys.get(p.id);
}
// One card per project, built on first use and reused afterwards, so the
// list can be re-ranked by moving nodes instead of rebuilding the page.
const cards = new Map();
// "Apache Foo (Incubating)" -> "Foo (Incubating)": everything here is Apache
const shortName = n => String(n || '').replace(/^Apache\s+/, '');
// Logo from apache.org/logos (referenced, not copied): the project's own
// folder, then its committee's; a lettered tile if neither exists.
function logoHtml(p) {
const bare = p.id.replace(/^incubator-/, '');
const ids = [...new Set([bare, p.podling ? bare : p.pmc])];
const urls = ids.map(id => `https://www.apache.org/logos/res/${encodeURIComponent(id)}/default.png`);
const letter = esc((shortName(p.name)[0] || '?').toUpperCase());
return `<img src="${urls[0]}" alt="" loading="lazy" data-next="${urls.slice(1).join(' ')}"
onerror="const n=(this.dataset.next||'').split(' ').filter(Boolean);
if (n.length) { this.dataset.next=n.slice(1).join(' '); this.src=n[0]; }
else { this.outerHTML='<div class=&quot;mono&quot;>${letter}</div>'; }">`;
}
function card(p) {
if (cards.has(p.id)) return cards.get(p.id);
const el = document.createElement('div');
el.className = 'result';
el.dataset.id = p.id;
el.innerHTML = `<div class="logo">${logoHtml(p)}</div><div class="body"><span class="score"></span>
<h3>${esc(shortName(p.name))}</h3>
${p.desc ? `<div class="desc">${esc(p.desc)}</div>` : ''}
<div class="why">${p.language.length ? 'Languages: ' + esc(p.language.join(', ')) + ' · ' : ''}${
p.committers ? p.committers + ' committers · ' : ''}${
p.lastRelease ? 'last release ' + esc(p.lastRelease) : (p.podling ? 'Incubating' : '')}</div>
<div class="links">
${p.homepage ? `<a href="${esc(p.homepage)}">Website</a>` : ''}
${p.podling ? '' : `<a href="project.html?${esc(p.id)}">Project details</a>`}
<a href="https://lists.apache.org/list.html?dev@${esc(p.podling ? p.id : p.pmc)}.apache.org">dev@ list</a>
</div></div>`;
cards.set(p.id, el);
return el;
}
// Update the match list in place: drop cards that fell out of the top
// SHOW, move the rest into rank order, and fade in newcomers.
function showMatches(ans, what) {
const asked = Object.entries(ans).filter(([k, v]) => v.length && isFilter(k)).length;
const all = DATA.projects.map(p => ({p, s: score(p, ans)}))
.filter(r => r.s > 0 || !asked)
.sort((a, b) => b.s - a.s || shuffleKey(a.p) - shuffleKey(b.p));
const ranked = all.slice(0, SHOW);
const list = document.getElementById('list');
const keep = new Set(ranked.map(r => r.p.id));
[...list.children].forEach(el => { if (!keep.has(el.dataset.id)) el.remove(); });
ranked.forEach(({p, s}, i) => {
const el = card(p);
el.querySelector('.score').textContent = asked ? `matches ${s} of ${asked}` : '';
if (!el.isConnected) { el.classList.remove('new'); void el.offsetWidth; el.classList.add('new'); }
if (list.children[i] !== el) list.insertBefore(el, list.children[i] || null);
});
document.getElementById('matches-h').textContent = all.length > SHOW
? `Top ${SHOW} ${what}` : what[0].toUpperCase() + what.slice(1);
// Always say that this is only the top of the list, not every match.
document.getElementById('shown').textContent = all.length <= SHOW
? `Showing all ${all.length} matching communities.`
: `Showing only the top ${SHOW} of ${all.length} ${asked
? 'communities that match at least one of your answers, ranked by how many they match, in random order within each group'
: 'communities, in random order'}.${
document.getElementById('next') ? ' Answer more questions to narrow it down.' : ''}`;
document.getElementById('shown').hidden = !all.length;
document.getElementById('empty').hidden = ranked.length > 0;
document.getElementById('matches').hidden = false;
}
function showResults() {
document.getElementById('prog').style.width = '100%';
$s().innerHTML = `<div class="bar">${history.length ? '<button class="btn sec" id="back">Back</button>' : ''}
<button class="btn" id="restart">Start over</button></div>` + answerSummary();
showMatches(answers, 'projects you might like');
document.getElementById('advice').innerHTML = gettingStarted();
document.getElementById('restart').onclick = () => { answers = {}; history = []; render(); };
const b = document.getElementById('back'); if (b) b.onclick = back;
}
// Advice keyed on how the person wants to contribute. Every one of these is
// a real contribution; none is a stepping stone to "real" (code) work.
const ADVICE = {
code: 'Look for issues labelled "good first issue" or "newbie" in the project\'s issue tracker, and mention on dev@ what you\'d like to work on.',
docs: 'Read the project\'s docs as a newcomer and note what confused you - that list is the most valuable docs contribution there is. Docs usually live in the same repository as the code, or a website repository.',
users: 'Subscribe to the project\'s users@ list (or forum / chat) and answer questions you know the answer to. Every answer you give is one a maintainer doesn\'t have to.',
testing: 'Every Apache release is voted on in public. Download a release candidate when it\'s announced on dev@, try it, and report what you find - that counts as a contribution.',
design: 'Many projects need help with their website, logo, or user interface. Ask on dev@ which of these needs attention.',
translate: 'Ask on dev@ whether the project\'s UI or documentation is translated, and how translations are managed.',
outreach: 'Write about how you use the project, give a talk at a meetup or <a href="https://communityovercode.org/">Community Over Code</a>, or help with the project\'s social media. Let dev@ know so they can amplify it.',
unsure: 'That\'s fine! Join the project\'s dev@ list, read along for a week or two, and you\'ll quickly see where help is needed.',
};
function gettingStarted() {
const picks = (answers.contribute && answers.contribute.length) ? answers.contribute : ['unsure'];
return `<h2>How to get started</h2>
<p>Whatever you choose, start by introducing yourself on the project's dev@ mailing list:
say what interests you and what you'd like to help with. Projects run in the open, and
newcomers are welcome there.</p>
<ul>${picks.map(v => `<li><b>${esc(labelFor('contribute', v))}:</b> ${ADVICE[v] || ''}</li>`).join('')}</ul>
<p>See also <a href="https://community.apache.org/contributors/">contributing to Apache</a>
- code is only one of many ways to help.</p>`;
}
fetch('json/foundation/chooser.json').then(r => r.json()).then(d => {
DATA = d;
// chooser.html?area=<label>[&area=<label>]: open on the area question with
// those options already selected (used by the front-page category chips).
// The visitor can add more or change them, then press Next.
preselect.area = new URLSearchParams(location.search).getAll('area')
.filter(v => (d.questions.find(q => q.id === 'area') || {options: []}).options.some(o => o.value === v));
document.getElementById('generated').textContent =
`${d.projects.length} communities (committees and podlings) · data generated ${d.generated}`;
render();
}).catch(e => { $s().textContent = 'Could not load project data: ' + e; });
</script>
</body>
</html>