fix: add nous-research/ui package

This commit is contained in:
Austin Pickett 2026-04-19 10:48:56 -04:00
parent 957ca79e8e
commit 923539a46b
26 changed files with 798 additions and 637 deletions

View file

@ -6,6 +6,9 @@ import {
Sparkles, Terminal, Globe, Database, Shield,
Wrench, Zap, Heart, Star, Code, Eye,
} from "lucide-react";
import { SelectionSwitcher } from "@nous-research/ui/ui/components/selection-switcher";
import { cn } from "@/lib/utils";
import { Backdrop } from "@/components/Backdrop";
import StatusPage from "@/pages/StatusPage";
import ConfigPage from "@/pages/ConfigPage";
import EnvPage from "@/pages/EnvPage";
@ -20,17 +23,6 @@ import { useI18n } from "@/i18n";
import { usePlugins } from "@/plugins";
import type { RegisteredPlugin } from "@/plugins";
// ---------------------------------------------------------------------------
// Built-in nav items
// ---------------------------------------------------------------------------
interface NavItem {
path: string;
label: string;
labelKey?: string;
icon: React.ComponentType<{ className?: string }>;
}
const BUILTIN_NAV: NavItem[] = [
{ path: "/", labelKey: "status", label: "Status", icon: Activity },
{ path: "/sessions", labelKey: "sessions", label: "Sessions", icon: MessageSquare },
@ -42,11 +34,8 @@ const BUILTIN_NAV: NavItem[] = [
{ path: "/env", labelKey: "keys", label: "Keys", icon: KeyRound },
];
// ---------------------------------------------------------------------------
// Helpers
// ---------------------------------------------------------------------------
/** Map of icon names plugins can use. Covers common choices without importing all of lucide. */
// Plugins can reference any of these by name in their manifest — keeps bundle
// size sane vs. importing the full lucide-react set.
const ICON_MAP: Record<string, React.ComponentType<{ className?: string }>> = {
Activity, BarChart3, Clock, FileText, KeyRound,
MessageSquare, Package, Settings, Puzzle,
@ -54,12 +43,10 @@ const ICON_MAP: Record<string, React.ComponentType<{ className?: string }>> = {
Wrench, Zap, Heart, Star, Code, Eye,
};
/** Resolve a Lucide icon name to a component, fallback to Puzzle. */
function resolveIcon(name: string): React.ComponentType<{ className?: string }> {
return ICON_MAP[name] ?? Puzzle;
}
/** Insert plugin nav items at the position specified in their manifest. */
function buildNavItems(builtIn: NavItem[], plugins: RegisteredPlugin[]): NavItem[] {
const items = [...builtIn];
@ -89,10 +76,6 @@ function buildNavItems(builtIn: NavItem[], plugins: RegisteredPlugin[]): NavItem
return items;
}
// ---------------------------------------------------------------------------
// App
// ---------------------------------------------------------------------------
export default function App() {
const { t } = useI18n();
const { plugins } = usePlugins();
@ -103,15 +86,26 @@ export default function App() {
);
return (
<div className="flex min-h-screen flex-col bg-background text-foreground overflow-x-hidden">
<div className="noise-overlay" />
<div className="warm-glow" />
<div className="text-midground font-mondwest bg-black min-h-screen flex flex-col uppercase antialiased overflow-x-hidden">
<SelectionSwitcher />
<Backdrop />
<header className="fixed top-0 left-0 right-0 z-40 border-b border-border bg-background/90 backdrop-blur-sm">
<div className="mx-auto flex h-12 max-w-[1400px] items-stretch">
<div className="flex items-center border-r border-border px-3 sm:px-5 shrink-0">
<span className="font-collapse text-lg sm:text-xl font-bold tracking-wider uppercase blend-lighter">
H<span className="hidden sm:inline">ermes </span>A<span className="hidden sm:inline">gent</span>
<header
className={cn(
"fixed top-0 left-0 right-0 z-40",
"border-b border-current/20",
"bg-background-base/90 backdrop-blur-sm",
)}
>
<div className="mx-auto flex h-12 max-w-[1600px] items-stretch">
<div className="flex items-center border-r border-current/20 px-3 sm:px-5 shrink-0">
<span
className="font-sans font-bold text-[1.0625rem] sm:text-[1.125rem] leading-[0.95] tracking-[0.0525rem] text-midground"
style={{ mixBlendMode: "plus-lighter" }}
>
Hermes
<br />
Agent
</span>
</div>
@ -122,22 +116,36 @@ export default function App() {
to={path}
end={path === "/"}
className={({ isActive }) =>
`group relative inline-flex items-center gap-1 sm:gap-1.5 border-r border-border px-2.5 sm:px-4 py-2 font-display text-[0.65rem] sm:text-[0.8rem] tracking-[0.12em] uppercase whitespace-nowrap transition-colors cursor-pointer shrink-0 focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring ${
cn(
"group relative inline-flex items-center gap-1.5 shrink-0",
"border-r border-current/20 px-2.5 sm:px-4 py-2",
"font-mondwest text-[0.65rem] sm:text-[0.8rem] tracking-[0.12em]",
"whitespace-nowrap transition-colors cursor-pointer",
"focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-midground",
isActive
? "text-foreground"
: "text-muted-foreground hover:text-foreground"
}`
? "text-midground"
: "opacity-60 hover:opacity-100",
)
}
>
{({ isActive }) => (
<>
<Icon className="h-4 w-4 sm:h-3.5 sm:w-3.5 shrink-0" />
<Icon className="h-3.5 w-3.5 shrink-0" />
<span className="hidden sm:inline">
{labelKey ? (t.app.nav as Record<string, string>)[labelKey] ?? label : label}
</span>
<span className="absolute inset-0 bg-foreground pointer-events-none transition-opacity duration-150 group-hover:opacity-5 opacity-0" />
<span
aria-hidden
className="absolute inset-1 bg-midground opacity-0 pointer-events-none transition-opacity duration-200 group-hover:opacity-5"
/>
{isActive && (
<span className="absolute bottom-0 left-0 right-0 h-px bg-foreground" />
<span
aria-hidden
className="absolute bottom-0 left-0 right-0 h-px bg-midground"
style={{ mixBlendMode: "plus-lighter" }}
/>
)}
</>
)}
@ -145,17 +153,17 @@ export default function App() {
))}
</nav>
<div className="ml-auto flex items-center gap-2 px-2 sm:px-4">
<div className="ml-auto flex items-center gap-2 border-l border-current/20 px-2 sm:px-4">
<ThemeSwitcher />
<LanguageSwitcher />
<span className="hidden sm:inline font-display text-[0.7rem] tracking-[0.15em] uppercase opacity-50">
<span className="hidden sm:inline font-mondwest text-[0.7rem] tracking-[0.15em] opacity-50">
{t.app.webUi}
</span>
</div>
</div>
</header>
<main className="relative z-2 mx-auto w-full max-w-[1400px] flex-1 px-3 sm:px-6 pt-16 sm:pt-20 pb-4 sm:pb-8">
<main className="relative z-2 mx-auto w-full max-w-[1600px] flex-1 px-3 sm:px-6 pt-16 sm:pt-20 pb-4 sm:pb-8">
<Routes>
<Route path="/" element={<StatusPage />} />
<Route path="/sessions" element={<SessionsPage />} />
@ -166,7 +174,6 @@ export default function App() {
<Route path="/config" element={<ConfigPage />} />
<Route path="/env" element={<EnvPage />} />
{/* Plugin routes */}
{plugins.map(({ manifest, component: PluginComponent }) => (
<Route
key={manifest.name}
@ -179,12 +186,15 @@ export default function App() {
</Routes>
</main>
<footer className="relative z-2 border-t border-border">
<div className="mx-auto flex max-w-[1400px] items-center justify-between px-3 sm:px-6 py-3">
<span className="font-display text-[0.7rem] sm:text-[0.8rem] tracking-[0.12em] uppercase opacity-50">
<footer className="relative z-2 border-t border-current/20">
<div className="mx-auto flex max-w-[1600px] items-center justify-between px-3 sm:px-6 py-3">
<span className="font-mondwest text-[0.7rem] sm:text-[0.8rem] tracking-[0.12em] opacity-60">
{t.app.footer.name}
</span>
<span className="font-display text-[0.6rem] sm:text-[0.7rem] tracking-[0.15em] uppercase text-foreground/40">
<span
className="font-mondwest text-[0.6rem] sm:text-[0.7rem] tracking-[0.15em] text-midground"
style={{ mixBlendMode: "plus-lighter" }}
>
{t.app.footer.org}
</span>
</div>
@ -192,3 +202,10 @@ export default function App() {
</div>
);
}
interface NavItem {
icon: React.ComponentType<{ className?: string }>;
label: string;
labelKey?: string;
path: string;
}