This is an automated email from the ASF dual-hosted git repository.

bdelacretaz pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/comdev-site.git


The following commit(s) were added to refs/heads/main by this push:
     new ac0a81da New "ASF volunteers" page to replace the community.zones.a.o 
apps (#146)
ac0a81da is described below

commit ac0a81da577bd85f287c77bef098fb7dd4e1f733
Author: Bertrand Delacretaz <bdelacre...@apache.org>
AuthorDate: Tue Mar 19 12:32:28 2024 +0100

    New "ASF volunteers" page to replace the community.zones.a.o apps (#146)
---
 layouts/_default/volunteers.html        |  7 +++++
 layouts/partials/navbar.html            |  1 +
 source/contributors/asf-volunteers.md   | 33 +++++++++++++++++++++
 static/css/main.css                     |  4 +++
 static/data/people.json                 | 18 ++++++++++++
 static/js/components/data-loader.js     | 13 +++++++++
 static/js/components/person-projects.js | 52 +++++++++++++++++++++++++++++++++
 static/js/components/volunteers-list.js | 48 ++++++++++++++++++++++++++++++
 8 files changed, 176 insertions(+)

diff --git a/layouts/_default/volunteers.html b/layouts/_default/volunteers.html
new file mode 100644
index 00000000..3d9d2769
--- /dev/null
+++ b/layouts/_default/volunteers.html
@@ -0,0 +1,7 @@
+{{ define "main" }}
+    <script type="module" src="/js/components/volunteers-list.js"></script>
+    <script type="module" src="/js/components/person-projects.js"></script>
+    <volunteers-list>
+    {{ .Content }}
+    </volunteers-list>
+{{ end }}
diff --git a/layouts/partials/navbar.html b/layouts/partials/navbar.html
index 3560d625..cc7bf86c 100644
--- a/layouts/partials/navbar.html
+++ b/layouts/partials/navbar.html
@@ -37,6 +37,7 @@
             <a class="dropdown-item" href="https://www.apache.org/";>The Apache 
Software Foundation</a>
             <a class="dropdown-item" 
href="https://www.apache.org/foundation/sponsorship";>Sponsor Apache</a>
             <a class="dropdown-item" 
href="http://diversity.apache.org/";>Diversity & Inclusion</a>
+             <a class="dropdown-item" 
href="/contributors/asf-volunteers.html">Mentors &amp; Speakers</a>
             <a class="dropdown-item" 
href="https://www.apache.org/foundation/thanks";>Thanks to our Sponsors</a>
             <a class="dropdown-item" 
href="https://www.apache.org/licenses";>License</a>
             <a class="dropdown-item" 
href="https://www.apache.org/security";>Security</a>
diff --git a/source/contributors/asf-volunteers.md 
b/source/contributors/asf-volunteers.md
new file mode 100644
index 00000000..707f09ac
--- /dev/null
+++ b/source/contributors/asf-volunteers.md
@@ -0,0 +1,33 @@
+---
+title: ASF volunteers, mentors and speakers
+layout: volunteers
+tags: ["committers","newcomers","contributing","mentoring","speakers"]
+---
+
+Here's a list of ASF community members who volunteer to mentor new community 
members
+and/or to be speakers at ASF-related events.
+
+Project names shown in <strong>bold</strong> mean that the corresponding person
+is a PMC member of that project.
+
+## ASF volunteer mentors & speakers
+
+In alphabetical order of ASF IDs.
+
+<!--
+To add your name to this list, use the same 
+format as other entries and keep the list sorted
+alphabetically by ASF username. 
+
+You can add additional data such as your personal
+website URL, languages spoken, location etc.
+to the /static/data/people.json file
+
+This data is combined with public ASF info found under
+https://whimsy.apache.org/public/public_ldap_projects.json , 
+by a Web Component loaded for this page.
+-->
+
+* bdelacretaz # mentor, speaker
+* curcuru # mentor, speaker
+* rbowen # mentor, speaker
diff --git a/static/css/main.css b/static/css/main.css
index 3f1f210b..b5e24270 100644
--- a/static/css/main.css
+++ b/static/css/main.css
@@ -85,4 +85,8 @@ ul.tags-list {
   text-align: center;
   margin-top: 1rem;
   margin-bottom: 1rem;
+}
+
+volunteers-list .projects {
+  font-size: 80%;
 }
\ No newline at end of file
diff --git a/static/data/people.json b/static/data/people.json
new file mode 100644
index 00000000..c4505c24
--- /dev/null
+++ b/static/data/people.json
@@ -0,0 +1,18 @@
+{
+  "NONAME_KEEP_THIS_FIRST": {
+    "info": "This file supplies additional public information about our 
people, so far for the ASF volunteers page",
+    "details": "See static/js/components for how this data is used"
+  },
+  "bdelacretaz" : {
+    "speaks": [ "French", "English", "Some German"],
+    "region": "Switzerland",
+    "website": "https://grep.codeconsult.ch";
+  },
+  "curcuru" : {
+    "region": "Boston, MA, US",
+    "website": " https://shanecurcuru.org/";
+  },
+  "rbowen" : {
+    "website": "https://drbacchus.com";
+  }
+}
\ No newline at end of file
diff --git a/static/js/components/data-loader.js 
b/static/js/components/data-loader.js
new file mode 100644
index 00000000..c454fc52
--- /dev/null
+++ b/static/js/components/data-loader.js
@@ -0,0 +1,13 @@
+// This is used by the components in this folder to load
+// JSON public data from various places
+const fetchJSON = async url => {
+  var result = {};
+  const response = await fetch(url);
+  if (response.status == 200) {
+    const data = await response.text();
+    result = JSON.parse(data);
+  }
+  return result;
+}
+
+export default fetchJSON;
\ No newline at end of file
diff --git a/static/js/components/person-projects.js 
b/static/js/components/person-projects.js
new file mode 100644
index 00000000..b681829e
--- /dev/null
+++ b/static/js/components/person-projects.js
@@ -0,0 +1,52 @@
+import fetchJSON from './data-loader.js';
+const projects = await 
fetchJSON('https://whimsy.apache.org/public/public_ldap_projects.json');
+var projectsById = {};
+
+{
+  Object.keys(projects.projects).forEach(project => {
+    projects.projects[project].members.forEach(m => {
+      if (!projectsById[m]) {
+        projectsById[m] = {};
+      }
+      projectsById[m][project] = { pmc: false };
+    })
+    projects.projects[project].owners.forEach(m => {
+      if (!projectsById[m]) {
+        projectsById[m] = {};
+      }
+      projectsById[m][project] = { pmc: true };
+    })
+  })
+}
+
+// some projects websites have names that
+// differ from their Whimsy name
+const projectToWebsite = {
+  comdev: 'community'
+}
+
+// Component that replaces its content with a list of links
+// to the projects that an ASF id belongs to
+class PersonProjects extends HTMLElement {
+  async connectedCallback() {
+    let projectsHTML = '';
+    const asfid = this.getAttribute('asfid');
+    const theirProjects = projectsById[asfid];
+    if (theirProjects) {
+      Object.keys(theirProjects).forEach(project => {
+        const website = projectToWebsite[project] ? projectToWebsite[project] 
: project;
+        const isPmc = theirProjects[project].pmc;
+        if (projectsHTML != '') {
+          projectsHTML += ', ';
+        }
+        projectsHTML += `<a href=https://${website}.apache.org>${isPmc ? 
'<strong>' : ''}${project}${isPmc ? '</strong>' : ''}</a>`;
+      })
+    }
+
+    if (projectsHTML.length > 0) {
+      this.innerHTML = projectsHTML;
+    }
+  }
+}
+
+customElements.define('person-projects', PersonProjects);
\ No newline at end of file
diff --git a/static/js/components/volunteers-list.js 
b/static/js/components/volunteers-list.js
new file mode 100644
index 00000000..2f218609
--- /dev/null
+++ b/static/js/components/volunteers-list.js
@@ -0,0 +1,48 @@
+import fetchJSON from "./data-loader.js";
+
+// Component that enriches a list of volunteers where each
+// entry is formatted in Markdown like
+//  * bdelacretaz # mentor, speaker # https://grep.codeconsult.ch # Switzerland
+//
+class VolunteersList extends HTMLElement {
+  async connectedCallback() {
+    const whimsyPeople = await 
fetchJSON('https://whimsy.apache.org/public/public_ldap_people.json');
+    const localPeople = await fetchJSON('/data/people.json');
+    this.querySelectorAll('li').forEach(li => {
+      const d = this._parseEntry(li.textContent);
+
+      // set volunteer information
+      const name = whimsyPeople.people[d.id]?.name ? 
whimsyPeople.people[d.id]?.name : d.id;
+      const localinfo = localPeople[d.id];
+      li.innerHTML = `
+        ${localinfo?.website ? '<a rel="nofollow" href="' + localinfo.website 
+ '">' + name + '</a>' : name }
+        (${d.id})
+        - ${d.roles}
+        ${localinfo?.region ? '- ' + localinfo.region : ''}
+        ${localinfo?.speaks ? '- languages spoken: ' + localinfo.speaks : ''}
+        <br/><span class='projects'><em>projects: </em><person-projects 
asfid="${d.id}"></person-projects></span>
+      `;
+    })
+  }
+
+  _parseEntry(txt) {
+    const fields = txt.split('#');
+
+    const nullIfEmpty = input => {
+      if(!input) {
+        return null;
+      }
+      const result = input.trim();
+      return result.length == 0 ? null : result;
+    }
+
+    var i = 0;
+    return {
+      id: nullIfEmpty(fields[i++]),
+      roles: nullIfEmpty(fields[i++])
+    }
+  }
+
+}
+
+customElements.define('volunteers-list', VolunteersList);
\ No newline at end of file

Reply via email to