use dioxus::prelude::*;

use crate::Route;

/// Honest placeholder for directed catalog search. The global shell search
/// field routes here with `?q=`. Search indexing and filtering are not built
/// yet, so this page captures the query without ever fabricating results.
#[allow(clippy::useless_format)]
#[component]
pub(crate) fn Search(q: String) -> Element {
    let query = q.trim().to_string();

    rsx! {
        main { class: "search-page",
            section { class: "search-intro blueprint-panel", aria_label: "Search",
                span { class: "status-pill status-muted", "Not wired up yet" }
                h1 { "Search" }
                if query.is_empty() {
                    p { class: "product-lede", "Directed catalog search is on the way. Run a query from the header and it will be captured here." }
                } else {
                    p { class: "product-lede", "Searched for \"{query}\". Search indexing is not built yet, so there are no results to show — the query is captured here rather than faked." }
                }
                p { class: "search-note", "Until search ships, browse the catalog from the home feed." }
                Link { class: "button button-secondary", to: Route::Browse {}, "Back to browse" }
            }
        }
    }
}
