use dioxus::prelude::*;

use crate::Route;
use crate::viewer::{ViewerPage, demo_model_for_route};

#[component]
pub(crate) fn Viewer(model_id: String) -> Element {
    let model = demo_model_for_route(&model_id);

    rsx! {
        main { class: "viewer-route-page",
            nav { class: "viewer-route-nav", aria_label: "Viewer navigation",
                Link { to: Route::Browse {}, "← Back to browse" }
            }
            ViewerPage { key: "{model.id}", initial_model: model }
        }
    }
}
