From 295a2f993db8b1f7bb45d5d1d9c621ffe6400e58 Mon Sep 17 00:00:00 2001 From: Xe Iaso Date: Mon, 23 Jan 2023 09:54:22 -0500 Subject: Add page that explains the characters in the blog Signed-off-by: Xe --- src/app/config.rs | 52 ++++++++++++++++++++++++++++++++++++++++++++++------ 1 file changed, 46 insertions(+), 6 deletions(-) (limited to 'src/app') 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, pub pronouns: Vec, + pub characters: Vec, } #[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 { @@ -86,6 +87,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, +} + +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, -- cgit v1.2.3