add initial crates and apps
This commit is contained in:
parent
5c87ba3519
commit
1ca300098f
113 changed files with 28169 additions and 0 deletions
131
crates/chattyness-admin-ui/src/routes.rs
Normal file
131
crates/chattyness-admin-ui/src/routes.rs
Normal file
|
|
@ -0,0 +1,131 @@
|
|||
//! Admin routes without Router wrapper (for embedding in combined apps).
|
||||
//!
|
||||
//! This module provides the `AdminRoutes` component which contains all admin
|
||||
//! 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 (e.g., chattyness-owner), use `AdminApp` which wraps
|
||||
//! these routes with a Router.
|
||||
|
||||
use leptos::prelude::*;
|
||||
use leptos_router::{
|
||||
components::{Route, Routes},
|
||||
ParamSegment, StaticSegment,
|
||||
};
|
||||
|
||||
use crate::components::{AuthenticatedLayout, LoginLayout};
|
||||
use crate::pages::{
|
||||
ConfigPage, DashboardPage, LoginPage, PropsDetailPage, PropsNewPage, PropsPage,
|
||||
RealmDetailPage, RealmNewPage, RealmsPage, SceneDetailPage, SceneNewPage, ScenesPage,
|
||||
StaffPage, UserDetailPage, UserNewPage, UsersPage,
|
||||
};
|
||||
|
||||
/// Admin routes that can be embedded in a parent Router.
|
||||
///
|
||||
/// All paths are relative to the Router's base path. When used in:
|
||||
/// - `AdminApp`: The Router is configured with base="/admin"
|
||||
/// - `CombinedApp`: The Router should be configured with base="/admin"
|
||||
#[component]
|
||||
pub fn AdminRoutes() -> impl IntoView {
|
||||
view! {
|
||||
<Routes fallback=|| "Page not found.".into_view()>
|
||||
// Login page (no layout)
|
||||
<Route path=StaticSegment("login") view=|| view! {
|
||||
<LoginLayout>
|
||||
<LoginPage />
|
||||
</LoginLayout>
|
||||
} />
|
||||
|
||||
// Dashboard
|
||||
<Route path=StaticSegment("") view=|| view! {
|
||||
<AuthenticatedLayout current_page="dashboard">
|
||||
<DashboardPage />
|
||||
</AuthenticatedLayout>
|
||||
} />
|
||||
|
||||
// Config
|
||||
<Route path=StaticSegment("config") view=|| view! {
|
||||
<AuthenticatedLayout current_page="config">
|
||||
<ConfigPage />
|
||||
</AuthenticatedLayout>
|
||||
} />
|
||||
|
||||
// Users
|
||||
<Route path=StaticSegment("users") view=|| view! {
|
||||
<AuthenticatedLayout current_page="users">
|
||||
<UsersPage />
|
||||
</AuthenticatedLayout>
|
||||
} />
|
||||
<Route path=(StaticSegment("users"), StaticSegment("new")) view=|| view! {
|
||||
<AuthenticatedLayout current_page="users_new">
|
||||
<UserNewPage />
|
||||
</AuthenticatedLayout>
|
||||
} />
|
||||
<Route path=(StaticSegment("users"), ParamSegment("user_id")) view=|| view! {
|
||||
<AuthenticatedLayout current_page="users">
|
||||
<UserDetailPage />
|
||||
</AuthenticatedLayout>
|
||||
} />
|
||||
|
||||
// Staff
|
||||
<Route path=StaticSegment("staff") view=|| view! {
|
||||
<AuthenticatedLayout current_page="staff">
|
||||
<StaffPage />
|
||||
</AuthenticatedLayout>
|
||||
} />
|
||||
|
||||
// Props
|
||||
<Route path=StaticSegment("props") view=|| view! {
|
||||
<AuthenticatedLayout current_page="props">
|
||||
<PropsPage />
|
||||
</AuthenticatedLayout>
|
||||
} />
|
||||
<Route path=(StaticSegment("props"), StaticSegment("new")) view=|| view! {
|
||||
<AuthenticatedLayout current_page="props_new">
|
||||
<PropsNewPage />
|
||||
</AuthenticatedLayout>
|
||||
} />
|
||||
<Route path=(StaticSegment("props"), ParamSegment("prop_id")) view=|| view! {
|
||||
<AuthenticatedLayout current_page="props">
|
||||
<PropsDetailPage />
|
||||
</AuthenticatedLayout>
|
||||
} />
|
||||
|
||||
// Realms
|
||||
<Route path=StaticSegment("realms") view=|| view! {
|
||||
<AuthenticatedLayout current_page="realms">
|
||||
<RealmsPage />
|
||||
</AuthenticatedLayout>
|
||||
} />
|
||||
<Route path=(StaticSegment("realms"), StaticSegment("new")) view=|| view! {
|
||||
<AuthenticatedLayout current_page="realms_new">
|
||||
<RealmNewPage />
|
||||
</AuthenticatedLayout>
|
||||
} />
|
||||
|
||||
// Scenes (nested under realms)
|
||||
<Route path=(StaticSegment("realms"), ParamSegment("slug"), StaticSegment("scenes")) view=|| view! {
|
||||
<AuthenticatedLayout current_page="scenes">
|
||||
<ScenesPage />
|
||||
</AuthenticatedLayout>
|
||||
} />
|
||||
<Route path=(StaticSegment("realms"), ParamSegment("slug"), StaticSegment("scenes"), StaticSegment("new")) view=|| view! {
|
||||
<AuthenticatedLayout current_page="scenes_new">
|
||||
<SceneNewPage />
|
||||
</AuthenticatedLayout>
|
||||
} />
|
||||
<Route path=(StaticSegment("realms"), ParamSegment("slug"), StaticSegment("scenes"), ParamSegment("scene_id")) view=|| view! {
|
||||
<AuthenticatedLayout current_page="scenes">
|
||||
<SceneDetailPage />
|
||||
</AuthenticatedLayout>
|
||||
} />
|
||||
|
||||
// Realm detail (must come after more specific realm routes)
|
||||
<Route path=(StaticSegment("realms"), ParamSegment("slug")) view=|| view! {
|
||||
<AuthenticatedLayout current_page="realms">
|
||||
<RealmDetailPage />
|
||||
</AuthenticatedLayout>
|
||||
} />
|
||||
</Routes>
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue