use dioxus::prelude::*;

use crate::components::ToolEmbed;
use crate::i18n::{t, Locale};
use crate::models::ServiceUrlsContext;

/// Flow page embedding the LangFlow visual workflow builder.
///
/// When `langflow_url` is configured, embeds the service in an iframe
/// with a pop-out button. Otherwise shows a "Not Configured" placeholder.
#[component]
pub fn FlowPage() -> Element {
    let locale = use_context::<Signal<Locale>>();
    let svc = use_context::<Signal<ServiceUrlsContext>>();
    let l = *locale.read();
    let url = svc.read().langflow_url.clone();

    rsx! {
        ToolEmbed {
            url,
            title: t(l, "developer.flow_title"),
            description: t(l, "developer.flow_desc"),
            icon: "F",
            launch_label: t(l, "developer.launch_flow"),
        }
    }
}
