Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Individual bio pages #103

Merged
merged 27 commits into from
Jul 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
93caffe
Add promise for skillset lookup
curt-mitch-census Mar 7, 2024
e3e7a82
Update script with new keys and skillset change
curt-mitch-census Mar 11, 2024
1eb5c4e
Project and skillset lookups
curt-mitch-census Mar 12, 2024
0f479e9
Separate field for cohort year
curt-mitch-census Mar 12, 2024
ec5b090
Team member Sass file
curt-mitch-census Mar 12, 2024
36e7ead
Add cohort year to card
curt-mitch-census Mar 12, 2024
ef914d5
Merge branch 'master' into individual-bios
curt-mitch-census Mar 14, 2024
cda9eea
Styling for member cards and project list
curt-mitch-census Mar 14, 2024
0d5e880
Team page SEO text update
curt-mitch-census Mar 14, 2024
cb9f26d
Updated run of AirTable script
curt-mitch-census Mar 14, 2024
ba5786c
Another Airtable run
curt-mitch-census Mar 14, 2024
d3cd501
Styling to underline name on card hover
curt-mitch-census Mar 14, 2024
169d26f
Add Luke/Sam review feedback
curt-mitch-census Mar 19, 2024
adedede
Browserify team map code
curt-mitch-census Mar 21, 2024
bf37f12
minify map code using UglifyJS
curt-mitch-census Mar 21, 2024
1f5fd08
Fix tablet width on member bio page
curt-mitch-census Mar 22, 2024
8c48e3a
Add purple-base a11y colors for skills tags
curt-mitch-census Mar 27, 2024
7c0faf7
Modify team card with skillsets
curt-mitch-census Mar 27, 2024
97e8b7c
Additional updates to skill cards and blurb
curt-mitch-census Mar 27, 2024
32fc772
Add short description to team page cards
curt-mitch-census Mar 29, 2024
452357d
Clean up of airtable script code
curt-mitch-census Apr 2, 2024
29738c0
Merge branch 'master' into individual-bios
curt-mitch-census May 8, 2024
7555805
Anna + Diamond domains and portfolios
curt-mitch-census May 8, 2024
47d7734
Update with brief descriptions
curt-mitch-census May 16, 2024
1ef9545
Description and skill set updates
curt-mitch-census Jun 26, 2024
e9414b1
Comment out project list for now
curt-mitch-census Jun 26, 2024
a1253fc
Updates for multiple profiles
curt-mitch-census Jul 2, 2024
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
33 changes: 22 additions & 11 deletions _includes/components/team-member-card.html
Original file line number Diff line number Diff line change
@@ -1,13 +1,24 @@
<div class="col-12 tablet:grid-col-4 project-cards">
<div class="team-member-card">
<img id="{{ member.image_id }}" alt="Image of {{member.name}}" src="{{ site.baseurl }}{{ member.image_path }}" />
<h4 class="team-member-heading">{{ member.name }}</h4>
<h4 class="team-member-heading">{{ member.job_title }}</h4>
{% if member.portfolio %}
<h4>Project Status: {{member.portfolio}}</h4>
{% endif %}
<div class="member-card-content">
{{ member.blurb }}
<div class="col-12 tablet:grid-col-4 team-member-cards">
<a class="member-link" href="{{ site.baseurl }}{{ member.permalink }}">
<div class="team-member-card">
<img id="{{ member.image_id }}" alt="Image of {{member.name}}" src="{{ site.baseurl }}{{ member.image_path }}" />
<h4 class="team-member-heading member-name">{{ member.name }}</h4>
{% if member.cohort_year %}
<h4 class="team-member-heading member-title">{{ member.job_title }} - {{ member.cohort_year }}</h4>
{% else %}
<h4 class="team-member-heading member-title">{{ member.job_title }}</h4>
{% endif %}
<div class="bio-content">
{{ member.description }}
</div>
<ul class="skills-container usa-list--unstyled">
{% assign skillsets = member.skillsets | split: "," %}
{% for skill in skillsets %}
<li class="skills-tag">
<span class="skill-text {{ skill | slugify }}">{{ skill }}</span>
</li>
{% endfor %}
</ul>
</div>
</div>
</a>
</div>
40 changes: 32 additions & 8 deletions _layouts/team-member.html
Original file line number Diff line number Diff line change
@@ -1,19 +1,43 @@
---
layout: default
---
<section class="story">
<section class="team-member">
<article class="grid-container">
<div class="grid-row grid-gap-lg news-row">
<div class="news-content-container">
<header>
<div class="breadcrumb">Team Bios</div>
<h1>{{ member.name }}</h1>
</header>
<div class="bios-content">
{{ member.content }}
<div class="grid-row">
<div class="profile-description-container tablet:grid-col-10 desktop:grid-col-6">
<header>
<div class="breadcrumb">
<a href="{{ site.baseurl }}/team">Team Members</a>
</div>
<h1 class="member-name">{{ page.name }}</h1>
{% if page.cohort_year %}
<h2 class="member-title">{{ page.job_title }} - {{ page.cohort_year }} Cohort</h2>
{% else %}
<h2 class="member-title">{{ page.job_title }}</h2>
{% endif %}
</header>
<div class="bio-content">
{{ page.blurb }}
</div>
</div>
<img class="profile-img tablet:grid-col-auto tablet:margin-left-9 desktop:grid-col-3 desktop:margin-left-2" id="{{ page.image_id }}" alt="Image of {{page.name}}" src="{{ site.baseurl }}{{ page.image_path }}" />
<!-- {% if page.portfolio %}
{% assign projects = page.portfolio | split: "," %}
<h3 class="project-header">Current Projects:</h3>
<div class="project-container">
<ul class="skills-container">
{% for project in projects %}
<li>
<span class="">{{ project }}</span>
</li>
{% endfor %}
</ul>
</div>
{% endif %} -->
</div>
</div>
<p class="contact-info">To get in touch with {{ page.name | split: " " | first }}, please send a message to <a class="usa-link long-link" href="mailto:[email protected]">[email protected]</a>.</p>
</article>
</section>
<section class="more-news">
Expand Down
292 changes: 228 additions & 64 deletions airtable-cache.json

