From 7badc1eab57dc8580fdda9cc0c69825baa222d32 Mon Sep 17 00:00:00 2001 From: alemi Date: Mon, 10 Jun 2024 06:44:47 +0200 Subject: [PATCH] feat(web): add super simple page to edit profile it seems to work but backend doesnt apply update... what?? --- web/src/page/config.rs | 70 +++++++++++++++++++++++++++++++++++++++++- 1 file changed, 69 insertions(+), 1 deletion(-) diff --git a/web/src/page/config.rs b/web/src/page/config.rs index 1a13f97..22e2fee 100644 --- a/web/src/page/config.rs +++ b/web/src/page/config.rs @@ -1,9 +1,11 @@ +use apb::{ActivityMut, ActorMut, Object, ObjectMut}; use leptos::*; use crate::{prelude::*, DEFAULT_COLOR}; #[component] pub fn ConfigPage(setter: WriteSignal) -> impl IntoView { let config = use_context::>().expect("missing config context"); + let auth = use_context::().expect("missing auth context"); let (color, set_color) = leptos_use::use_css_var("--accent"); let (_color_rgb, set_color_rgb) = leptos_use::use_css_var("--accent-rgb"); @@ -12,6 +14,17 @@ pub fn ConfigPage(setter: WriteSignal) -> impl IntoView { set_color_rgb.set(parse_hex(&previous_color)); set_color.set(previous_color); + let display_name_ref: NodeRef = create_node_ref(); + let summary_ref: NodeRef = create_node_ref(); + let avatar_url_ref: NodeRef = create_node_ref(); + let banner_url_ref: NodeRef = create_node_ref(); + + let myself = CACHE.get(&auth.userid.get_untracked().unwrap_or_default()); + let curr_display_name = myself.as_ref().and_then(|x| Some(x.name().ok()?.to_string())).unwrap_or_default(); + let curr_summary = myself.as_ref().and_then(|x| Some(x.summary().ok()?.to_string())).unwrap_or_default(); + let curr_icon = myself.as_ref().and_then(|x| Some(x.icon().get()?.url().id().ok()?.to_string())).unwrap_or_default(); + let curr_banner = myself.as_ref().and_then(|x| Some(x.image().get()?.url().id().ok()?.to_string())).unwrap_or_default(); + macro_rules! get_cfg { (filter $field:ident) => { move || config.get().filters.$field @@ -94,7 +107,62 @@ pub fn ConfigPage(setter: WriteSignal) -> impl IntoView {
  • " orphans"

  • -

    devtools

    +
    + update profile +
    display name
    +
    + +
    + +
    avatar url
    +
    + +
    + +
    banner url
    +
    + +
    + +
    summary
    +
    + +
    + + +
    } }