Watch
0
0
Fork
You've already forked hyperhive
0

treefmt: apply prettier

Pure `nix fmt` output from the commit before this one — no hand edits.
203 files: 52 md, 42 tsx, 32 js, 32 css, 21 ts, 13 html, 8 json, 3 mjs.

Reproduce with `nix develop -c nix fmt` on the parent commit; the result
should be byte-identical to this tree.

None of the 13 `.prettierignore` entries appears here — verified by
intersecting the changed-file list against the ignore file, with a
control proving the intersection finds a match when one exists.
This commit is contained in:
atlas 2026-09-02 14:29:33 +02:00
commit 39b95c2ede
203 changed files with 10090 additions and 6085 deletions

View file

@ -26,30 +26,30 @@
// the palette follows. `.shell-brand` rides the identical accent value
// (`navAccent` below), so the header reads as one accent changing, not
// the underline alone.
import { useEffect, useRef, useState } from 'preact/hooks';
import type { ComponentChildren } from 'preact';
import { Link, useLocation } from 'wouter-preact';
import { LinksMenu } from './LinksMenu.js';
import { UserMenu } from './UserMenu.js';
import { SettingsMenu } from '@hive/shared/settings-menu.js';
import { useApplyThemeOverride } from '@hive/shared/theme-apply.js';
import { useApplyMotionOverride } from '@hive/shared/motion-apply.js';
import './Shell.css';
import { useEffect, useRef, useState } from "preact/hooks";
import type { ComponentChildren } from "preact";
import { Link, useLocation } from "wouter-preact";
import { LinksMenu } from "./LinksMenu.js";
import { UserMenu } from "./UserMenu.js";
import { SettingsMenu } from "@hive/shared/settings-menu.js";
import { useApplyThemeOverride } from "@hive/shared/theme-apply.js";
import { useApplyMotionOverride } from "@hive/shared/motion-apply.js";
import "./Shell.css";
// Storage keys this app owns for `@hive/shared`'s settings mechanism —
// kept here, not derived, so the two mount points below (the
// `useApply*` effects and `<SettingsMenu>`) always agree on which
// browser-local key they're reading/writing. Theme defaults to `'dark'`,
// not `'system'` — see `@hive/shared/theme-apply.js`'s file comment.
const THEME_KEY = 'swarm-ui:theme-override';
const MOTION_KEY = 'swarm-ui:motion-override';
const THEME_KEY = "swarm-ui:theme-override";
const MOTION_KEY = "swarm-ui:motion-override";
const NAV_ITEMS: { href: string; label: string; accent: string }[] = [
{ href: '/', label: 'hives', accent: 'var(--purple)' },
{ href: '/agents', label: 'agents', accent: 'var(--green)' },
{ href: '/jobs', label: 'jobs', accent: 'var(--pink)' },
{ href: '/issues', label: 'issues', accent: 'var(--yellow)' },
{ href: '/components', label: 'components', accent: 'var(--blue)' },
{ href: "/", label: "hives", accent: "var(--purple)" },
{ href: "/agents", label: "agents", accent: "var(--green)" },
{ href: "/jobs", label: "jobs", accent: "var(--pink)" },
{ href: "/issues", label: "issues", accent: "var(--yellow)" },
{ href: "/components", label: "components", accent: "var(--blue)" },
];
// Routes that opt out of `.shell-body`'s 60em readable-line-length cap
@ -60,13 +60,13 @@ const NAV_ITEMS: { href: string; label: string; accent: string }[] = [
// route's layout is untouched — first user of this allowlist, but a
// future wide page reaches for the same class rather than inventing
// its own cap.
const WIDE_BODY_ROUTES = new Set(['/issues']);
const WIDE_BODY_ROUTES = new Set(["/issues"]);
// Static fallback — matches `index.html`'s `<title>` default, so a page
// never flashes something else before the fetch below resolves, and an
// operator who never set `services.hyperhive.swarm.name` sees the exact
// same generic label the pre-fetch page already showed, not a blank.
const DEFAULT_BRAND = 'hyperhive swarm';
const DEFAULT_BRAND = "hyperhive swarm";
interface IndicatorRect {
left: number;
@ -90,9 +90,9 @@ const HOP_MS = 140;
// override semantics `@hive/shared/motion-apply.js` establishes.
function prefersReducedMotion(): boolean {
const override = document.documentElement.dataset.motion;
if (override === 'reduce') return true;
if (override === 'allow') return false;
return window.matchMedia('(prefers-reduced-motion: reduce)').matches;
if (override === "reduce") return true;
if (override === "allow") return false;
return window.matchMedia("(prefers-reduced-motion: reduce)").matches;
}
function NavLink({
@ -115,7 +115,7 @@ function NavLink({
than the full-height tappable box. */}
<span
ref={textRef}
class={'shell-nav-link-text' + (active ? ' shell-nav-link-active' : '')}
class={"shell-nav-link-text" + (active ? " shell-nav-link-active" : "")}
>
{label}
</span>
@ -233,8 +233,8 @@ export function Shell({ children }: { children: ComponentChildren }) {
if (settledIndexRef.current === -1) return;
setIndicator(measureIndex(settledIndexRef.current));
}
window.addEventListener('resize', onResize);
return () => window.removeEventListener('resize', onResize);
window.addEventListener("resize", onResize);
return () => window.removeEventListener("resize", onResize);
}, []);
// Fetched once here, not per-page: every route mounts inside one
@ -245,7 +245,7 @@ export function Shell({ children }: { children: ComponentChildren }) {
// not worth an `ApiErrorPanel`.
useEffect(() => {
(async () => {
const r = await fetch('/api/swarm');
const r = await fetch("/api/swarm");
if (!r.ok) return;
const data = (await r.json()) as { name: string | null };
if (data.name) setSwarmName(data.name);
@ -263,7 +263,7 @@ export function Shell({ children }: { children: ComponentChildren }) {
// the brand text rides the identical hop sequence rather than
// computing its own, so "the header's accent" reads as one thing
// changing, not two things that happen to agree at rest.
const navAccent = indicator?.accent ?? 'var(--purple)';
const navAccent = indicator?.accent ?? "var(--purple)";
return (
<div class="shell">
@ -288,12 +288,15 @@ export function Shell({ children }: { children: ComponentChildren }) {
nav item (404), so it doesn't pop in with a stale position
the next time a real nav item becomes active. */}
<span
class={'shell-nav-indicator' + (indicatorSettledOnce ? '' : ' shell-nav-indicator-instant')}
class={
"shell-nav-indicator" +
(indicatorSettledOnce ? "" : " shell-nav-indicator-instant")
}
style={{
left: `${indicator?.left ?? 0}px`,
top: `${indicator?.top ?? 0}px`,
width: `${indicator?.width ?? 0}px`,
backgroundColor: indicator?.accent ?? 'transparent',
backgroundColor: indicator?.accent ?? "transparent",
}}
/>
</nav>
@ -312,7 +315,13 @@ export function Shell({ children }: { children: ComponentChildren }) {
`shell-body-wide` is additive (see `WIDE_BODY_ROUTES` above),
not a swap — `.shell-body`'s padding/animation rules still
apply, only the max-width cap changes. */}
<div class={'shell-body' + (WIDE_BODY_ROUTES.has(location) ? ' shell-body-wide' : '')} key={location}>
<div
class={
"shell-body" +
(WIDE_BODY_ROUTES.has(location) ? " shell-body-wide" : "")
}
key={location}
>
{children}
</div>
</div>