commit 869670519dd42bf63cb1ce6ce26f50ca923e24ea
parent eed2d2ddbdb626781cfcfe690016fdf2bbedd11e
Author: triesap <triesap@radroots.dev>
Date: Mon, 19 Jan 2026 23:39:36 +0000
app: add logs route shell
- add leptos_router dependency for app routing
- add logs page component placeholder
- wrap app ui in router with home and logs routes
- add simple navigation and not found fallback
Diffstat:
6 files changed, 73 insertions(+), 1 deletion(-)
diff --git a/Cargo.lock b/Cargo.lock
@@ -1163,6 +1163,42 @@ dependencies = [
]
[[package]]
+name = "leptos_router"
+version = "0.8.10"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "19b824cae28db1551b71f8c2a45eab7bb98d61407f5adcc368cfe7b671e4a71d"
+dependencies = [
+ "any_spawner",
+ "either_of",
+ "futures",
+ "gloo-net",
+ "js-sys",
+ "leptos",
+ "leptos_router_macro",
+ "or_poisoned",
+ "reactive_graph",
+ "rustc_version",
+ "send_wrapper",
+ "tachys",
+ "thiserror 2.0.18",
+ "url",
+ "wasm-bindgen",
+ "web-sys",
+]
+
+[[package]]
+name = "leptos_router_macro"
+version = "0.8.6"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "409c0bd99f986c3cfa1a4db2443c835bc602ded1a12784e22ecb28c3ed5a2ae2"
+dependencies = [
+ "proc-macro-error2",
+ "proc-macro2",
+ "quote",
+ "syn",
+]
+
+[[package]]
name = "leptos_server"
version = "0.8.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -1609,6 +1645,7 @@ dependencies = [
"futures",
"js-sys",
"leptos",
+ "leptos_router",
"radroots-app-core",
"radroots-log",
"serde",
diff --git a/Cargo.toml b/Cargo.toml
@@ -19,6 +19,7 @@ license = "AGPL-3.0"
[workspace.dependencies]
leptos = { version = "0.8.5", default-features = false }
+leptos_router = { version = "0.8.5", default-features = false }
wasm-bindgen = "=0.2.100"
serde = { version = "1", features = ["derive"] }
serde_json = "1"
diff --git a/app/Cargo.toml b/app/Cargo.toml
@@ -11,6 +11,7 @@ crate-type = ["cdylib", "rlib"]
[dependencies]
leptos = { workspace = true, features = ["csr"] }
+leptos_router = { workspace = true }
wasm-bindgen.workspace = true
wasm-bindgen-futures.workspace = true
js-sys.workspace = true
diff --git a/app/src/app.rs b/app/src/app.rs
@@ -1,5 +1,7 @@
use leptos::prelude::*;
use leptos::task::spawn_local;
+use leptos_router::components::{A, Route, Router, Routes};
+use leptos_router::path;
use crate::{
app_init_assets,
@@ -26,6 +28,7 @@ use crate::{
AppInitStage,
AppNotifications,
AppTangleClientStub,
+ LogsPage,
};
fn health_status_color(status: AppHealthCheckStatus) -> &'static str {
@@ -91,7 +94,7 @@ fn spawn_health_checks(
}
#[component]
-pub fn App() -> impl IntoView {
+fn HomePage() -> impl IntoView {
let backends = RwSignal::new_local(None::<AppBackends>);
let init_error = RwSignal::new_local(None::<AppInitError>);
let init_state = RwSignal::new_local(app_init_state_default());
@@ -342,3 +345,19 @@ pub fn App() -> impl IntoView {
</main>
}
}
+
+#[component]
+pub fn App() -> impl IntoView {
+ view! {
+ <Router>
+ <nav style="display:flex;gap:12px;margin-bottom:12px;">
+ <A href="/" exact=true>"home"</A>
+ <A href="/logs">"logs"</A>
+ </nav>
+ <Routes fallback=|| view! { <div>"not_found"</div> }>
+ <Route path=path!("") view=HomePage />
+ <Route path=path!("logs") view=LogsPage />
+ </Routes>
+ </Router>
+ }
+}
diff --git a/app/src/lib.rs b/app/src/lib.rs
@@ -9,6 +9,7 @@ mod health;
mod init;
mod keystore;
mod logging;
+mod logs;
mod notifications;
mod tangle;
mod entry;
@@ -45,6 +46,7 @@ pub use keystore::{
AppKeystoreError,
AppKeystoreResult,
};
+pub use logs::LogsPage;
pub use logging::{
app_log_entry_error,
app_log_entry_emit,
diff --git a/app/src/logs.rs b/app/src/logs.rs
@@ -0,0 +1,12 @@
+#![forbid(unsafe_code)]
+
+use leptos::prelude::*;
+
+#[component]
+pub fn LogsPage() -> impl IntoView {
+ view! {
+ <main>
+ <div>"logs"</div>
+ </main>
+ }
+}