Skip to content

Local code intelligence for developers and AI agents. Connect code, docs and infrastructure in a persistent graph, with CBM Lens, MCP tools, agent integrations and change-aware test selection.

feat(graph-ui): scrollable filter panel with clearer grouping

Zadak8ea42911a4ae
diff --git a/graph-ui/src/components/FilterPanel.tsx b/graph-ui/src/components/FilterPanel.tsx
index 25d03c1e6..6f1c7ca0e 100644
--- a/graph-ui/src/components/FilterPanel.tsx
+++ b/graph-ui/src/components/FilterPanel.tsx
@@ -1,4 +1,5 @@
import { useMemo } from "react";
+import { ScrollArea } from "@/components/ui/scroll-area";
import { colorForLabel } from "../lib/colors";
import type { GraphData } from "../lib/types";
@@ -37,9 +38,9 @@ export function FilterPanel({
}, [data]);
return (
- <div className="px-4 py-3 border-b border-border/40 space-y-3">
- {/* Header row */}
- <div className="flex items-center justify-between">
+ <div className="flex flex-col shrink-0 max-h-[45%] border-b border-border/40">
+ {/* Header row — always visible */}
+ <div className="flex items-center justify-between px-4 pt-3 pb-2 shrink-0">
<span className="text-[11px] font-medium text-foreground/50 uppercase tracking-widest">
Filters
</span>
@@ -50,66 +51,77 @@ export function FilterPanel({
</div>
</div>
- {/* Node labels */}
- <div>
- <p className="text-[10px] text-foreground/30 mb-1.5">Nodes</p>
- <div className="flex flex-wrap gap-1">
- {labelCounts.map(([label, count]) => {
- const on = enabledLabels.has(label);
- const c = colorForLabel(label);
- return (
- <button
- key={label}
- onClick={() => onToggleLabel(label)}
- className={`inline-flex items-center gap-1 px-1.5 py-[3px] rounded-md text-[10px] font-medium transition-all border ${
- on ? "border-white/[0.08] bg-white/[0.04]" : "border-transparent opacity-25"
- }`}
- >
- <span className="w-[5px] h-[5px] rounded-full" style={{ backgroundColor: on ? c : "#444" }} />
- <span style={{ color: on ? c : "#555" }}>{label}</span>
- <span className="text-foreground/20 tabular-nums">{count.toLocaleString()}</span>
- </button>
- );
- })}
- </div>
- </div>
+ {/* Scrollable filter groups */}
+ <ScrollArea className="flex-1 min-h-0">
+ <div className="px-4 pb-3 space-y-3">
+ {/* Node types */}
+ {labelCounts.length > 0 && (
+ <div>
+ <p className="text-[10px] font-medium text-foreground/40 mb-1.5 uppercase tracking-wider">Node types</p>
+ <div className="flex flex-wrap gap-1">
+ {labelCounts.map(([label, count]) => {
+ const on = enabledLabels.has(label);
+ const c = colorForLabel(label);
+ return (
+ <button
+ key={label}
+ onClick={() => onToggleLabel(label)}
+ className={`inline-flex items-center gap-1 px-1.5 py-[3px] rounded-md text-[10px] font-medium transition-all border ${
+ on ? "border-white/[0.08] bg-white/[0.04]" : "border-transparent opacity-25"
+ }`}
+ >
+ <span className="w-[5px] h-[5px] rounded-full" style={{ backgroundColor: on ? c : "#444" }} />
+ <span style={{ color: on ? c : "#555" }}>{label}</span>
+ <span className="text-foreground/20 tabular-nums">{count.toLocaleString()}</span>
+ </button>
+ );
+ })}
+ </div>
+ </div>
+ )}
- {/* Edge types */}
- <div>
- <p className="text-[10px] text-foreground/30 mb-1.5">Edges</p>
- <div className="flex flex-wrap gap-1">
- {edgeTypeCounts.map(([type, count]) => {
- const on = enabledEdgeTypes.has(type);
- return (
- <button
- key={type}
- onClick={() => onToggleEdgeType(type)}
- className={`inline-flex items-center gap-1 px-1.5 py-[3px] rounded-md text-[10px] font-medium transition-all border ${
- on ? "border-white/[0.06] bg-white/[0.03] text-foreground/60" : "border-transparent opacity-20 text-foreground/30"
- }`}
- >
- {type.replace(/_/g, " ").toLowerCase()}
- <span className="text-foreground/15 tabular-nums">{count.toLocaleString()}</span>
- </button>
- );
- })}
+ {/* Relationships */}
+ {edgeTypeCounts.length > 0 && (
+ <div>
+ <p className="text-[10px] font-medium text-foreground/40 mb-1.5 uppercase tracking-wider">Relationships</p>
+ <div className="flex flex-wrap gap-1">
+ {edgeTypeCounts.map(([type, count]) => {
+ const on = enabledEdgeTypes.has(type);
+ return (
+ <button
+ key={type}
+ onClick={() => onToggleEdgeType(type)}
+ className={`inline-flex items-center gap-1 px-1.5 py-[3px] rounded-md text-[10px] font-medium transition-all border ${
+ on ? "border-white/[0.06] bg-white/[0.03] text-foreground/60" : "border-transparent opacity-20 text-foreground/30"
+ }`}
+ >
+ {type.replace(/_/g, " ").toLowerCase()}
+ <span className="text-foreground/15 tabular-nums">{count.toLocaleString()}</span>
+ </button>
+ );
+ })}
+ </div>
+ </div>
+ )}
</div>
- </div>
+ </ScrollArea>
- {/* Show labels toggle */}
- <button
- onClick={onToggleShowLabels}
- className={`inline-flex items-center gap-1.5 text-[11px] font-medium transition-all ${
- showLabels ? "text-primary" : "text-foreground/30"
- }`}
- >
- <span className={`w-3.5 h-3.5 rounded border flex items-center justify-center transition-all ${
- showLabels ? "border-primary bg-primary/20" : "border-foreground/15"
- }`}>
- {showLabels && <span className="text-primary text-[9px]">✓</span>}
- </span>
- Show labels
- </button>
+ {/* Display options — pinned footer */}
+ <div className="px-4 py-2.5 border-t border-border/20 shrink-0">
+ <button
+ onClick={onToggleShowLabels}
+ className={`inline-flex items-center gap-1.5 text-[11px] font-medium transition-all ${
+ showLabels ? "text-primary" : "text-foreground/30"
+ }`}
+ >
+ <span className={`w-3.5 h-3.5 rounded border flex items-center justify-center transition-all ${
+ showLabels ? "border-primary bg-primary/20" : "border-foreground/15"
+ }`}>
+ {showLabels && <span className="text-primary text-[9px]">✓</span>}
+ </span>
+ Show labels
+ </button>
+ </div>
</div>
);
}
diff --git a/graph-ui/src/components/Sidebar.tsx b/graph-ui/src/components/Sidebar.tsx
index 73c3f898f..0343940a4 100644
--- a/graph-ui/src/components/Sidebar.tsx
+++ b/graph-ui/src/components/Sidebar.tsx
@@ -120,7 +120,12 @@ export function Sidebar({ nodes, onSelectPath, selectedPath }: SidebarProps) {
return (
<div className="flex flex-col flex-1 min-h-0">
- <div className="px-3 py-2.5 border-b border-border/30">
+ <div className="px-4 pt-3 pb-2 shrink-0">
+ <span className="text-[11px] font-medium text-foreground/50 uppercase tracking-widest">
+ {t.graph.folders}
+ </span>
+ </div>
+ <div className="px-3 pb-2.5 border-b border-border/30 shrink-0">
<div className="relative">
<input
type="text"
diff --git a/graph-ui/src/lib/i18n.ts b/graph-ui/src/lib/i18n.ts
index e98e1de4e..b0a4bfdf3 100644
--- a/graph-ui/src/lib/i18n.ts
+++ b/graph-ui/src/lib/i18n.ts
@@ -23,6 +23,7 @@ export const messages = {
selectedLabel: "Graph",
search: "Search...",
clearSelection: "Clear selection",
+ folders: "Folders",
},
projects: {
indexedProjects: "Indexed Projects",
@@ -95,6 +96,7 @@ export const messages = {
selectedLabel: "图谱",
search: "搜索...",
clearSelection: "清除选择",
+ folders: "目录",
},
projects: {
indexedProjects: "已索引项目",