In the process of making the testimonials page work properly.
This commit is contained in:
parent
9dde7cd945
commit
6d6d3f54d5
5
.gitignore
vendored
5
.gitignore
vendored
@ -19,4 +19,7 @@ Cargo.lock
|
||||
**/package.json
|
||||
|
||||
# Don't put the old code in the repo.
|
||||
**/.archive/**
|
||||
**/.archive/**
|
||||
|
||||
# Don't commit the access token to the repo.
|
||||
**/access_token.key
|
17
Cargo.toml
17
Cargo.toml
@ -10,8 +10,9 @@ edition = "2021"
|
||||
dioxus-autofmt = "0.5.0-alpha.0"
|
||||
console_error_panic_hook = "0.1.7"
|
||||
log = "0.4.17"
|
||||
manganis = "*"
|
||||
serde = "*"
|
||||
manganis = "0.2.2"
|
||||
serde = "1.0.197"
|
||||
toml = "0.8.12"
|
||||
|
||||
[dependencies.dioxus-router]
|
||||
version = "0.5.0-alpha.0"
|
||||
@ -23,9 +24,17 @@ features = ["web", "fullstack"]
|
||||
|
||||
[features]
|
||||
default = []
|
||||
server = ["dioxus/axum"]
|
||||
server = ["dioxus/axum", "dep:megalodon", "dep:tokio"]
|
||||
web = ["dioxus/web"]
|
||||
|
||||
[dependencies.time]
|
||||
verison = "0.3.34"
|
||||
features = ["wasm-bindgen", "macros", "local-offset"]
|
||||
features = ["wasm-bindgen", "macros", "local-offset"]
|
||||
|
||||
[dependencies.megalodon]
|
||||
version = "0.13.2"
|
||||
optional = true
|
||||
|
||||
[dependencies.tokio]
|
||||
version = "1.36.0"
|
||||
optional = true
|
43
data/testimonials.toml
Normal file
43
data/testimonials.toml
Normal file
@ -0,0 +1,43 @@
|
||||
[[accounts]]
|
||||
username = "@shroomie@0w0.is"
|
||||
content = "dragon woman play metroid good"
|
||||
|
||||
[[accounts]]
|
||||
username = "@deejvalen@plush.city"
|
||||
content = "A real Cutie Patootie"
|
||||
|
||||
[[accounts]]
|
||||
username = "@genderfaerie@tech.lbgt"
|
||||
content = "Alice is a rad friend and a cool person to know"
|
||||
|
||||
[[accounts]]
|
||||
username = "@colabunny@yiff.life"
|
||||
content = "Alice is cool, cute and silly. 10/10 derg"
|
||||
|
||||
[[accounts]]
|
||||
username = "@fibonacci_reminder@plush.city"
|
||||
content = "I think Alice is cool and good! She is nice and I'm glad that I know her."
|
||||
|
||||
[[accounts]]
|
||||
username = "@thufie@social.pixie.town"
|
||||
content = "a type of dragon!"
|
||||
|
||||
[[accounts]]
|
||||
username = "@GameDevWitch@tech.lgbt"
|
||||
content = "You are the best Werefox I have ever met."
|
||||
|
||||
[[accounts]]
|
||||
username = "@astraluma@tech.lgbt"
|
||||
content = "a good derg"
|
||||
|
||||
[[accounts]]
|
||||
username = "@heatherhorns@plush.city"
|
||||
content = "Alice kisses the girls and defeats the bad guys"
|
||||
|
||||
[[accounts]]
|
||||
username = "@tillianisafox@meow.social"
|
||||
content = "ur awesome"
|
||||
|
||||
[[accounts]]
|
||||
username = "@Anzeliane@eldritch.cafe"
|
||||
content = "ALICE HOW ARE YOU SO STUNNING HDKSJDNSBDBJSJZ"
|
39
src/lib.rs
39
src/lib.rs
@ -345,13 +345,46 @@ pub mod info_app {
|
||||
|
||||
#[component]
|
||||
pub fn Testimonials() -> Element {
|
||||
rsx! { div {} }
|
||||
let mastodon_status = use_resource(get_account_avatar);
|
||||
// use_effect(|| {
|
||||
// to_owned![mastodon_status];
|
||||
// async move {
|
||||
// mastodon_status.set(get_mastodon_info().await.unwrap());
|
||||
// }
|
||||
// });
|
||||
rsx! { div { match (mastodon_status.value())() {
|
||||
Some(account) => format!("{:#?}", account.unwrap()),
|
||||
_ => "Nothing yet...".to_string(),
|
||||
} } }
|
||||
}
|
||||
|
||||
#[server]
|
||||
async fn get_account_avatar() -> Result<String, ServerFnError> {
|
||||
let client = megalodon::generator(
|
||||
megalodon::SNS::Mastodon,
|
||||
String::from("https://bark.lgbt"),
|
||||
Some(tokio::fs::read_to_string("access_token.key").await?),
|
||||
None,
|
||||
);
|
||||
let testimonial_toml: String = tokio::fs::read_to_string("data/testimonials.toml").await?;
|
||||
let testinomial_accounts: TestimonialAccount = toml::from_str(testimonial_toml.as_str()).unwrap();
|
||||
let res = client.search_account(String::from("@heatherhorns@plush.city"), None).await?;
|
||||
Ok(format!("{}", res.json()[0].avatar_static))
|
||||
}
|
||||
|
||||
#[derive(Deserialize)]
|
||||
struct TestimonialAccount {
|
||||
accounts: Vec<Testimonial>,
|
||||
}
|
||||
|
||||
#[derive(Deserialize)]
|
||||
struct Testimonial {
|
||||
username: String,
|
||||
content: String,
|
||||
}
|
||||
|
||||
#[component]
|
||||
pub fn Hrt() -> Element {
|
||||
// let time_elapsed: TimeElapsed = GetHrtTime().await();
|
||||
// let mut test = get_hrt_time();
|
||||
let time_elapsed = use_signal(|| TimeElapsed {
|
||||
days: 0,
|
||||
hours: 0,
|
||||
|
Loading…
Reference in New Issue
Block a user