| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
|
| 18 |
|
| 19 |
|
| 20 |
|
| 21 |
|
| 22 |
|
| 23 |
|
| 24 |
|
| 25 |
|
| 26 |
|
| 27 |
|
| 28 |
|
| 29 |
|
| 30 |
|
| 31 |
|
| 32 |
|
| 33 |
|
| 34 |
|
| 35 |
|
| 36 |
|
| 37 |
|
| 38 |
|
| 39 |
|
| 40 |
|
| 41 |
|
| 42 |
|
| 43 |
use makeover_layout as layout; |
| 44 |
use quasi_router::screen::{Act, Row}; |
| 45 |
use quasi_router::{ |
| 46 |
Action, Document, Node, RegionKind, Request, Response, RouteError, Screen as Described, Slot, |
| 47 |
}; |
| 48 |
use quasi_webview::Webview; |
| 49 |
|
| 50 |
|
| 51 |
pub const PATH: &str = "/team"; |
| 52 |
|
| 53 |
|
| 54 |
pub const PAGE_REGION: &str = "team"; |
| 55 |
|
| 56 |
|
| 57 |
const BIO: &str = "founder-bio"; |
| 58 |
|
| 59 |
|
| 60 |
|
| 61 |
const BIO_BODY: &str = "founder-bio-body"; |
| 62 |
|
| 63 |
const MEASURE: layout::Measure = layout::Measure::Wide; |
| 64 |
|
| 65 |
|
| 66 |
pub fn screen(_viewer: &super::Viewer, _request: Request) -> Result<Response, RouteError> { |
| 67 |
Ok(page_screen().into()) |
| 68 |
} |
| 69 |
|
| 70 |
|
| 71 |
fn page_screen() -> Described { |
| 72 |
Described::single("Team - Makenotwork") |
| 73 |
.measured(MEASURE) |
| 74 |
.documented(Document::default().classed(crate::shell::body_class(MEASURE, &["team-page"]))) |
| 75 |
.summarised("Small by design: who builds Makenotwork, and what they did before.") |
| 76 |
.with( |
| 77 |
Slot::new(PAGE_REGION, RegionKind::Pane) |
| 78 |
.with(Node::page("Team")) |
| 79 |
.with(Node::text( |
| 80 |
"Small by design. The base platform was designed by the founder, who intends \ |
| 81 |
to stay as the technical lead through the project's growth.", |
| 82 |
)) |
| 83 |
.with(Node::section("Founder")) |
| 84 |
.with(Node::list([founder()])) |
| 85 |
.with(bio()), |
| 86 |
) |
| 87 |
} |
| 88 |
|
| 89 |
|
| 90 |
|
| 91 |
|
| 92 |
|
| 93 |
|
| 94 |
|
| 95 |
|
| 96 |
fn founder() -> Row { |
| 97 |
Row::new("Max") |
| 98 |
.secondary("CEO & Tech Lead") |
| 99 |
.meta("Designed and built the platform.") |
| 100 |
.act(Act::new("@max", Action::get("/u/max").navigating())) |
| 101 |
} |
| 102 |
|
| 103 |
|
| 104 |
|
| 105 |
|
| 106 |
fn bio() -> Node { |
| 107 |
Node::Region( |
| 108 |
Slot::new(BIO, RegionKind::Group) |
| 109 |
.with(Node::Region( |
| 110 |
Slot::new(BIO_BODY, RegionKind::Pane) |
| 111 |
.label("Bio") |
| 112 |
.with(Node::text(BIO_TEXT)), |
| 113 |
)) |
| 114 |
.showing_at_most_one(None), |
| 115 |
) |
| 116 |
} |
| 117 |
|
| 118 |
|
| 119 |
|
| 120 |
const BIO_TEXT: &str = "I started in the creator space as a young kid making backgrounds and \ |
| 121 |
montages for CoD MW2 players. I picked up programming around the same time, helping Minecraft \ |
| 122 |
server owners with whatever they needed. I spent the years after that focused on my \ |
| 123 |
education: a BA in mathematics at the University of Chicago, then a PhD in mathematics at UC \ |
| 124 |
San Diego. Afterward I decided to start my own business, and here we are."; |
| 125 |
|
| 126 |
|
| 127 |
|
| 128 |
|
| 129 |
|
| 130 |
|
| 131 |
|
| 132 |
#[must_use] |
| 133 |
pub fn renderer(viewer: &super::Viewer) -> Webview { |
| 134 |
Webview::new().with_shell(viewer.document_shell().with_body_first(format!( |
| 135 |
"{}{}", |
| 136 |
crate::shell::skip_link(PAGE_REGION), |
| 137 |
crate::shell::site_header(viewer.user.as_ref()), |
| 138 |
))) |
| 139 |
} |
| 140 |
|
| 141 |
#[cfg(test)] |
| 142 |
mod tests { |
| 143 |
use super::*; |
| 144 |
|
| 145 |
fn html() -> String { |
| 146 |
use quasi_axum::Serves as _; |
| 147 |
|
| 148 |
Webview::new().screen(&page_screen()) |
| 149 |
} |
| 150 |
|
| 151 |
|
| 152 |
|
| 153 |
|
| 154 |
|
| 155 |
#[test] |
| 156 |
fn the_document_carries_the_classes_the_template_carried() { |
| 157 |
let screen = page_screen(); |
| 158 |
|
| 159 |
assert_eq!( |
| 160 |
screen.document.body_class.as_deref(), |
| 161 |
Some("padded-page team-page") |
| 162 |
); |
| 163 |
assert!(html().contains("padded-page team-page"), "{}", html()); |
| 164 |
} |
| 165 |
|
| 166 |
|
| 167 |
|
| 168 |
|
| 169 |
#[test] |
| 170 |
fn the_bio_is_a_disclosure_and_not_a_stepper() { |
| 171 |
let html = html(); |
| 172 |
|
| 173 |
assert!(html.contains(r#"aria-expanded="false""#), "{html}"); |
| 174 |
assert!(!html.contains(r#"data-shows="next""#), "{html}"); |
| 175 |
assert!(html.contains("University of Chicago"), "{html}"); |
| 176 |
} |
| 177 |
|
| 178 |
|
| 179 |
#[test] |
| 180 |
fn the_founder_row_links_to_the_profile() { |
| 181 |
let html = html(); |
| 182 |
|
| 183 |
assert!(html.contains("CEO & Tech Lead"), "{html}"); |
| 184 |
assert!(html.contains(r#"href="/u/max""#), "{html}"); |
| 185 |
} |
| 186 |
|
| 187 |
|
| 188 |
#[test] |
| 189 |
fn the_page_spells_no_spinner() { |
| 190 |
let html = html(); |
| 191 |
|
| 192 |
for spelling in ["htmx-indicator", "spinner", "loading-text", "loading-state"] { |
| 193 |
assert!(!html.contains(spelling), "{spelling} survives in {html}"); |
| 194 |
} |
| 195 |
} |
| 196 |
} |
| 197 |
|