Skip to content

Commit

Permalink
Update the meeting times on the CoP page (#7169)
Browse files Browse the repository at this point in the history
* Update meeting times on CoP page

* Added spaces surrounding the dashes
  • Loading branch information
del9ra authored Aug 10, 2024
1 parent 1a369ca commit ccdb1d0
Show file tree
Hide file tree
Showing 7 changed files with 63 additions and 13 deletions.
2 changes: 0 additions & 2 deletions _data/internal/communities/data-science.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@ location:
image: /assets/images/communities-of-practice/data.jpg
alt: 'A person uses a laptop to review a data dashboard'

meeting-times: Mondays 7:00-8:00 pm PT

leadership-type: Mentor Led
leadership:
- name: Sophia Alice
Expand Down
2 changes: 0 additions & 2 deletions _data/internal/communities/engineering.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@ location:
image: /assets/images/communities-of-practice/engineering.jpg
alt: 'A computer screen shows a diagram used to manage code development'

meeting-times: Thursdays 6:00-7:00 pm PT

leadership-type: Community Led
leadership:
- name: Micah Elm
Expand Down
2 changes: 0 additions & 2 deletions _data/internal/communities/ops.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@ location:
image: /assets/images/communities-of-practice/ops.jpg
alt: 'A dramatic closeup of a screen filled with code'

meeting-times: Wednesdays 6:00-7:00 pm PT

leadership-type: Community Led
leadership:
- name: Chelsey Beck
Expand Down
2 changes: 0 additions & 2 deletions _data/internal/communities/project-management.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@ location:
image: /assets/images/communities-of-practice/product.jpg
alt: 'Several people around a small table listen intently as one person speaks.'

meeting-times: Fridays 12:00-1:00 pm PT

leadership-type: Mentor Led
leadership:
- name: Bonnie Wolfe
Expand Down
2 changes: 0 additions & 2 deletions _data/internal/communities/ui-ux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@ location:
image: /assets/images/communities-of-practice/uiux.jpg
alt: 'A board full of Post-it notes is used as a communication tool'

meeting-times: Wednesdays 6:00-7:00 PM PT

leadership-type: Community Led
leadership:
- name: Aparna Gopal
Expand Down
60 changes: 60 additions & 0 deletions assets/js/communities-of-practice.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
---
---

{% assign vrmsData = site.data.external.vrms_data %}
const vrmsData = JSON.parse(decodeURIComponent("{{ vrmsData | jsonify | uri_escape }}"));

document.addEventListener("DOMContentLoaded", function() {
// Function to retrieve and format meeting times
function getMeetingTimes(projectName) {
const project = vrmsData.find(event =>
event.project && event.project.name.startsWith("Community of Practice") && event.project.name.includes(projectName)
);

if (project) {
// Convert to Pacific Time
const options = { timeZone: "America/Los_Angeles", hour: 'numeric', minute: 'numeric', hour12: true };
const startTime = new Date(project.startTime);
const endTime = new Date(project.endTime);

// Format in Pacific Time
const formatter = new Intl.DateTimeFormat('en-US', options);
const formattedStartTime = formatter.format(startTime);
const formattedEndTime = formatter.format(endTime);

// Get the day of the week
const dayFormatter = new Intl.DateTimeFormat('en-US', { weekday: 'long', timeZone: 'America/Los_Angeles' });
const dayOfWeek = dayFormatter.format(startTime);

// Make it plural form for the day
const dayOfWeekPlural = dayOfWeek + 's';

return `${dayOfWeekPlural} ${formattedStartTime} - ${formattedEndTime} PT`;
} else {
return "TBD";
}
}

// sets the meeting times for each community
function setMeetingTimes() {
const communities = document.querySelectorAll('[id^="meeting-times-"]');

communities.forEach(element => {
const communityName = element.id.replace('meeting-times-', '').replace(/-/g, ' ').replace(/\b\w/g, l => l.toUpperCase());

// Map community names to their corresponding projectnames
let projectName = "";
if (communityName === "Project/Product Management") {
projectName = "Product Management";
} else if (communityName === "Ui/Ux") {
projectName = "UI/UX";
} else {
projectName = communityName;
}

element.innerHTML = getMeetingTimes(projectName);
});
}

setMeetingTimes();
});
6 changes: 3 additions & 3 deletions pages/communities-of-practice.html
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,7 @@ <h3 class = "Title4">{{ community[1].name}}</h3>
<p>{{ community[1].description}}</p>
<p>
<strong>Meeting Times:</strong>
{% if community[1].meeting-times %}{{ community[1].meeting-times }}{% else %}TBD{% endif %}<br>
</p>
<span id="meeting-times-{{ community[1].name | replace: ' ', '-' | downcase }}"></span><br> </p>
<p>
<strong>Leadership Type:</strong>
{% if community[1].leadership-type %}{{ community[1].leadership-type }}{% else %}TBD{% endif %}
Expand Down Expand Up @@ -95,4 +94,5 @@ <h3 class = "Title4">{{ community[1].name}}</h3>
</div>
{% endif %}
{% endfor %}
</section>
</section>
<script type="module" src="assets/js/communities-of-practice.js"></script>

0 comments on commit ccdb1d0

Please sign in to comment.