aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorXe Iaso <me@christine.website>2023-01-23 09:54:22 -0500
committerXe Iaso <me@christine.website>2023-01-23 09:54:53 -0500
commit295a2f993db8b1f7bb45d5d1d9c621ffe6400e58 (patch)
treeb2a05e83fd8ddbe0442cc887b2653b3d6d8dbba9 /src
parent36e516527d76954aa5434e66102f12c2c87a8637 (diff)
downloadxesite-295a2f993db8b1f7bb45d5d1d9c621ffe6400e58.tar.xz
xesite-295a2f993db8b1f7bb45d5d1d9c621ffe6400e58.zip
Add page that explains the characters in the blog
Signed-off-by: Xe <me@christine.website>
Diffstat (limited to 'src')
-rw-r--r--src/app/config.rs52
-rw-r--r--src/handlers/mod.rs9
-rw-r--r--src/main.rs1
-rw-r--r--src/tmpl/mod.rs19
4 files changed, 75 insertions, 6 deletions
diff --git a/src/app/config.rs b/src/app/config.rs
index d3d93ca..7ea46fd 100644
--- a/src/app/config.rs
+++ b/src/app/config.rs
@@ -28,17 +28,18 @@ pub struct Config {
#[serde(rename = "contactLinks")]
pub contact_links: Vec<Link>,
pub pronouns: Vec<PronounSet>,
+ pub characters: Vec<Character>,
}
#[derive(Clone, Deserialize, Serialize, Default)]
pub struct PronounSet {
- nominative: String,
- accusative: String,
+ pub nominative: String,
+ pub accusative: String,
#[serde(rename = "possessiveDeterminer")]
- possessive_determiner: String,
- possessive: String,
- reflexive: String,
- singular: bool,
+ pub possessive_determiner: String,
+ pub possessive: String,
+ pub reflexive: String,
+ pub singular: bool,
}
impl Render for PronounSet {
@@ -87,6 +88,45 @@ impl Render for PronounSet {
}
#[derive(Clone, Deserialize, Serialize, Default)]
+pub struct Character {
+ pub name: String,
+ #[serde(rename = "stickerName")]
+ pub sticker_name: String,
+ #[serde(rename = "defaultPose")]
+ pub default_pose: String,
+ pub description: String,
+ pub pronouns: PronounSet,
+ pub stickers: Vec<String>,
+}
+
+impl Render for Character {
+ fn render(&self) -> Markup {
+ html! {
+ h2 #(self.sticker_name) {(self.name)}
+ (xesite_templates::sticker(self.sticker_name.clone(), self.default_pose.clone()))
+ p {(self.description)}
+ details {
+ summary { "Pronouns (" (self.pronouns.nominative) "/" (self.pronouns.accusative) ")" }
+ (self.pronouns)
+ }
+
+ details {
+ summary { "All stickers" }
+ .grid {
+ @for sticker in &self.stickers {
+ .cell."-3of12" {
+ (xesite_templates::sticker(self.sticker_name.clone(), sticker.clone()))
+ br;
+ (sticker)
+ }
+ }
+ }
+ }
+ }
+ }
+}
+
+#[derive(Clone, Deserialize, Serialize, Default)]
pub struct Link {
pub url: String,
pub title: String,
diff --git a/src/handlers/mod.rs b/src/handlers/mod.rs
index 7284ec9..a638c77 100644
--- a/src/handlers/mod.rs
+++ b/src/handlers/mod.rs
@@ -69,6 +69,15 @@ lazy_static! {
}
#[instrument(skip(state))]
+pub async fn characters(Extension(state): Extension<Arc<State>>) -> Markup {
+ HIT_COUNTER.with_label_values(&["characters"]).inc();
+ let state = state.clone();
+ let cfg = state.cfg.clone();
+
+ tmpl::characters(&cfg.characters)
+}
+
+#[instrument(skip(state))]
pub async fn index(Extension(state): Extension<Arc<State>>) -> Result<Markup> {
HIT_COUNTER.with_label_values(&["index"]).inc();
let state = state.clone();
diff --git a/src/main.rs b/src/main.rs
index aaf4ea4..c5b0472 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -167,6 +167,7 @@ async fn main() -> Result<()> {
.route("/api/talks/:name", get(handlers::api::talk))
// static pages
.route("/", get(handlers::index))
+ .route("/characters", get(handlers::characters))
.route("/contact", get(handlers::contact))
.route("/feeds", get(handlers::feeds))
.route("/resume", get(handlers::resume))
diff --git a/src/tmpl/mod.rs b/src/tmpl/mod.rs
index 2ad62c0..db4f720 100644
--- a/src/tmpl/mod.rs
+++ b/src/tmpl/mod.rs
@@ -233,6 +233,25 @@ pub fn contact(links: &Vec<Link>) -> Markup {
)
}
+pub fn characters(characters: &Vec<Character>) -> Markup {
+ base(
+ Some("Characters"),
+ None,
+ html! {
+ h1 {"Characters"}
+ p{
+ "When I am writing articles on this blog, sometimes I will use "
+ a href="https://en.wikipedia.org/wiki/Socratic_method" {"the Socratic method"}
+ " to help illustrate my point. These characters are written off of a set of tropes to help give them a place in the discussions. The characters are just that, characters. Their dialogues are fiction, unless otherwise indicated everything that happens in those dialogues are products of the author's imagination or are used in a fictitious manner. Any resemblance to actual persons (living or dead) is purely coincidental."
+ }
+
+ @for character in characters {
+ (character)
+ }
+ },
+ )
+}
+
pub fn patrons(patrons: &Users) -> Markup {
base(
Some("Patrons"),