From 435cf4d18f74cb627bfc3db8f2b096c140a680fc Mon Sep 17 00:00:00 2001
From: jutty
Date: Tue, 6 Jan 2026 03:52:08 -0300
Subject: [PATCH] Add interactive navigation controls
---
src/types.rs | 77 +++++++++++++++++++++++++-------------------
static/graph.toml | 3 ++
static/style.css | 41 ++++++++++++++++++++---
templates/base.html | 34 ++++++++++++++-----
templates/data.html | 19 +++++++++++
templates/error.html | 5 +--
templates/index.html | 5 ++-
7 files changed, 132 insertions(+), 52 deletions(-)
create mode 100644 templates/data.html
diff --git a/src/types.rs b/src/types.rs
index 20d5d0d..1e38191 100644
--- a/src/types.rs
+++ b/src/types.rs
@@ -64,10 +64,16 @@ fn mkversion() -> (u8, u8, u8) {
pub struct Config {
#[serde(default)]
_private: bool,
+ #[serde(default = "mktrue")]
+ pub about: bool,
#[serde(default)]
- pub site_title: String,
+ pub about_text: String,
+ #[serde(default = "mkfalse")]
+ pub ascii_dom_ids: bool,
#[serde(default)]
- pub site_description: String,
+ pub content_language: String,
+ #[serde(default = "mkfalse")]
+ error_poem: bool,
#[serde(default = "mktrue")]
pub footer: bool,
#[serde(default = "mktrue")]
@@ -76,32 +82,32 @@ pub struct Config {
pub footer_date: bool,
#[serde(default)]
pub footer_text: String,
- #[serde(default = "mktrue")]
- pub about: bool,
- #[serde(default)]
- pub about_text: String,
- #[serde(default = "mktrue")]
- pub tree: bool,
- #[serde(default = "mktrue")]
- pub raw: bool,
- #[serde(default = "mktrue")]
- pub raw_toml: bool,
- #[serde(default = "mktrue")]
- pub raw_json: bool,
- #[serde(default = "mktrue")]
- pub index_search: bool,
- #[serde(default = "mktrue")]
- pub index_node_list: bool,
#[serde(default = "mk8")]
pub index_node_count: u16,
#[serde(default = "mktrue")]
+ pub index_node_list: bool,
+ #[serde(default = "mktrue")]
pub index_root_node: bool,
+ #[serde(default = "mktrue")]
+ pub index_search: bool,
+ #[serde(default)]
+ node_selector: bool,
+ #[serde(default)]
+ navbar_search: bool,
+ #[serde(default = "mktrue")]
+ pub raw: bool,
+ #[serde(default = "mktrue")]
+ pub raw_json: bool,
+ #[serde(default = "mktrue")]
+ pub raw_toml: bool,
+ #[serde(default)]
+ pub site_description: String,
+ #[serde(default)]
+ pub site_title: String,
+ #[serde(default = "mktrue")]
+ pub tree: bool,
#[serde(default = "mkfalse")]
pub tree_node_text: bool,
- #[serde(default = "mkfalse")]
- pub ascii_dom_ids: bool,
- #[serde(default)]
- pub content_language: String,
}
// See: https://github.com/serde-rs/serde/issues/368
@@ -181,25 +187,28 @@ impl Default for Config {
fn default() -> Config {
Config {
_private: true,
- site_title: String::default(),
- site_description: String::default(),
+ about: true,
+ about_text: String::default(),
+ ascii_dom_ids: false,
+ content_language: String::default(),
+ error_poem: false,
footer: true,
footer_credits: true,
footer_date: true,
footer_text: String::default(),
- about: true,
- about_text: String::default(),
- tree: true,
- raw: true,
- raw_toml: true,
- raw_json: true,
- index_search: true,
- index_node_list: true,
index_node_count: 8,
+ index_node_list: true,
index_root_node: true,
+ index_search: true,
+ node_selector: true,
+ navbar_search: true,
+ raw: true,
+ raw_json: true,
+ raw_toml: true,
+ site_description: String::default(),
+ site_title: String::default(),
+ tree: true,
tree_node_text: false,
- ascii_dom_ids: false,
- content_language: String::default(),
}
}
}
diff --git a/static/graph.toml b/static/graph.toml
index 14b232a..a31f3b1 100644
--- a/static/graph.toml
+++ b/static/graph.toml
@@ -581,6 +581,9 @@ Syntax|syntax|
[meta.config]
content_language = "en"
footer_credits = false
+error_poem = true
+node_selector = true
+navbar_search = true
footer_text = """
made by jutty|https://jutty.dev • acknowledgments|Acknowledgments • |source code|https://codeberg.org/jutty/en
"""
diff --git a/static/style.css b/static/style.css
index 4a62fba..0842b68 100644
--- a/static/style.css
+++ b/static/style.css
@@ -107,20 +107,46 @@ span.detached-connection {
filter: opacity(60%);
}
-nav#main-menu {
+nav#nav-main {
text-align: center;
}
-nav#main-menu ul {
- display: inline;
- padding-left: 0;
+#nav-main-spread {
+ display: flex;
+ justify-content: space-between;
+ align-items: center;
+ margin: 0 10px;
}
-nav#main-menu li {
+nav#nav-main ul {
+ display: inline;
+ padding-left: 0;
+ margin: 0;
+}
+
+nav#nav-main li {
margin-right: 10px;
display: inline;
}
+.nav-inputs div {
+ margin-right: 10px;
+ display: flex;
+ align-items: right;
+}
+
+form.node-selector, form.navbar-search {
+ display: inline;
+}
+
+.node-selector select {
+ width: 100px;
+}
+
+.navbar-search input[type="text"] {
+ width: 100px;
+}
+
div#error-poem {
text-align: right;
margin-top: 8em;
@@ -174,4 +200,9 @@ em#index-node-count {
div.header-row {
display: block;
}
+
+ #nav-main-spread {
+ display: inline;
+ margin: 0;
+ }
}
diff --git a/templates/base.html b/templates/base.html
index 08eb91b..c177e74 100644
--- a/templates/base.html
+++ b/templates/base.html
@@ -18,8 +18,9 @@
{% endblock head %}
-
+ {% endif %}
{%- endblock body %}
diff --git a/templates/index.html b/templates/index.html
index b26078a..5479594 100644
--- a/templates/index.html
+++ b/templates/index.html
@@ -13,11 +13,10 @@
{% endif %}
{% if nodes %}
- {% if config.index_search %}
+ {% if config.navbar_search %}
{% endif %}
{% if config.index_node_list or config.index_root_node %}