use dioxus::prelude::*; use crate::models::AnalyticsMetric; /// Analytics page placeholder for LangFuse integration. /// /// Shows a "Coming Soon" card with a disabled launch button, /// plus a mock stats bar showing sample metrics. #[component] pub fn AnalyticsPage() -> Element { let metrics = mock_metrics(); rsx! { section { class: "placeholder-page", div { class: "analytics-stats-bar", for metric in &metrics { div { class: "analytics-stat", span { class: "analytics-stat-value", "{metric.value}" } span { class: "analytics-stat-label", "{metric.label}" } span { class: if metric.change_pct >= 0.0 { "analytics-stat-change analytics-stat-change--up" } else { "analytics-stat-change analytics-stat-change--down" }, "{metric.change_pct:+.1}%" } } } } div { class: "placeholder-card", div { class: "placeholder-icon", "L" } h2 { "Analytics & Observability" } p { class: "placeholder-desc", "Monitor and analyze your AI pipelines with LangFuse. \ Track token usage, latency, costs, and quality metrics \ across all your deployments." } button { class: "btn-primary", disabled: true, "Launch LangFuse" } span { class: "placeholder-badge", "Coming Soon" } } } } } /// Returns mock analytics metrics for the stats bar. fn mock_metrics() -> Vec { vec![ AnalyticsMetric { label: "Total Requests".into(), value: "12,847".into(), change_pct: 14.2, }, AnalyticsMetric { label: "Avg Latency".into(), value: "245ms".into(), change_pct: -8.5, }, AnalyticsMetric { label: "Tokens Used".into(), value: "2.4M".into(), change_pct: 22.1, }, AnalyticsMetric { label: "Error Rate".into(), value: "0.3%".into(), change_pct: -12.0, }, ] }