Skip to content

armgit / kwant

Public Imported from GitHub
0

Your own team of AI bots in one self-hosted binary: spaces, every account you have, handoffs, approvals and routines. Open-source, self-hosted alternative to Grok Bot, Claude Duet and OpenAI dots. Rust + React.

site: make the features jump links a sticky 'On this page' menu

Pixel (kwant bot)38c110eaaf86
diff --git a/site-src/features.html b/site-src/features.html
index 2aaeb883..bbc9dd64 100644
--- a/site-src/features.html
+++ b/site-src/features.html
@@ -8,17 +8,25 @@ active: features
<p class="kicker">Features</p>
<h1>Everything kwant does</h1>
<p class="lede">A self-hosted team of AI bots, with separate spaces, every account you have, and work that keeps going while you're away.</p>
- <ul class="jump" aria-label="Jump to a group">
- <li><a href="#teams">Teams &amp; chat</a></li>
- <li><a href="#spaces">Spaces &amp; accounts</a></li>
- <li><a href="#own">Works on its own</a></li>
- <li><a href="#safety">Safety &amp; control</a></li>
- <li><a href="#knowledge">Bots &amp; knowledge</a></li>
- <li><a href="#running">Running it</a></li>
- </ul>
</div>
</section>
+<nav class="jump-bar" aria-labelledby="jump-label">
+ <div class="wrap">
+ <div class="jump-scroll">
+ <p class="jump-label" id="jump-label">On this page</p>
+ <ul class="jump">
+ <li><a href="#teams">Teams &amp; chat</a></li>
+ <li><a href="#spaces">Spaces &amp; accounts</a></li>
+ <li><a href="#own">Works on its own</a></li>
+ <li><a href="#safety">Safety &amp; control</a></li>
+ <li><a href="#knowledge">Bots &amp; knowledge</a></li>
+ <li><a href="#running">Running it</a></li>
+ </ul>
+ </div>
+ </div>
+</nav>
+
<section id="teams" class="fgroup">
<div class="wrap">
<div class="section-head">
diff --git a/site/assets/css/site.css b/site/assets/css/site.css
index 84545c9a..cb3317f8 100644
--- a/site/assets/css/site.css
+++ b/site/assets/css/site.css
@@ -166,14 +166,32 @@ section { padding: 112px 0; }
.notfound .lede { margin: 14px 0 28px; font-size: 19px; color: #ece7ff; }
/* Features page */
-.page-head { background: var(--v4); color: #fff; padding: 72px 0 0; }
+.page-head { background: var(--v4); color: #fff; padding: 72px 0 40px; }
.page-head .kicker { color: var(--v8); }
.page-head h1 { margin-top: 10px; font-size: clamp(40px, 5.5vw, 68px); }
.page-head .lede { margin-top: 16px; max-width: 640px; font-size: 19px; color: #ece7ff; }
-.jump { list-style: none; margin: 48px 0 0; padding: 0; display: flex; flex-wrap: wrap; }
-.jump a { display: block; padding: 12px 16px; color: #fff; text-decoration: none; font: 400 14px var(--mono); }
-.jump a:hover { background: var(--v3); color: #fff; }
-.jump li:first-child a { padding-left: 0; }
+/* "On this page" bar: one row of chips that stays at the top while the features page scrolls. */
+html:has(.jump-bar) { scroll-padding-top: 72px; }
+.jump-bar { position: sticky; top: 0; z-index: 9; background: var(--v4); color: #fff; border-bottom: 1px solid var(--v3); }
+.jump-bar .wrap { position: relative; }
+.fgroup[id] { scroll-margin-top: -40px; }
+.jump-scroll { display: flex; align-items: center; gap: 8px; padding: 10px 0; overflow-x: auto; scrollbar-width: none; }
+.jump-scroll::-webkit-scrollbar { display: none; }
+.jump-label { flex: none; margin: 0 8px 0 0; font: 400 12px var(--mono); color: var(--v8); white-space: nowrap; }
+.jump-label::before { content: "↓ "; }
+.jump { list-style: none; margin: 0; padding: 0; display: flex; gap: 8px; }
+.jump li { flex: none; }
+.jump a { display: flex; align-items: center; min-height: 44px; padding: 0 14px; border: 1px solid var(--v7); color: #fff; text-decoration: none; white-space: nowrap; font: 400 14px var(--mono); }
+.jump a[aria-current] { background: #fff; border-color: #fff; color: var(--v4); }
+.jump a:focus-visible { outline: 2px solid #fff; outline-offset: -5px; }
+.jump a[aria-current]:focus-visible { outline-color: var(--v4); }
+@media (hover: hover) {
+ .jump a:hover { background: var(--v3); border-color: #fff; color: #fff; }
+ .jump a[aria-current]:hover { background: var(--v9); color: var(--v3); }
+}
+/* A fade at the right edge says the row scrolls; site.js removes it once the row is scrolled to the end. */
+.jump-bar .wrap::after { content: ""; position: absolute; top: 1px; right: 0; bottom: 1px; width: 48px; background: linear-gradient(to right, rgba(64, 36, 168, 0), var(--v4)); pointer-events: none; opacity: 0; transition: opacity 0.15s; }
+.jump-bar.more .wrap::after { opacity: 1; }
.kicker { font: 400 13px var(--mono); color: var(--v5); letter-spacing: 0; }
.section-head { max-width: 720px; margin-bottom: 40px; }
.section-head h2 { margin-top: 8px; font-size: clamp(30px, 3.6vw, 42px); }
@@ -303,12 +321,15 @@ td code { white-space: nowrap; }
.site-footer .wrap { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.flist { grid-template-columns: minmax(0, 1fr); }
.fgroup { padding: 72px 0; }
- .page-head { padding-top: 48px; }
- .jump { margin-top: 32px; }
- .jump li:first-child a { padding-left: 16px; }
- .jump a { padding: 10px 16px 10px 0; }
+ .page-head { padding: 48px 0 32px; }
+ .jump-bar .wrap { width: 100%; }
+ .jump-scroll { padding: 8px 20px; scroll-padding-inline: 20px; }
+ .jump-label { margin-right: 4px; }
+}
+@media (prefers-reduced-motion: no-preference) {
+ html:has(.jump-bar) { scroll-behavior: smooth; }
}
@media (prefers-reduced-motion: reduce) {
- html { scroll-behavior: auto; }
+ html, html:has(.jump-bar) { scroll-behavior: auto; }
*, *::before, *::after { transition: none !important; animation: none !important; }
}
diff --git a/site/assets/js/site.js b/site/assets/js/site.js
index 52387f3e..47c6f998 100644
--- a/site/assets/js/site.js
+++ b/site/assets/js/site.js
@@ -31,6 +31,53 @@
if (strip.scrollWidth > strip.clientWidth) strip.scrollLeft = current.offsetLeft - strip.offsetLeft - 18;
}
+ // Features "On this page" bar: mark the group being read and keep its chip in view.
+ var jumpBar = document.querySelector(".jump-bar");
+ if (jumpBar) {
+ var row = jumpBar.querySelector(".jump-scroll");
+ var chips = [].slice.call(jumpBar.querySelectorAll(".jump a"));
+ var groups = chips.map(function (a) { return document.getElementById(a.getAttribute("href").slice(1)); });
+ var shown = null;
+ var edge = function () {
+ jumpBar.classList.toggle("more", row.scrollLeft + row.clientWidth < row.scrollWidth - 2);
+ };
+ // Scroll only the row sideways; scrollIntoView would also move the page.
+ var reveal = function (a) {
+ var pad = parseFloat(getComputedStyle(row).paddingLeft) || 0;
+ var left = a.offsetLeft - row.offsetLeft;
+ if (left < row.scrollLeft + pad || left + a.offsetWidth > row.scrollLeft + row.clientWidth - pad) {
+ row.scrollTo({ left: left - pad - 40, behavior: reduce.matches ? "auto" : "smooth" });
+ }
+ };
+ var mark = function (a) {
+ if (a === shown) return;
+ shown = a;
+ chips.forEach(function (o) {
+ if (o === a) o.setAttribute("aria-current", "true"); else o.removeAttribute("aria-current");
+ });
+ if (a) reveal(a);
+ };
+ var spy = function () {
+ var line = jumpBar.getBoundingClientRect().bottom + window.innerHeight * 0.25;
+ var hit = null;
+ groups.forEach(function (g, i) { if (g && g.getBoundingClientRect().top <= line) hit = chips[i]; });
+ var last = groups[groups.length - 1];
+ if (last && last.getBoundingClientRect().bottom < jumpBar.getBoundingClientRect().bottom) hit = null;
+ mark(hit);
+ };
+ var queued = false;
+ window.addEventListener("scroll", function () {
+ if (queued) return;
+ queued = true;
+ requestAnimationFrame(function () { queued = false; spy(); });
+ }, { passive: true });
+ window.addEventListener("resize", function () { edge(); spy(); });
+ row.addEventListener("scroll", edge, { passive: true });
+ row.addEventListener("focusin", function (e) { if (e.target.tagName === "A") reveal(e.target); });
+ edge();
+ spy();
+ }
+
// Scrollable tables can be reached and scrolled with the keyboard.
document.querySelectorAll(".table-wrap").forEach(function (w) {
if (w.scrollWidth > w.clientWidth) {
diff --git a/site/features.html b/site/features.html
index 82a9c5d3..117b9c52 100644
--- a/site/features.html
+++ b/site/features.html
@@ -43,17 +43,25 @@
<p class="kicker">Features</p>
<h1>Everything kwant does</h1>
<p class="lede">A self-hosted team of AI bots, with separate spaces, every account you have, and work that keeps going while you're away.</p>
- <ul class="jump" aria-label="Jump to a group">
- <li><a href="#teams">Teams &amp; chat</a></li>
- <li><a href="#spaces">Spaces &amp; accounts</a></li>
- <li><a href="#own">Works on its own</a></li>
- <li><a href="#safety">Safety &amp; control</a></li>
- <li><a href="#knowledge">Bots &amp; knowledge</a></li>
- <li><a href="#running">Running it</a></li>
- </ul>
</div>
</section>
+<nav class="jump-bar" aria-labelledby="jump-label">
+ <div class="wrap">
+ <div class="jump-scroll">
+ <p class="jump-label" id="jump-label">On this page</p>
+ <ul class="jump">
+ <li><a href="#teams">Teams &amp; chat</a></li>
+ <li><a href="#spaces">Spaces &amp; accounts</a></li>
+ <li><a href="#own">Works on its own</a></li>
+ <li><a href="#safety">Safety &amp; control</a></li>
+ <li><a href="#knowledge">Bots &amp; knowledge</a></li>
+ <li><a href="#running">Running it</a></li>
+ </ul>
+ </div>
+ </div>
+</nav>
+
<section id="teams" class="fgroup">
<div class="wrap">
<div class="section-head">