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

Add new about page template and people component #4217

Merged
merged 2 commits into from
Nov 29, 2024
Merged

Conversation

rakyi
Copy link
Contributor

@rakyi rakyi commented Nov 26, 2024

Other components and content will follow in future PRs.

image.png

Copy link
Contributor Author

rakyi commented Nov 26, 2024

This stack of pull requests is managed by Graphite. Learn more about stacking.

@rakyi rakyi changed the title Add new about page template Add new about page template and people component Nov 26, 2024
@rakyi rakyi requested a review from ikesau November 26, 2024 10:41
@rakyi rakyi marked this pull request as ready for review November 26, 2024 10:42
@rakyi rakyi marked this pull request as draft November 26, 2024 13:16
@rakyi rakyi force-pushed the about-pages-base branch 2 times, most recently from a4951ab to b13313e Compare November 26, 2024 15:21
@rakyi rakyi marked this pull request as ready for review November 26, 2024 15:33
@rakyi rakyi force-pushed the about-pages-base branch 3 times, most recently from f6868c2 to 1888a1a Compare November 26, 2024 20:04
Copy link
Member

@ikesau ikesau left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Very nice! Well done making your way through the archie boilerplate gauntlet. 😅

Just a few small adjustments to make 🙂

@@ -255,7 +255,25 @@ export class GdocBase implements OwidGdocBaseInterface {
.map((author) => author.featuredImage)
.filter((filename) => !!filename) as string[]

return [...this.filenames, ...featuredImages, ...featuredAuthorImages]
const peopleImages = new Set<string>()
for (const enrichedBlockSource of this.enrichedBlockSources) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think these images are already getting extracted by extractFilenamesFromBlock 🙂

traverseEnrichedBlock iterates through the persons in a people block already, and extractFilenamesFromBlock gets the image filenames in person blocks 👍

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch! I think I added this before I changed extractFilenamesFromBlock.

@@ -554,6 +572,8 @@ export class GdocBase implements OwidGdocBaseInterface {
"list",
"missing-data",
"numbered-list",
"people",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

people has person and person has text, so they should be handled in a with that extracts links from the text 🙂

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the comment at the top of this .with() call applies:

// no urls directly on any of these blocks
// their children may contain urls, but they'll be addressed by traverseEnrichedBlock

The links seem to work fine. AFAICT, we'd need a special handling for them here only if they were added as a property on a block, e.g. if {.person} had a url: property.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Aha whoops! Hoisted by my own petard. Wrote this one before I saw the update to traverseEnrichedBlocks and then didn't think to delete it.


if (typeof raw.value === "string")
return createError({
message: "Value is a string, not an array of people",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This check is always kind of contrived and unlikely to trip, but given that these errors are mostly for the authors, including the correct syntax in the error message will possibly save everyone some time.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good idea, updated.

@@ -0,0 +1,6 @@
.people {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did you consider implementing this layout with the CSS grid helpers and find it overly complicated?

It seems fine here (and is admittedly much simpler, plus avoids the margin collapsing issue) but I worry about having multiple arbitrary ways of doing layout stuff. One nice thing about sticking to the column system is that everything will line up to a single grid (which is the way that Marwa works) without the need for magic numbers.

Interested in your thoughts on this 🙂

Copy link
Contributor Author

@rakyi rakyi Nov 28, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good question, I should have mentioned it in the PR description. I did consider it, but decided against it because we'll have three different layouts for people configurable in archie: 1, 2 and 4 columns and on small screens they need to collapse into a single column row by row, e.g. first all the people from the first row, then all people from the second row etc.

I'll extend the component in a future PR.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay! Can we take a look at it together when you get around to implementing the stacking layout? I just wanna make sure I understand if there's a way in which the grid system isn't working for us 👍

Copy link
Contributor Author

@rakyi rakyi Nov 29, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

On a second thought, we might be able to use the grid system at least partially. You'll either see it in the next PR or I'll talk to you before, if it's gonna be a significant amount of work.

@rakyi rakyi merged commit c5edf06 into master Nov 29, 2024
13 of 14 checks passed
@rakyi rakyi deleted the about-pages-base branch November 29, 2024 08:44
@rakyi rakyi linked an issue Dec 12, 2024 that may be closed by this pull request
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add new archie block for a person's bio
2 participants