Skip to content

Commit b9a510d

Browse files
mockersfcart
andcommitted
donate page backed by the Bevy people (#532)
have the donate button link to a page with people from the Bevy org with a sponsor link Co-authored-by: Carter Anderson <mcanders1@gmail.com>
1 parent ad1c3f7 commit b9a510d

File tree

7 files changed

+248
-6
lines changed

7 files changed

+248
-6
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ content/assets
55
content/learn/errors
66
content/examples
77
content/community/people
8+
content/community/donate
89
static/assets/examples
910
static/processed_images
1011
.vscode/

generate-community/src/bin/generate.rs

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,26 @@ fn main() -> io::Result<()> {
2424
people_root_section.apply_roles(&role_map);
2525

2626
people_root_section.write(Path::new(&content_dir), Path::new(&content_sub_dir), 0)?;
27+
28+
let Some(CommunityNode::Section(org)) = people_root_section.content.iter().find(|node| node.name() == "The Bevy Organization") else {
29+
panic!("unexpected kind of node or missing for The Bevy Organization");
30+
};
31+
let mut donate = org.clone();
32+
33+
donate.name = "Supporting Bevy Development".to_string();
34+
donate.filename = Some("donate".to_string());
35+
donate.header = Some("Supporting Bevy".to_string());
36+
donate.template = Some("donate.html".to_string());
37+
38+
donate.content = donate.content.into_iter().filter(|node| {
39+
let CommunityNode::Member(member) = node else {
40+
panic!("got an unexpected subsection");
41+
};
42+
member.sponsor.is_some()
43+
}).collect();
44+
45+
donate.write(Path::new(&content_dir), Path::new(&content_sub_dir), 0)?;
46+
2747
Ok(())
2848
}
2949

@@ -176,7 +196,7 @@ impl From<&Section> for FrontMatterSection {
176196

177197
impl FrontMatterWriter for Section {
178198
fn write(&self, root_path: &Path, current_path: &Path, weight: usize) -> io::Result<()> {
179-
let section_path = current_path.join(self.name.to_ascii_lowercase());
199+
let section_path = current_path.join(self.filename.as_ref().unwrap_or(&self.name.to_ascii_lowercase()));
180200
let path = root_path.join(&section_path);
181201
fs::create_dir(path.clone())?;
182202

generate-community/src/lib.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,7 @@ where
102102
#[derive(Debug, Clone)]
103103
pub struct Section {
104104
pub name: String,
105+
pub filename: Option<String>,
105106
pub content: Vec<CommunityNode>,
106107
pub template: Option<String>,
107108
pub header: Option<String>,
@@ -189,6 +190,7 @@ fn visit_dirs(dir: PathBuf, section: &mut Section) -> io::Result<()> {
189190
};
190191
let mut new_section = Section {
191192
name: folder.to_str().unwrap().to_string(),
193+
filename: None,
192194
content: vec![],
193195
template: None,
194196
header: None,
@@ -217,6 +219,7 @@ fn visit_dirs(dir: PathBuf, section: &mut Section) -> io::Result<()> {
217219
pub fn parse_members(community_dir: &str) -> io::Result<Section> {
218220
let mut people_root_section = Section {
219221
name: "People".to_string(),
222+
filename: None,
220223
content: vec![],
221224
template: Some("people.html".to_string()),
222225
header: Some("People".to_string()),

sass/pages/_people.scss

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,6 @@
3737
}
3838

3939
.people-role {
40-
display: block;
4140
font-weight: 400;
4241
font-size: 0.8rem;
4342
padding-left: 0.3rem;
@@ -50,7 +49,17 @@
5049
border-width: 1px;
5150
}
5251

52+
.people-role-card {
53+
display: block;
54+
}
55+
56+
.people-role-inline {
57+
font-size: 1.0rem;
58+
margin-right: 0.2rem;
59+
}
60+
5361
.people-role-top-level {
62+
display: block;
5463
float: left;
5564
font-size: 1.0rem;
5665
margin-right: 0.2rem;

templates/donate.html

Lines changed: 209 additions & 0 deletions
Large diffs are not rendered by default.

templates/layouts/base.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@
9898
</div>
9999
</nav>
100100
<div class="header__cta-container">
101-
<a class="button button--pink header__cta" href="https://github.com/sponsors/cart">Donate <img class="button__icon" src="/assets/heart.svg" alt="heart icon"/></a>
101+
<a class="button button--pink header__cta" href="/community/donate">Donate <img class="button__icon" src="/assets/heart.svg" alt="heart icon"/></a>
102102
<a class="button header__cta" href="/learn/book/getting-started/">Get Started</a>
103103
</div>
104104
</div>

templates/people.html

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -216,11 +216,11 @@ <h2>
216216
<div class="people-roles">
217217
{% for role in post.extra.roles %}
218218
{% if role == "Project Lead" %}
219-
<div class="people-role people-role-project-lead">{{ role }}</div>
219+
<div class="people-role people-role-card people-role-project-lead">{{ role }}</div>
220220
{% elif role == "Maintainer" %}
221-
<div class="people-role people-role-maintainer">{{ role }}</div>
221+
<div class="people-role people-role-card people-role-maintainer">{{ role }}</div>
222222
{% elif role is starting_with("SME-") %}
223-
<div class="people-role people-role-sme">{{ role }}</div>
223+
<div class="people-role people-role-card people-role-sme">{{ role }}</div>
224224
{% else %}
225225
<div class="people-role">{{ role }}</div>
226226
{% endif %}

0 commit comments

Comments
 (0)