diff --git a/src/main.rs b/src/main.rs index e7a11a9..ff06bc3 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,3 +1,7 @@ -fn main() { - println!("Hello, world!"); -} +use void_be::web_app_backend; + +#[rocket::main] +async fn main() -> Result<(), rocket::Error> { + let _rocket = web_app_backend::build_rocket().await.launch().await; + Ok(()) +} \ No newline at end of file diff --git a/templates/index.html.hbs b/templates/index.html.hbs new file mode 100644 index 0000000..babfafc --- /dev/null +++ b/templates/index.html.hbs @@ -0,0 +1,13 @@ + + + + {{app_title}} + + + + {{{style_include}}} + + +
{{{test}}}
+ + \ No newline at end of file diff --git a/void-be/src/lib.rs b/void-be/src/lib.rs index 7d12d9a..159cf77 100644 --- a/void-be/src/lib.rs +++ b/void-be/src/lib.rs @@ -1,14 +1,40 @@ -pub fn add(left: usize, right: usize) -> usize { - left + right -} -#[cfg(test)] -mod tests { - use super::*; +//! # Rust Letter Backend +//! +//! `rust_letter_be` handles the backend execution using Rocket. - #[test] - fn it_works() { - let result = add(2, 2); - assert_eq!(result, 4); +#[macro_use] +extern crate rocket; + +/// A module that handles the backend for the site. +pub mod web_app_backend { + + use rocket::fs::FileServer; + use rocket::{Rocket, Build}; + use rocket_dyn_templates::{Template, context}; + use void_fe::void_app::{self, VirtualDom}; + + #[get("/")] + async fn index() -> Template { + let mut vdom = VirtualDom::new(void_app::App); + let _ = vdom.rebuild(); + let output = dioxus_ssr::render(&vdom); + Template::render( + "index", + context! { + app_title: "A Letter to the Void", + style_include: "", + test: &output + }, + ) + } + + /// This runs `rocket::build()` with the needed mounts and routes. + pub async fn build_rocket() -> Rocket { + rocket::build() + .mount("/images", FileServer::from("public/images")) + .mount("/styles", FileServer::from("public/styles")) + .mount("/fonts", FileServer::from("public/fonts")) + .mount("/", routes![index]).attach(Template::fairing()) } } diff --git a/void-fe/data/poems/audio-reading.md b/void-fe/data/poems/2021-02-27_audio-reading.md similarity index 99% rename from void-fe/data/poems/audio-reading.md rename to void-fe/data/poems/2021-02-27_audio-reading.md index 4566879..a98c1c3 100644 --- a/void-fe/data/poems/audio-reading.md +++ b/void-fe/data/poems/2021-02-27_audio-reading.md @@ -1,5 +1,4 @@ # im on repeat - [Audio reading](https://cloud.werefox.dev/s/dq5ccm5QqmMF4GB) Death is like a memory. Ceaseless, and comforting\ diff --git a/void-fe/data/poems/iced-coffee.md b/void-fe/data/poems/2021-02-28_iced-coffee.md similarity index 99% rename from void-fe/data/poems/iced-coffee.md rename to void-fe/data/poems/2021-02-28_iced-coffee.md index 134a2ab..3f97b03 100644 --- a/void-fe/data/poems/iced-coffee.md +++ b/void-fe/data/poems/2021-02-28_iced-coffee.md @@ -1,5 +1,4 @@ # Iced Coffee - [Listen to the song on Soundcloud](https://soundcloud.com/alexis-werefox/iced-coffee/s-5SgBwPrLwyR) *Iced coffee on a cold Winter's day* \ diff --git a/void-fe/data/poems/sweetheart-sweet-tea-6ck4.md b/void-fe/data/poems/2021-03-01_sweetheart-sweet-tea-6ck4.md similarity index 99% rename from void-fe/data/poems/sweetheart-sweet-tea-6ck4.md rename to void-fe/data/poems/2021-03-01_sweetheart-sweet-tea-6ck4.md index 4aa43dc..6292ecd 100644 --- a/void-fe/data/poems/sweetheart-sweet-tea-6ck4.md +++ b/void-fe/data/poems/2021-03-01_sweetheart-sweet-tea-6ck4.md @@ -1,5 +1,4 @@ # Sweetheart, Sweet Tea - Do you remember? \ The first time that we had met \ Oh, I'm sure I don't regret that memory \ diff --git a/void-fe/data/poems/writing-myself-into-my-own-grave-ill-never-be-happy.md b/void-fe/data/poems/2021-03-02_writing-myself-into-my-own-grave-ill-never-be-happy.md similarity index 99% rename from void-fe/data/poems/writing-myself-into-my-own-grave-ill-never-be-happy.md rename to void-fe/data/poems/2021-03-02_writing-myself-into-my-own-grave-ill-never-be-happy.md index 5e4d6ec..fa4d6de 100644 --- a/void-fe/data/poems/writing-myself-into-my-own-grave-ill-never-be-happy.md +++ b/void-fe/data/poems/2021-03-02_writing-myself-into-my-own-grave-ill-never-be-happy.md @@ -1,5 +1,4 @@ # Writing Myself Into My Own Grave (“I’ll never be happy”) - *You should keep your distance*\ *You should never stay*\ *You should learn your lesson*\ diff --git a/void-fe/data/poems/introductions.md b/void-fe/data/poems/2021-03-03_introductions.md similarity index 99% rename from void-fe/data/poems/introductions.md rename to void-fe/data/poems/2021-03-03_introductions.md index 9877874..88ce2be 100644 --- a/void-fe/data/poems/introductions.md +++ b/void-fe/data/poems/2021-03-03_introductions.md @@ -1,5 +1,4 @@ # Introductions - Hi! I'm Alice, and um... Uh.\ I have something I wanna say, I guess... diff --git a/void-fe/data/poems/molded-hearts-and-melted-love.md b/void-fe/data/poems/2021-03-07_molded-hearts-and-melted-love.md similarity index 99% rename from void-fe/data/poems/molded-hearts-and-melted-love.md rename to void-fe/data/poems/2021-03-07_molded-hearts-and-melted-love.md index ade9908..d02bcec 100644 --- a/void-fe/data/poems/molded-hearts-and-melted-love.md +++ b/void-fe/data/poems/2021-03-07_molded-hearts-and-melted-love.md @@ -1,5 +1,4 @@ # Molded Hearts and Melted Love - *Author’s Note: This song/poem has heavy overtones of relationship abuse. Please be aware of that before you read.* I’ve never been the one to think I’m waiting on their time\ diff --git a/void-fe/data/poems/poetry-to-the-void.md b/void-fe/data/poems/2021-03-07_poetry-to-the-void.md similarity index 99% rename from void-fe/data/poems/poetry-to-the-void.md rename to void-fe/data/poems/2021-03-07_poetry-to-the-void.md index 917f1e7..59349e3 100644 --- a/void-fe/data/poems/poetry-to-the-void.md +++ b/void-fe/data/poems/2021-03-07_poetry-to-the-void.md @@ -1,5 +1,4 @@ # Poetry to the Void - *Author's note: here's a bit of freeform poetry I wrote a while back that I thought I'd share. I know it doesn't flow super well, but I'm proud of it, and I think it's good sometimes to write stuff that's a bit off beat when it's meaningful to do so* Empty hearts and empty sheets \ diff --git a/void-fe/data/poems/a-moments-rest-at-a-peaceful-shore.md b/void-fe/data/poems/2021-03-08_a-moments-rest-at-a-peaceful-shore.md similarity index 99% rename from void-fe/data/poems/a-moments-rest-at-a-peaceful-shore.md rename to void-fe/data/poems/2021-03-08_a-moments-rest-at-a-peaceful-shore.md index eb5e6cc..bda0322 100644 --- a/void-fe/data/poems/a-moments-rest-at-a-peaceful-shore.md +++ b/void-fe/data/poems/2021-03-08_a-moments-rest-at-a-peaceful-shore.md @@ -1,5 +1,4 @@ # A Moment's Rest at a Peaceful Shore - The wind calms, the storm in my mind settles\ The static pervading off the edges of my mind's perspective finally begins to focus itself into a clearer darkness diff --git a/void-fe/data/poems/black-rose-gray-skies.md b/void-fe/data/poems/2021-03-13_black-rose-gray-skies.md similarity index 99% rename from void-fe/data/poems/black-rose-gray-skies.md rename to void-fe/data/poems/2021-03-13_black-rose-gray-skies.md index e113510..6965b34 100644 --- a/void-fe/data/poems/black-rose-gray-skies.md +++ b/void-fe/data/poems/2021-03-13_black-rose-gray-skies.md @@ -1,5 +1,4 @@ # Black Rose, Gray Skies - **[Intro]**\ Black rose, thorns sharp and trapped inside a clear vessel\ Petals falling, won't you please come and save this wilting weed\ diff --git a/void-fe/data/poems/bittersweet-cheers.md b/void-fe/data/poems/2021-03-17_bittersweet-cheers.md similarity index 99% rename from void-fe/data/poems/bittersweet-cheers.md rename to void-fe/data/poems/2021-03-17_bittersweet-cheers.md index f193beb..fb96bf7 100644 --- a/void-fe/data/poems/bittersweet-cheers.md +++ b/void-fe/data/poems/2021-03-17_bittersweet-cheers.md @@ -1,5 +1,4 @@ # Bittersweet, Cheers - **[Intro]**\ *things are gonna change, yeah*\ *things are gonna change*\ diff --git a/void-fe/data/poems/notification-high.md b/void-fe/data/poems/2021-03-18_notification-high.md similarity index 99% rename from void-fe/data/poems/notification-high.md rename to void-fe/data/poems/2021-03-18_notification-high.md index b5d4c37..bf558fc 100644 --- a/void-fe/data/poems/notification-high.md +++ b/void-fe/data/poems/2021-03-18_notification-high.md @@ -1,5 +1,4 @@ # Notification High - **[Chorus]**\ *I'm hot, I'm cool, I'm the best you've ever seen*\ *not my ego, not a brag, just the facts up on the screen*\ diff --git a/void-fe/data/poems/echoes.md b/void-fe/data/poems/2021-03-28_echoes.md similarity index 99% rename from void-fe/data/poems/echoes.md rename to void-fe/data/poems/2021-03-28_echoes.md index 0077dcc..4a3159c 100644 --- a/void-fe/data/poems/echoes.md +++ b/void-fe/data/poems/2021-03-28_echoes.md @@ -1,5 +1,4 @@ # Echoes - **[Verse 1]** *Echoes*\ diff --git a/void-fe/data/poems/youll-grow-out-of-this.md b/void-fe/data/poems/2021-03-29_youll-grow-out-of-this.md similarity index 99% rename from void-fe/data/poems/youll-grow-out-of-this.md rename to void-fe/data/poems/2021-03-29_youll-grow-out-of-this.md index 08f10f3..2ae3fb1 100644 --- a/void-fe/data/poems/youll-grow-out-of-this.md +++ b/void-fe/data/poems/2021-03-29_youll-grow-out-of-this.md @@ -1,5 +1,4 @@ # "You'll Grow Out Of This" - **[Verse 1]** *I write songs I'll never sing*\ diff --git a/void-fe/data/poems/foxes-are-predators.md b/void-fe/data/poems/2021-04-04_foxes-are-predators.md similarity index 99% rename from void-fe/data/poems/foxes-are-predators.md rename to void-fe/data/poems/2021-04-04_foxes-are-predators.md index fdc56be..36811be 100644 --- a/void-fe/data/poems/foxes-are-predators.md +++ b/void-fe/data/poems/2021-04-04_foxes-are-predators.md @@ -1,5 +1,4 @@ # Foxes Are Predators - *I used to think about the monsters underneath my bed*\ *Hiding in the darkness, now they're stuck inside my head*\ *Why does everything I write feel like a call for help?*\ diff --git a/void-fe/data/poems/missing-the-mark.md b/void-fe/data/poems/2021-04-27_missing-the-mark.md similarity index 99% rename from void-fe/data/poems/missing-the-mark.md rename to void-fe/data/poems/2021-04-27_missing-the-mark.md index 4dddad6..a24faaa 100644 --- a/void-fe/data/poems/missing-the-mark.md +++ b/void-fe/data/poems/2021-04-27_missing-the-mark.md @@ -1,5 +1,4 @@ # Missing The Mark - *Lately I've been thinking 'bout how miserable I've been*\ *Sadness never comforts me, but it's been my best friend*\ *And I could write more lines 'bout how I wish I could see*\ diff --git a/void-fe/data/poems/support-class.md b/void-fe/data/poems/2021-05-19_support-class.md similarity index 99% rename from void-fe/data/poems/support-class.md rename to void-fe/data/poems/2021-05-19_support-class.md index f13e8a6..c331761 100644 --- a/void-fe/data/poems/support-class.md +++ b/void-fe/data/poems/2021-05-19_support-class.md @@ -1,5 +1,4 @@ # Support Class - *Words like knives carving thoughts into the pages of my life*\ *Like scattered scraps of paper torn and fluttering in the wind*\ *So too am I temporary and fleeting* diff --git a/void-fe/data/poems/i-wish-i-wore-my-garters.md b/void-fe/data/poems/2021-05-27_i-wish-i-wore-my-garters.md similarity index 99% rename from void-fe/data/poems/i-wish-i-wore-my-garters.md rename to void-fe/data/poems/2021-05-27_i-wish-i-wore-my-garters.md index 4c9e0ec..93a48c7 100644 --- a/void-fe/data/poems/i-wish-i-wore-my-garters.md +++ b/void-fe/data/poems/2021-05-27_i-wish-i-wore-my-garters.md @@ -1,5 +1,4 @@ # I Wish I Wore My Garters - *I hate my bedroom door*\ *I have to try a couple times to push it open*\ *I hate to feel like I'm confined*\ diff --git a/void-fe/data/poems/since-when-did-winter-end.md b/void-fe/data/poems/2021-07-21_since-when-did-winter-end.md similarity index 99% rename from void-fe/data/poems/since-when-did-winter-end.md rename to void-fe/data/poems/2021-07-21_since-when-did-winter-end.md index 2336bbd..84f92f5 100644 --- a/void-fe/data/poems/since-when-did-winter-end.md +++ b/void-fe/data/poems/2021-07-21_since-when-did-winter-end.md @@ -1,5 +1,4 @@ # Since When Did Winter End - *I’m a mess*\ *A disaster, but I see it in a better light now than I did before*\ *I’m a mess*\ diff --git a/void-fe/data/poems/shes-not-who-she-used-to-be.md b/void-fe/data/poems/2021-07-25_shes-not-who-she-used-to-be.md similarity index 99% rename from void-fe/data/poems/shes-not-who-she-used-to-be.md rename to void-fe/data/poems/2021-07-25_shes-not-who-she-used-to-be.md index 8d3a009..23630f2 100644 --- a/void-fe/data/poems/shes-not-who-she-used-to-be.md +++ b/void-fe/data/poems/2021-07-25_shes-not-who-she-used-to-be.md @@ -1,5 +1,4 @@ # She's Not Who She Used To Be - *She looks in the mirror and likes what she sees*\ *It's obvious she's not who she used to be*\ *Thought she had her life found out by 14*\ diff --git a/void-fe/data/poems/probably-bad-for-you.md b/void-fe/data/poems/2021-11-21_probably-bad-for-you.md similarity index 99% rename from void-fe/data/poems/probably-bad-for-you.md rename to void-fe/data/poems/2021-11-21_probably-bad-for-you.md index 262d81d..b630800 100644 --- a/void-fe/data/poems/probably-bad-for-you.md +++ b/void-fe/data/poems/2021-11-21_probably-bad-for-you.md @@ -1,5 +1,4 @@ # Probably Bad For You - *When did all the lights begin to fade away?*\ *I see them now, I see them now*\ *When did you decide to leave me hurt this way?*\ diff --git a/void-fe/data/poems/filtered-thoughts.md b/void-fe/data/poems/2022-01-20_filtered-thoughts.md similarity index 99% rename from void-fe/data/poems/filtered-thoughts.md rename to void-fe/data/poems/2022-01-20_filtered-thoughts.md index 182132f..1658bc3 100644 --- a/void-fe/data/poems/filtered-thoughts.md +++ b/void-fe/data/poems/2022-01-20_filtered-thoughts.md @@ -1,5 +1,4 @@ # Filtered Thoughts - *Sometimes I wonder if I could write to save my life*\ *Sometimes I wonder if all the effort's worth the strife*\ *I've been down this road before and now the twists are turns are pleasant*\ diff --git a/void-fe/data/poems/i-can-never-see-past-next-week.md b/void-fe/data/poems/2022-05-22_i-can-never-see-past-next-week.md similarity index 99% rename from void-fe/data/poems/i-can-never-see-past-next-week.md rename to void-fe/data/poems/2022-05-22_i-can-never-see-past-next-week.md index 7924f99..bc87752 100644 --- a/void-fe/data/poems/i-can-never-see-past-next-week.md +++ b/void-fe/data/poems/2022-05-22_i-can-never-see-past-next-week.md @@ -1,5 +1,4 @@ # I can never see past next week - *A moment of peace in a busy world of busy people*\ *Staring out the window, the view of the balcony just blissfully capturing what my heart feels*\ *Though the loving embrace of the morning sun shines on me again, I can't help but let those thoughts intrude*\ diff --git a/void-fe/data/poems/27.md b/void-fe/data/poems/2022-09-06_27.md similarity index 99% rename from void-fe/data/poems/27.md rename to void-fe/data/poems/2022-09-06_27.md index d7d01e4..b9cafc4 100644 --- a/void-fe/data/poems/27.md +++ b/void-fe/data/poems/2022-09-06_27.md @@ -1,5 +1,4 @@ # 27 - **27**\ *I used to think that day was just a far off dream for me*\ *Dreading when I wake because I can't see past next week*\ diff --git a/void-fe/data/poems/they-said-i-could-be-anything-when-i-grew-up-but-i-was-already-a-girl-im.md b/void-fe/data/poems/2023-01-31_they-said-i-could-be-anything-when-i-grew-up-but-i-was-already-a-girl-im.md similarity index 99% rename from void-fe/data/poems/they-said-i-could-be-anything-when-i-grew-up-but-i-was-already-a-girl-im.md rename to void-fe/data/poems/2023-01-31_they-said-i-could-be-anything-when-i-grew-up-but-i-was-already-a-girl-im.md index 7e25164..13649cd 100644 --- a/void-fe/data/poems/they-said-i-could-be-anything-when-i-grew-up-but-i-was-already-a-girl-im.md +++ b/void-fe/data/poems/2023-01-31_they-said-i-could-be-anything-when-i-grew-up-but-i-was-already-a-girl-im.md @@ -1,5 +1,4 @@ # They Said I Could Be Anything When I Grew Up, But I Was Already A Girl (I'm Living Proof) - *I still can't see past next week\ It feels like an eternity and I\ Can't keep waiting up\ diff --git a/void-fe/data/poems/drop-kicked-from-senselessness.md b/void-fe/data/poems/2023-02-15_drop-kicked-from-senselessness.md similarity index 99% rename from void-fe/data/poems/drop-kicked-from-senselessness.md rename to void-fe/data/poems/2023-02-15_drop-kicked-from-senselessness.md index ae86aa0..5f9e12a 100644 --- a/void-fe/data/poems/drop-kicked-from-senselessness.md +++ b/void-fe/data/poems/2023-02-15_drop-kicked-from-senselessness.md @@ -1,5 +1,4 @@ # Drop Kicked From Senselessness - *Soft, muttered frequencies on the periphery of my subconscious*\ *A tune I used to hear that flickers its presence*\ *Giving me leverage of which to confine myself within the most secluded of spaces*\ diff --git a/void-fe/data/poems/what-do-you-mean-youre-not-gay-you-fucking-dated-me.md b/void-fe/data/poems/2023-02-28_what-do-you-mean-youre-not-gay-you-fucking-dated-me.md similarity index 99% rename from void-fe/data/poems/what-do-you-mean-youre-not-gay-you-fucking-dated-me.md rename to void-fe/data/poems/2023-02-28_what-do-you-mean-youre-not-gay-you-fucking-dated-me.md index 03158bf..fabce54 100644 --- a/void-fe/data/poems/what-do-you-mean-youre-not-gay-you-fucking-dated-me.md +++ b/void-fe/data/poems/2023-02-28_what-do-you-mean-youre-not-gay-you-fucking-dated-me.md @@ -1,5 +1,4 @@ # What do you mean you're not gay, you fucking dated me - *Waiting on you to blink me to life*\ *She said I'm her backup [gal] in the end*\ *I've never been one to pull away*\ diff --git a/void-fe/data/poems/senseless-murmurs-of-the-estranged-the-last-night.md b/void-fe/data/poems/2023-03-03_senseless-murmurs-of-the-estranged-the-last-night.md similarity index 99% rename from void-fe/data/poems/senseless-murmurs-of-the-estranged-the-last-night.md rename to void-fe/data/poems/2023-03-03_senseless-murmurs-of-the-estranged-the-last-night.md index 0fe65ee..9366aaa 100644 --- a/void-fe/data/poems/senseless-murmurs-of-the-estranged-the-last-night.md +++ b/void-fe/data/poems/2023-03-03_senseless-murmurs-of-the-estranged-the-last-night.md @@ -1,5 +1,4 @@ # Senseless Murmurs of the Estranged (~~The~~ Last Night) - *Slithering fangs and pointy tails*\ *Tell me if I'm not feeling well*\ *My mindscape's hazard lights sing symphonies that plead me not to crash*\ diff --git a/void-fe/dist/assets/dioxus/snippets/dioxus-interpreter-js-1676574062e4c953/inline0.js b/void-fe/dist/assets/dioxus/snippets/dioxus-interpreter-js-1676574062e4c953/inline0.js index 8467b5d..68a9de7 100644 --- a/void-fe/dist/assets/dioxus/snippets/dioxus-interpreter-js-1676574062e4c953/inline0.js +++ b/void-fe/dist/assets/dioxus/snippets/dioxus-interpreter-js-1676574062e4c953/inline0.js @@ -1,4 +1,4 @@ -let m,p,ls,lss,sp,d,t,c,s,sl,op,i,e,z,index,value,ns,n,ptr,many,text,event_name,len,root,id,field,bubbles,tmpl_id;const evt = [];const attr = [];const ns_cache = []; +let m,p,ls,lss,sp,d,t,c,s,sl,op,i,e,z,text,ptr,n,field,value,root,len,tmpl_id,index,many,id,event_name,bubbles,ns;const evt = [];const attr = [];const ns_cache = []; class ListenerMap { constructor(root) { // bubbling events can listen at the root element diff --git a/void-fe/dist/assets/dioxus/void-werefox-cafe_bg.wasm b/void-fe/dist/assets/dioxus/void-werefox-cafe_bg.wasm index fa9af2f..25ff552 100644 Binary files a/void-fe/dist/assets/dioxus/void-werefox-cafe_bg.wasm and b/void-fe/dist/assets/dioxus/void-werefox-cafe_bg.wasm differ diff --git a/void-fe/src/lib.rs b/void-fe/src/lib.rs index 3a06aa2..bc17b6f 100644 --- a/void-fe/src/lib.rs +++ b/void-fe/src/lib.rs @@ -7,8 +7,6 @@ /// A module that handles the functions needed /// to render the site. pub mod void_app { - use std::borrow::Borrow; - // import the prelude to get access to the `rsx!` macro and the `Scope` and `Element` types pub use dioxus::prelude::*; use rust_embed::RustEmbed; @@ -18,9 +16,22 @@ pub mod void_app { // pub poems: Vec, // } + #[derive(PartialEq, Props)] + struct PoemData { + title: String, + content: String, + creation_date: String, + } + + #[derive(PartialEq, Props)] + struct PoemTitle { + title: String, + } + #[derive(PartialEq, Props)] struct PoemContent { content: String, + creation_date: String, } #[derive(RustEmbed)] #[folder = "data/poems"] @@ -32,20 +43,42 @@ pub mod void_app { div { class: "min-h-screen font-nerd bg-alice-werefox-grey-light dark:bg-alice-werefox-grey", div { class: "container space-y-4 mx-auto p-4", Poems::iter().map(|p| { - let poem_content = Poems::get(&p).expect("Found poem {&p:?}"); - let poem_to_str = std::str::from_utf8(poem_content.data.as_ref()).expect("Content is valid UT8."); - let poem_to_html_string = markdown::to_html(poem_to_str); - rsx!{ MakePoem{ content: poem_to_html_string } } - }) + let creation_date = String::from(String::from("
Written on: ") + p.split("_").next().unwrap()); + let poem_content = Poems::get(&p).expect("Found poem {&p:?}"); + let mut poem_to_str = std::str::from_utf8(poem_content.data.as_ref()).expect("Title is valid UT8.").lines(); + let poem_title = poem_to_str.next().unwrap(); + let poem_content = poem_to_str.into_iter().collect::>().join("\n"); + let poem_title_to_html_string = markdown::to_html(poem_title); + let poem_content_to_html_string = markdown::to_html(poem_content.as_str()); + rsx!{ MakePoem{ title: poem_title_to_html_string, content: poem_content_to_html_string, creation_date: creation_date } } + }) } } )) } + #[cfg(any(target_family = "unix", target_family = "windows"))] + fn RenderPoemTitle(cx: Scope) -> Element { + cx.render(rsx!( + span { class: "mx-auto max-w-fit flex justify-center bg-alice-werefox-grey-lightest dark:bg-alice-werefox-grey-dark border-4 border-alice-werefox-red-dark dark:border-alice-werefox-red text-alice-werefox-red-dark dark:text-alice-werefox-red-light p-4", + "{cx.props.title}" + } + )) + } + + #[cfg(target_family = "wasm")] + fn RenderPoemTitle(cx: Scope) -> Element { + cx.render(rsx!( + p { class: "mx-auto max-w-fit flex justify-center bg-alice-werefox-grey-lightest dark:bg-alice-werefox-grey-dark border-4 border-alice-werefox-red-dark dark:border-alice-werefox-red text-alice-werefox-red-dark dark:text-alice-werefox-red-light p-4", + dangerous_inner_html: "{cx.props.title}", + } + )) + } + #[cfg(any(target_family = "unix", target_family = "windows"))] fn RenderPoemElement(cx: Scope) -> Element { cx.render(rsx!( - div { class: "font-nerd flex flex-col space-y-4 mx-4 py-4", "{cx.props.content}" } + div { class: "font-nerd flex flex-col space-y-4 mx-4 py-4", "{cx.props.content}{cx.props.creation_date}" } )) } @@ -53,21 +86,19 @@ pub mod void_app { fn RenderPoemElement(cx: Scope) -> Element { cx.render(rsx!(div { class: "font-nerd flex flex-col space-y-4 mx-4 py-4", - dangerous_inner_html: "{cx.props.content}" + dangerous_inner_html: "{cx.props.content}{cx.props.creation_date}" })) } - fn MakePoem(cx: Scope) -> Element { + fn MakePoem(cx: Scope) -> Element { cx.render(rsx!( div { class: "flex-col space-y-4", - p { class: "mx-auto max-w-fit flex justify-center bg-alice-werefox-grey-lightest dark:bg-alice-werefox-grey-dark border-4 border-alice-werefox-red-dark dark:border-alice-werefox-red text-alice-werefox-red-dark dark:text-alice-werefox-red-light p-4", - "POEM NAME HERE" - } + RenderPoemTitle { title: cx.props.title.clone() } details { class: "mx-auto max-w-fit space-y-4 bg-alice-werefox-grey-lightest dark:bg-alice-werefox-grey-dark border-4 border-alice-werefox-red-dark dark:border-alice-werefox-red text-alice-werefox-red-dark dark:text-alice-werefox-red-light p-4", summary { class: "flex justify-center border-4 bg-alice-werefox-grey-lightest dark:bg-alice-werefox-grey-dark border-alice-werefox-red-dark dark:border-alice-werefox-red text-alice-werefox-red-dark dark:text-alice-werefox-red-light p-4", "Open" } - RenderPoemElement { content: cx.props.content.clone() } + RenderPoemElement { content: cx.props.content.clone(), creation_date: cx.props.creation_date.clone() } } } )) diff --git a/void-fe/src/main.rs b/void-fe/src/main.rs index 5189980..bd8db1e 100644 --- a/void-fe/src/main.rs +++ b/void-fe/src/main.rs @@ -8,10 +8,5 @@ fn main() { wasm_logger::init(wasm_logger::Config::default()); console_error_panic_hook::set_once(); - // let mut content = Vec::new(); - // for f in Poems::iter() { - // content.push(markdown::to_html(&f)); - // } - dioxus_web::launch(void_app::App); }