diff --git a/src/pages/settings.rs b/src/pages/settings.rs index 0cf93c4..bc6d9f5 100644 --- a/src/pages/settings.rs +++ b/src/pages/settings.rs @@ -255,16 +255,46 @@ pub fn settings() -> Html { "Кнопка еще разрабатывается..." }; - let reset_onclick = { - let main_reset_counter = main_reset_counter.clone(); + let oninput = { let main_section_error = main_section_error.clone(); - move |e: MouseEvent| { - e.prevent_default(); - main_reset_counter.set(*main_reset_counter + 1); + move |_| { main_section_error.set(None); } }; + #[cfg(feature = "client")] + let is_ready_for_save = { + if logged_user_context.is_not_inited() { + false + } else if let Some(author) = logged_user_context.state().author().cloned() { + let slug = slug_node_ref.cast::().unwrap().value(); + let first_name = first_name_node_ref + .cast::() + .unwrap() + .value() + .none_if_empty(); + let last_name = last_name_node_ref + .cast::() + .unwrap() + .value() + .none_if_empty(); + let image_url = image_url_node_ref + .cast::() + .unwrap() + .value() + .none_if_empty(); + !(blog_generic::clean_author_slug(&author.slug) == slug + && author.first_name.none_if_empty() == first_name + && author.last_name.none_if_empty() == last_name + && author.image_url.none_if_empty() == image_url + && author.override_social_data == 1) + } else { + false + } + }; + #[cfg(not(feature = "client"))] + let is_ready_for_save = false; + ah! {
@@ -274,11 +304,21 @@ pub fn settings() -> Html {
"Настройки"
-
+
"Основные данные профиля" " " - + + +
if let Some(message) = main_section_error.as_ref() { match message { @@ -307,7 +347,11 @@ pub fn settings() -> Html { checked={ *main_active_section == ActiveSection::Social } onclick={ let main_active_section = main_active_section.clone(); - Callback::from(move |_: MouseEvent| main_active_section.set(ActiveSection::Social)) + let main_section_error = main_section_error.clone(); + Callback::from(move |_: MouseEvent| { + main_active_section.set(ActiveSection::Social); + main_section_error.set(None); + }) } />