synpad 0.1.0

A full-featured Matrix chat client built with Dioxus
use dioxus::prelude::*;

/// Scroll container that notifies when user scrolls near the top or bottom.
///
/// Used for timeline backward pagination (scroll to top) and
/// jump-to-bottom detection (scroll to bottom).
#[component]
pub fn ScrollView(
    children: Element,
    #[props(default = false)] stick_to_bottom: bool,
    on_scroll_top: Option<EventHandler<()>>,
    on_scroll_bottom: Option<EventHandler<()>>,
) -> Element {
    let on_scroll = move |_evt: Event<ScrollData>| {
        // Scroll position detection in Dioxus desktop requires eval-based JS interop.
        // The timeline panel handles pagination via its own scroll detection.
        // This handler is here for future web target support where
        // ScrollData will expose scrollTop/scrollHeight properties.
        let _ = &on_scroll_top;
        let _ = &on_scroll_bottom;
    };

    rsx! {
        div {
            class: if stick_to_bottom { "scroll-view scroll-view--stick-bottom" } else { "scroll-view" },
            onscroll: on_scroll,
            {children}
        }
    }
}