//! User routes without Router wrapper (for embedding in combined apps).
//!
//! This module provides the `UserRoutes` component which contains all user
//! route definitions without a Router wrapper. This allows the routes to be
//! embedded in a parent Router (e.g., CombinedApp in chattyness-app).
//!
//! For standalone use, use `App` which wraps these routes with a Router.
//!
//! Note: Editor routes and NewRealmPage have been removed.
//! All create/edit functionality is now in the admin-ui.

use leptos::prelude::*;
use leptos_router::{
    ParamSegment, StaticSegment,
    components::{Route, Routes},
};

use crate::pages::{HomePage, LoginPage, PasswordResetPage, RealmPage, SignupPage};

/// User routes that can be embedded in a parent Router.
///
/// All paths are relative to the mount point. When used in:
/// - `App`: Routes are at root (e.g., `/`, `/signup`, `/home`)
/// - `CombinedApp`: Routes are at root (same paths)
#[component]
pub fn UserRoutes() -> impl IntoView {
    view! {
        <Routes fallback=|| "Page not found.".into_view()>
            <Route path=StaticSegment("") view=LoginPage />
            <Route path=StaticSegment("signup") view=SignupPage />
            <Route path=StaticSegment("home") view=HomePage />
            <Route path=StaticSegment("password-reset") view=PasswordResetPage />
            <Route path=(StaticSegment("realms"), ParamSegment("slug")) view=RealmPage />
        </Routes>
    }
}