Large diffs are not rendered by default.

109 changes: 71 additions & 38 deletions airtable.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ marked.use({
gfm: true,
})

const base = new Airtable({apiKey: process.env.AIRTABLE_ACCESS_TOKEN}).base(process.env.AIRTABLE_BASE_ID);
const websiteContentBase = new Airtable({apiKey: process.env.AIRTABLE_ACCESS_TOKEN}).base(process.env.AIRTABLE_BASE_ID);

const xdContent = {};
const cacheFilePath = './airtable-cache.json';
Expand All @@ -34,7 +34,11 @@ const checkAndCleanImages = (newData, cacheData) => {
const cacheEquivalent = Array.from(Object.entries(cacheData))[index][1][count];

// Construct our new image path from the content type and item name
const name = item["Name"].toLowerCase().replaceAll(' ', '-');
const names = item["Author(s)"];
let name;
if (names.length === 1) {
name = names[0].name.toLowerCase().replaceAll(' ', '-');
}
const directory = `assets/img/import/${contentName.toLowerCase().replaceAll(' ', '_')}`;

// Lookup the same image from our cache
Expand Down Expand Up @@ -69,9 +73,9 @@ const checkAndCleanImages = (newData, cacheData) => {
// Optionally (if newer), write to our cache file with new data
const fetchAirtablePromise = () => new Promise((resolve, reject) => {

base('xd.gov Content').select({
websiteContentBase('xd.gov Content').select({
// Selecting the first 3 records in Grid view:
maxRecords: 20,
maxRecords: 50,
view: "Grid view"
}).eachPage((records, fetchNextPage) => {
// This function will get called for each page of records.
Expand All @@ -93,11 +97,34 @@ const fetchAirtablePromise = () => new Promise((resolve, reject) => {
resolve(xdContent);

}, function done(err) {
if (err) { console.error(err); reject(error); return; }
if (err) { console.error(err); reject(err); return; }
});

});

const findProject = (projectId) => new Promise((resolve, reject) => {
websiteContentBase('All Projects').find(projectId, (err, record) => {
if (err) { console.error(err); return; }
return resolve(record.fields['Project Name']);
});
});

const writeBioMarkdown = ({ Name, Images, Title, Description, Blurb, CohortYear, Skillsets, ProjectsList}) => {
return [`---`,
`name: ${Name}`,
`title: ${Name}`,
`permalink: /team/${dashCaseString(Name)}/`,
`image_id: ${Images && Images[0].id}`,
`image_path: ${Images && Images[0].newLocalPath}`,
`job_title: ${Title}`,
`cohort_year: ${CohortYear || ''}`,
`portfolio: ${ProjectsList?.join(",") || ''}`,
`description: ${marked.parse(Description || '')}`,
`blurb: ${Blurb && marked.parse(Blurb)}`,
`skillsets: ${Skillsets?.join(",") || ''}`,
`---`].join('\n');
}

const generateXdMarkdown = (content) => {
const fullMarkdownObj = {};

Expand All @@ -114,8 +141,11 @@ const generateXdMarkdown = (content) => {

// Loop through content types and generate unique markdown for each
content[contentType].map(async (obj) => {
const { Name, Title, Images, Attachments, Blurb, Portfolio } = obj;
let itemMarkdown = ``
const { Title, Images, Attachments, Blurb, Projects } = obj;
const CohortYear = obj['What is your ETF cohort year?'];
const Skillsets = obj['What is your area of expertise?'];
const Description = obj['Brief Description'];
let itemMarkdown = ``;

switch (contentType) {
// case 'News':
Expand All @@ -130,41 +160,44 @@ const generateXdMarkdown = (content) => {
// break;

case 'Bio':
if ([Name, Title, Images, Blurb].some(item => item === undefined)) return;
const Name = obj['Author(s)'][0].name; // Bio should have one author
const directory = '/collections/_team_members';
const bioMarkdownAttrs = `---
name: ${Name}
title: ${Name}
permalink: /team/${dashCaseString(Name)}/
image_id: ${Images[0].id}
image_path: ${Images[0].newLocalPath}
job_title: ${Title}
blurb: ${marked.parse(Blurb)}
---`;
const ProjectsList = [];
const content = { Name, Images, Title, Description, Blurb, CohortYear, Skillsets, ProjectsList };
let bioMarkdownAttrs = '';

if (Skillsets !== undefined) {
await Promise.all(Projects.map(async (projectId) => {
const skillsetName = await findProject(projectId);
content.ProjectsList.push(skillsetName);
}));
}
bioMarkdownAttrs = writeBioMarkdown(content);

await writeMarkdownFile(directory, Name, bioMarkdownAttrs);
break;

// case 'Project':
// if ([Name, Title, Images, Blurb, Portfolio, Attachments].some(item => item === undefined)) return;

// itemMarkdown += `---\n layout: project\n title: ${Title} Project\n---`

// // TODO: Create unique project file path from title and store it

// itemMarkdown += `
// \n<div>\n
// <img id="${Images[0].id}" alt="Image of ${Name}" src="${Images[0].newLocalPath}" />\n
// <h1>${Title}</h1>\n
// <h4>Author(s): ${Name}</h4>\n
// <h4>Project Status: ${Portfolio}</h4>\n
// <div class="breadcrumb"></div>\n
// ${marked.parse(Blurb)}\n
// <p>Materials: ${Attachments}</p>
// </div>\n
// --End--
// `;
// break;
case 'Project':
// console.log('Project', obj);
// if ([Name, Title, Images, Blurb, Portfolio, Attachments].some(item => item === undefined)) return;

// itemMarkdown += `---\n layout: project\n title: ${Title} Project\n---`

// // TODO: Create unique project file path from title and store it

// itemMarkdown += `
// \n<div>\n
// <img id="${Images[0].id}" alt="Image of ${Name}" src="${Images[0].newLocalPath}" />\n
// <h1>${Title}</h1>\n
// <h4>Author(s): ${Name}</h4>\n
// <h4>Project Status: ${Portfolio}</h4>\n
// <div class="breadcrumb"></div>\n
// ${marked.parse(Blurb)}\n
// <p>Materials: ${Attachments}</p>
// </div>\n
// --End--
// `;
break;
}

markdown += itemMarkdown;
Expand All @@ -177,7 +210,7 @@ blurb: ${marked.parse(Blurb)}
}

// Keep log for Action debugging
console.log(fullMarkdownObj);
// console.log(fullMarkdownObj);

return fullMarkdownObj;
}
Expand Down
58 changes: 57 additions & 1 deletion assets/css/_includes/_team-member-card.scss
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,71 @@
border-radius: 3px;
box-shadow: 3px 10px 13px 0px rgba(0,0,0,0.15);
height: 100%;
padding-bottom: 2.5rem;
padding-bottom: 1rem;
position: relative;

.member-title {
font-weight: normal;
}

img {
display: block;
margin: auto;
height: auto;
width: 100%;
}

.bio-content {
margin: 1rem;
}

.skills-container {
.skills-tag {
font-size: 0.9rem;
color: $color-white;
.skill-text {
padding: .5rem;
border-radius: 5px;
}
}
// color palette inspo is http://colorsafe.co/ purple palette
.ai-governance {
background-color: #9B59B6;
}
.cloud-management {
background-color: #7462E0;
}
.computer-vision {
background-color: #886288;
}
.data-science {
background-color: #DB0A5E;
}
.data-engineering {
background-color: #8859B6;
}
.privacy-enhancing-technologies {
background-color: #B200FD;
}
.fullstack-engineering {
background-color: #7659B6;
}
.human-centered-design {
background-color: #A74165;
}
.machine-learning {
background-color: #B500B5;
}
.tech-policy {
background-color: #5E50B5;
}
.technical-project-management {
background-color: #5A4586;
}
.cybersecurity {
background-color: #483D8B;
}
}
}

.member-card-content {
Expand Down
1 change: 1 addition & 0 deletions assets/css/_layouts/_all.scss
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@
@import "blog";
@import "position";
@import "project";
@import "team-member";
Loading
Loading