use kit::InertiaProps;
use serde::Serialize;
#[derive(Serialize)]
pub struct User {
pub id: i32,
pub name: String,
pub email: String,
}
#[derive(Serialize)]
pub struct Stats {
pub total_users: i32,
pub active_sessions: i32,
}
#[derive(InertiaProps)]
pub struct DashboardProps {
pub user: User,
pub stats: Stats,
pub recent_activity: Vec<String>,
pub notification: Option<String>,
}
pub async fn dashboard(_req: Request) -> Response {
inertia_response!("Dashboard", DashboardProps {
user: User {
id: 1,
name: "John Doe".to_string(),
email: "[email protected]".to_string(),
},
stats: Stats {
total_users: 150,
active_sessions: 42,
},
recent_activity: vec![
"Logged in".to_string(),
"Updated profile".to_string(),
],
notification: Some("Welcome back!".to_string()),
})
}