| 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::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 |
use crate::tier_prices::TierPrices; |
| 51 |
|
| 52 |
|
| 53 |
pub const PATH: &str = "/use-cases"; |
| 54 |
|
| 55 |
|
| 56 |
pub const PAGE_REGION: &str = "use-cases"; |
| 57 |
|
| 58 |
|
| 59 |
const PROFILES: &str = "use-case-profiles"; |
| 60 |
|
| 61 |
|
| 62 |
const UNIVERSAL: &str = "everyone-gets"; |
| 63 |
|
| 64 |
const MEASURE: layout::Measure = layout::Measure::Wide; |
| 65 |
|
| 66 |
|
| 67 |
|
| 68 |
|
| 69 |
|
| 70 |
|
| 71 |
struct Profile { |
| 72 |
anchor: &'static str, |
| 73 |
title: &'static str, |
| 74 |
who: &'static str, |
| 75 |
description: &'static str, |
| 76 |
features: &'static [&'static str], |
| 77 |
|
| 78 |
priced: Priced, |
| 79 |
} |
| 80 |
|
| 81 |
|
| 82 |
|
| 83 |
|
| 84 |
|
| 85 |
|
| 86 |
|
| 87 |
#[derive(Clone, Copy)] |
| 88 |
enum Priced { |
| 89 |
Basic, |
| 90 |
SmallFiles, |
| 91 |
BigFiles, |
| 92 |
|
| 93 |
|
| 94 |
BasicOrSmallFiles, |
| 95 |
} |
| 96 |
|
| 97 |
impl Priced { |
| 98 |
|
| 99 |
fn line(self, prices: &TierPrices) -> String { |
| 100 |
match self { |
| 101 |
Self::Basic => format!( |
| 102 |
"Basic ${}/mo · {}, {}/file", |
| 103 |
prices.basic_std, prices.basic_total, prices.basic_per_file |
| 104 |
), |
| 105 |
Self::SmallFiles => format!( |
| 106 |
"Small Files ${}/mo · {}, {}/file", |
| 107 |
prices.small_files_std, prices.small_files_total, prices.small_files_per_file |
| 108 |
), |
| 109 |
Self::BigFiles => format!( |
| 110 |
"Big Files ${}/mo · {}, {}/file", |
| 111 |
prices.big_files_std, prices.big_files_total, prices.big_files_per_file |
| 112 |
), |
| 113 |
Self::BasicOrSmallFiles => format!( |
| 114 |
"Basic ${}/mo or Small Files ${}/mo", |
| 115 |
prices.basic_std, prices.small_files_std |
| 116 |
), |
| 117 |
} |
| 118 |
} |
| 119 |
} |
| 120 |
|
| 121 |
|
| 122 |
const PROFILE_LIST: &[Profile] = &[ |
| 123 |
Profile { |
| 124 |
anchor: "musicians", |
| 125 |
title: "Musicians", |
| 126 |
who: "Bands, solo artists, producers", |
| 127 |
description: "Sell albums, singles, and EPs with in-browser streaming, chapter markers, and cover art.", |
| 128 |
features: &[ |
| 129 |
"MP3, FLAC, WAV, OGG, AAC, AIFF upload", |
| 130 |
"In-browser audio player with chapters", |
| 131 |
"Cover art and rich metadata", |
| 132 |
"RSS feed per project", |
| 133 |
"Pay-what-you-want pricing", |
| 134 |
], |
| 135 |
priced: Priced::SmallFiles, |
| 136 |
}, |
| 137 |
Profile { |
| 138 |
anchor: "podcasters", |
| 139 |
title: "Podcasters", |
| 140 |
who: "Independent shows, networks", |
| 141 |
description: "Host and distribute your podcast with full RSS support for every major directory.", |
| 142 |
features: &[ |
| 143 |
"RSS for Apple, Spotify, Pocket Casts", |
| 144 |
"Chapter markers", |
| 145 |
"Subscriber-only feeds", |
| 146 |
"Broadcast emails to followers", |
| 147 |
], |
| 148 |
priced: Priced::SmallFiles, |
| 149 |
}, |
| 150 |
Profile { |
| 151 |
anchor: "writers", |
| 152 |
title: "Writers", |
| 153 |
who: "Bloggers, newsletter writers, authors", |
| 154 |
description: "Publish long-form writing with Markdown, per-project blogs, and subscriber broadcasts.", |
| 155 |
features: &[ |
| 156 |
"Markdown editor with formatting", |
| 157 |
"Per-project blog", |
| 158 |
"RSS feed", |
| 159 |
"Scheduled publishing", |
| 160 |
"Broadcast emails", |
| 161 |
], |
| 162 |
priced: Priced::Basic, |
| 163 |
}, |
| 164 |
Profile { |
| 165 |
anchor: "developers", |
| 166 |
title: "Software Developers", |
| 167 |
who: "Indie devs, tool makers, plugin authors", |
| 168 |
description: "Distribute software with versioned releases, license keys, and a built-in git browser.", |
| 169 |
features: &[ |
| 170 |
"Versioned releases with changelogs", |
| 171 |
"License keys with activation tracking", |
| 172 |
"Git source browser", |
| 173 |
"Promo codes and discounts", |
| 174 |
], |
| 175 |
priced: Priced::SmallFiles, |
| 176 |
}, |
| 177 |
Profile { |
| 178 |
anchor: "sample-packs", |
| 179 |
title: "Sample Packs", |
| 180 |
who: "Sound designers, beat makers, foley artists", |
| 181 |
description: "Sell sample packs and sound effects with audio previews and versioned downloads.", |
| 182 |
features: &[ |
| 183 |
"Audio previews in-browser", |
| 184 |
"Versioned downloads", |
| 185 |
"Hierarchical tags for organization", |
| 186 |
"Pay-what-you-want pricing", |
| 187 |
"Cover art", |
| 188 |
], |
| 189 |
priced: Priced::SmallFiles, |
| 190 |
}, |
| 191 |
Profile { |
| 192 |
anchor: "digital-art", |
| 193 |
title: "Digital Art & Photography", |
| 194 |
who: "Illustrators, photographers, font designers", |
| 195 |
description: "Sell digital art, photography, and fonts with versioned releases and subscription tiers.", |
| 196 |
features: &[ |
| 197 |
"Any file type supported", |
| 198 |
"Versioned releases", |
| 199 |
"Subscription tiers", |
| 200 |
"Cover images", |
| 201 |
], |
| 202 |
priced: Priced::SmallFiles, |
| 203 |
}, |
| 204 |
Profile { |
| 205 |
anchor: "educators", |
| 206 |
title: "Educators", |
| 207 |
who: "Course creators, tutors, workshop leaders", |
| 208 |
description: "Publish courses and teaching materials with text content, downloads, and subscriptions.", |
| 209 |
features: &[ |
| 210 |
"Text content with Markdown", |
| 211 |
"Downloadable materials", |
| 212 |
"Subscription tiers", |
| 213 |
"Scheduled publishing", |
| 214 |
], |
| 215 |
priced: Priced::BasicOrSmallFiles, |
| 216 |
}, |
| 217 |
Profile { |
| 218 |
anchor: "game-devs", |
| 219 |
title: "Game Developers", |
| 220 |
who: "Indie games, mods, TTRPG content", |
| 221 |
description: "Distribute games up to 20GB per file with versioned downloads, license keys, and promo codes. Need more than 20GB? Request a size increase from your dashboard.", |
| 222 |
features: &[ |
| 223 |
"Up to 20GB per file (increase on request)", |
| 224 |
"Versioned downloads with changelogs", |
| 225 |
"License keys with activation limits", |
| 226 |
"Promo codes", |
| 227 |
], |
| 228 |
priced: Priced::BigFiles, |
| 229 |
}, |
| 230 |
Profile { |
| 231 |
anchor: "comic-creators", |
| 232 |
title: "Comic Creators", |
| 233 |
who: "Webcomic artists, graphic novelists", |
| 234 |
description: "Sell digital comics and graphic novels with project organization and scheduled publishing.", |
| 235 |
features: &[ |
| 236 |
"PDF, CBZ, and any file type", |
| 237 |
"Project organization", |
| 238 |
"Subscriptions", |
| 239 |
"Scheduled publishing", |
| 240 |
], |
| 241 |
priced: Priced::SmallFiles, |
| 242 |
}, |
| 243 |
]; |
| 244 |
|
| 245 |
|
| 246 |
const UNIVERSAL_LIST: &[(&str, &str)] = &[ |
| 247 |
( |
| 248 |
"0% platform fee", |
| 249 |
"Only ~3% payment processing. No percentage cuts, no revenue sharing.", |
| 250 |
), |
| 251 |
( |
| 252 |
"Full data export", |
| 253 |
"Download everything anytime. Projects, items, sales, contacts: all yours.", |
| 254 |
), |
| 255 |
( |
| 256 |
"No lock-in", |
| 257 |
"Month-to-month. Cancel anytime. Take your audience with you.", |
| 258 |
), |
| 259 |
( |
| 260 |
"Source available", |
| 261 |
"Read the codebase. Verify every claim about privacy and data handling.", |
| 262 |
), |
| 263 |
]; |
| 264 |
|
| 265 |
|
| 266 |
|
| 267 |
const ONWARD: &[(&str, &str)] = &[ |
| 268 |
("Pricing Calculator", "/pricing"), |
| 269 |
("Browse as guest", "/discover"), |
| 270 |
("Creator Guide", "/docs/getting-started"), |
| 271 |
]; |
| 272 |
|
| 273 |
|
| 274 |
pub fn screen(viewer: &super::Viewer, _request: Request) -> Result<Response, RouteError> { |
| 275 |
use axum::extract::FromRef as _; |
| 276 |
|
| 277 |
let billing = crate::Billing::from_ref(&viewer.app); |
| 278 |
Ok(page_screen(&billing.tier_prices).into()) |
| 279 |
} |
| 280 |
|
| 281 |
|
| 282 |
fn page_screen(prices: &TierPrices) -> Described { |
| 283 |
let mut profiles = Slot::new(PROFILES, RegionKind::Group); |
| 284 |
for profile in PROFILE_LIST { |
| 285 |
profiles = profiles.with(Node::Region(card(profile, prices))); |
| 286 |
} |
| 287 |
|
| 288 |
let universal = Node::list( |
| 289 |
UNIVERSAL_LIST |
| 290 |
.iter() |
| 291 |
.map(|(name, description)| Row::new(*name).secondary(*description)), |
| 292 |
); |
| 293 |
|
| 294 |
let mut page = Slot::new(PAGE_REGION, RegionKind::Pane) |
| 295 |
.with(Node::page("Use Cases")) |
| 296 |
.with(Node::text( |
| 297 |
"A flat monthly fee. 0% platform cut. Who it's built for:", |
| 298 |
)) |
| 299 |
.with(Node::section("Available now")) |
| 300 |
.with(Node::Region(profiles)) |
| 301 |
.with(Node::section("Everyone gets")) |
| 302 |
.with(Node::Region( |
| 303 |
Slot::new(UNIVERSAL, RegionKind::Group).with(universal), |
| 304 |
)) |
| 305 |
.with(Node::act( |
| 306 |
"Join the Alpha", |
| 307 |
Action::get("/join").navigating(), |
| 308 |
)); |
| 309 |
|
| 310 |
for (label, route) in ONWARD { |
| 311 |
page = page.with(Node::act(*label, Action::get(*route).navigating())); |
| 312 |
} |
| 313 |
|
| 314 |
Described::single("Use Cases - Makenotwork") |
| 315 |
.measured(MEASURE) |
| 316 |
.documented( |
| 317 |
Document::default().classed(crate::shell::body_class(MEASURE, &["use-cases-page"])), |
| 318 |
) |
| 319 |
.summarised( |
| 320 |
"A flat monthly fee and no platform cut, for musicians, podcasters, writers, \ |
| 321 |
developers and six more kinds of creator.", |
| 322 |
) |
| 323 |
.with(page) |
| 324 |
} |
| 325 |
|
| 326 |
|
| 327 |
|
| 328 |
|
| 329 |
|
| 330 |
fn card(profile: &Profile, prices: &TierPrices) -> Slot { |
| 331 |
let features = Node::list(profile.features.iter().map(|feature| Row::new(*feature))); |
| 332 |
|
| 333 |
Slot::new(profile.anchor, RegionKind::Group) |
| 334 |
.label(profile.title) |
| 335 |
.with(Node::text(profile.who)) |
| 336 |
.with(Node::text(profile.description)) |
| 337 |
.with(features) |
| 338 |
.with(Node::text(profile.priced.line(prices))) |
| 339 |
} |
| 340 |
|
| 341 |
|
| 342 |
|
| 343 |
|
| 344 |
#[must_use] |
| 345 |
pub fn renderer(viewer: &super::Viewer) -> Webview { |
| 346 |
Webview::new().with_shell(viewer.document_shell().with_body_first(format!( |
| 347 |
"{}{}", |
| 348 |
crate::shell::skip_link(PAGE_REGION), |
| 349 |
crate::shell::site_header(viewer.user.as_ref()), |
| 350 |
))) |
| 351 |
} |
| 352 |
|
| 353 |
#[cfg(test)] |
| 354 |
mod tests { |
| 355 |
use super::*; |
| 356 |
|
| 357 |
fn prices() -> TierPrices { |
| 358 |
TierPrices::default() |
| 359 |
} |
| 360 |
|
| 361 |
fn html() -> String { |
| 362 |
use quasi_axum::Serves as _; |
| 363 |
|
| 364 |
Webview::new().screen(&page_screen(&prices())) |
| 365 |
} |
| 366 |
|
| 367 |
|
| 368 |
|
| 369 |
|
| 370 |
#[test] |
| 371 |
fn the_document_carries_the_classes_the_template_carried() { |
| 372 |
let screen = page_screen(&prices()); |
| 373 |
|
| 374 |
assert_eq!( |
| 375 |
screen.document.body_class.as_deref(), |
| 376 |
Some("padded-page use-cases-page") |
| 377 |
); |
| 378 |
let rendered = html(); |
| 379 |
assert!( |
| 380 |
rendered.contains("class=\"padded-page use-cases-page\""), |
| 381 |
"{rendered}" |
| 382 |
); |
| 383 |
} |
| 384 |
|
| 385 |
|
| 386 |
|
| 387 |
#[test] |
| 388 |
fn every_profile_keeps_its_card_and_its_anchor() { |
| 389 |
let html = html(); |
| 390 |
|
| 391 |
assert_eq!(PROFILE_LIST.len(), 9, "the template drew nine"); |
| 392 |
for profile in PROFILE_LIST { |
| 393 |
assert!(html.contains(profile.anchor), "{} missing", profile.anchor); |
| 394 |
assert!(html.contains(profile.who), "{} missing", profile.who); |
| 395 |
for feature in profile.features { |
| 396 |
assert!( |
| 397 |
html.contains(feature), |
| 398 |
"{feature} missing from {}", |
| 399 |
profile.title |
| 400 |
); |
| 401 |
} |
| 402 |
} |
| 403 |
} |
| 404 |
|
| 405 |
|
| 406 |
|
| 407 |
|
| 408 |
#[test] |
| 409 |
fn every_tier_line_comes_from_the_live_prices() { |
| 410 |
let mut prices = prices(); |
| 411 |
prices.basic_std = 4321; |
| 412 |
prices.small_files_std = 5678; |
| 413 |
prices.big_files_std = 8765; |
| 414 |
|
| 415 |
let html = { |
| 416 |
use quasi_axum::Serves as _; |
| 417 |
Webview::new().screen(&page_screen(&prices)) |
| 418 |
}; |
| 419 |
|
| 420 |
assert!(html.contains("4321"), "the Basic price is not read: {html}"); |
| 421 |
assert!(html.contains("5678"), "the Small Files price is not read"); |
| 422 |
assert!(html.contains("8765"), "the Big Files price is not read"); |
| 423 |
} |
| 424 |
|
| 425 |
|
| 426 |
|
| 427 |
#[test] |
| 428 |
fn the_educators_card_names_both_tiers_it_fits_in() { |
| 429 |
let mut prices = prices(); |
| 430 |
prices.basic_std = 4321; |
| 431 |
prices.small_files_std = 5678; |
| 432 |
|
| 433 |
let line = Priced::BasicOrSmallFiles.line(&prices); |
| 434 |
|
| 435 |
assert!(line.contains("4321") && line.contains("5678"), "{line}"); |
| 436 |
} |
| 437 |
|
| 438 |
|
| 439 |
#[test] |
| 440 |
fn the_page_spells_no_spinner() { |
| 441 |
let html = html(); |
| 442 |
|
| 443 |
for spelling in ["htmx-indicator", "spinner", "loading-text", "loading-state"] { |
| 444 |
assert!(!html.contains(spelling), "{spelling} survives in {html}"); |
| 445 |
} |
| 446 |
} |
| 447 |
} |
| 448 |
|