This commit is contained in:
Adam 2024-01-16 12:47:02 -05:00
parent 48a4903cb7
commit 78ffa6b738
4 changed files with 28 additions and 6 deletions

16
doordesk/Cargo.lock generated
View file

@ -86,6 +86,7 @@ dependencies = [
"leptos_axum",
"leptos_meta",
"leptos_router",
"markdown",
"serde",
"thiserror",
]
@ -1333,6 +1334,15 @@ dependencies = [
"quote",
]
[[package]]
name = "markdown"
version = "1.0.0-alpha.16"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5b0f0025e8c0d89b84d6dc63e859475e40e8e82ab1a08be0a93ad5731513a508"
dependencies = [
"unicode-id",
]
[[package]]
name = "matchit"
version = "0.7.3"
@ -2408,6 +2418,12 @@ version = "0.3.14"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6f2528f27a9eb2b21e69c95319b30bd0efd85d09c379741b0f78ea1d86be2416"
[[package]]
name = "unicode-id"
version = "0.3.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b1b6def86329695390197b82c1e244a54a131ceb66c996f2088a3876e2ae083f"
[[package]]
name = "unicode-ident"
version = "1.0.12"

View file

@ -15,6 +15,7 @@ http.workspace = true
cfg-if.workspace = true
thiserror.workspace = true
serde = "1.0.195"
markdown = "1.0.0-alpha.16"
[features]
default = []

View file

@ -12,7 +12,7 @@ pub fn Article(data: ArticleData) -> impl IntoView {
</h1>
<hr class="opacity-50"/>
<span class="pt-0 pb-3.5 text-xs opacity-50 m-t">{&data.date}</span>
<div>{&data.content}</div>
<div inner_html={&data.content}></div>
</article>
</Transition>
}

View file

@ -1,9 +1,6 @@
use leptos::*;
use serde::{Deserialize, Serialize};
use std::thread::sleep;
use std::time::Duration;
pub fn fetch(path: &str) -> String {
format!("https://dennis.doordesk.net/{path}")
}
@ -18,21 +15,29 @@ pub struct ArticleData {
#[server(Slingshot)]
pub async fn slingshot() -> Result<Vec<ArticleData>, ServerFnError> {
let md1: String = markdown::to_html("[test](https://lickmysa.cc)");
let md2: String = markdown::to_html("[test2](https://lickmysa.cc)");
let data_vec = vec![
ArticleData {
content_type: String::from("Blog"),
title: String::from("Test article"),
date: String::from("12/21/2022"),
content: String::from("Testicles"),
content: md1,
},
ArticleData {
content_type: String::from("Blog"),
title: String::from("Test article 2"),
date: String::from("12/22/2022"),
content: String::from("Testicless"),
content: md2,
},
];
// Simulate lag
use std::thread::sleep;
use std::time::Duration;
sleep(Duration::from_secs(1));
Ok(data_vec)
}