use apb::{ActivityMut, BaseMut, ObjectMut}; use leptos::*; use crate::prelude::*; #[component] pub fn Navigator() -> impl IntoView { let auth = use_context::().expect("missing auth context"); view! { } } #[component] pub fn PostBox(username: Signal>, advanced: WriteSignal) -> impl IntoView { let auth = use_context::().expect("missing auth context"); let (posting, set_posting) = create_signal(false); let (error, set_error) = create_signal(None); let summary_ref: NodeRef = create_node_ref(); let content_ref: NodeRef = create_node_ref(); let public_ref: NodeRef = create_node_ref(); let followers_ref: NodeRef = create_node_ref(); let private_ref: NodeRef = create_node_ref(); view! {
{PRIVACY_PUBLIC}
{PRIVACY_FOLLOWERS}
{PRIVACY_PRIVATE}
{move|| error.get().map(|x| view! {
{x}
})}
} } #[component] pub fn AdvancedPostBox(username: Signal>, advanced: WriteSignal) -> impl IntoView { let auth = use_context::().expect("missing auth context"); let (posting, set_posting) = create_signal(false); let (error, set_error) = create_signal(None); let (value, set_value) = create_signal("Like".to_string()); let (embedded, set_embedded) = create_signal(false); let summary_ref: NodeRef = create_node_ref(); let content_ref: NodeRef = create_node_ref(); let context_ref: NodeRef = create_node_ref(); let name_ref: NodeRef = create_node_ref(); let reply_ref: NodeRef = create_node_ref(); let to_ref: NodeRef = create_node_ref(); let object_id_ref: NodeRef = create_node_ref(); let bto_ref: NodeRef = create_node_ref(); let cc_ref: NodeRef = create_node_ref(); let bcc_ref: NodeRef = create_node_ref(); view! {
{move|| error.get().map(|x| view! {
{x}
})}
} } fn get_if_some(node: NodeRef) -> Option { node.get() .filter(|x| !x.value().is_empty()) .map(|x| x.value()) } fn get_vec_if_some(node: NodeRef) -> Vec { node.get() .filter(|x| !x.value().is_empty()) .map(|x| x.value()) .map(|x| x.split(',') .map(|x| x.to_string()) .collect() ).unwrap_or_default() } fn get_checked(node: NodeRef) -> bool { node.get() .map(|x| x.checked()) .unwrap_or_default() } #[component] pub fn Breadcrumb( #[prop(optional)] back: bool, children: Children, ) -> impl IntoView { view! {
{if back { Some(view! { "<<" })} else { None }} {crate::NAME}" :: "{children()}
} } #[component] fn SelectOption(is: &'static str, value: ReadSignal) -> impl IntoView { view! { } }