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.

Merge remote-tracking branch 'origin/main' into distill/789-deadcode-ui

Martin Vogelca261d44c1be
diff --cc graph-ui/src/components/FilterPanel.tsx
index 79f902aad,6f1c7ca0e..214a2b835
--- a/graph-ui/src/components/FilterPanel.tsx
+++ b/graph-ui/src/components/FilterPanel.tsx
@@@ -1,5 -1,6 +1,6 @@@
import { useMemo } from "react";
+ import { ScrollArea } from "@/components/ui/scroll-area";
-import { colorForLabel } from "../lib/colors";
+import { colorForLabel, STATUS_LEGEND } from "../lib/colors";
import type { GraphData } from "../lib/types";
interface FilterPanelProps {
@@@ -91,12 -37,10 +92,12 @@@ export function FilterPanel(
};
}, [data]);
+ const deadCount = statusCounts.get("dead") ?? 0;
+
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>
@@@ -107,113 -51,77 +108,124 @@@
</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>
-
- {/* 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>
+ </ScrollArea>
+ {/* Dead-code view */}
- <div className="pt-2 border-t border-border/30 space-y-2">
++ <div className="px-4 pt-2 border-t border-border/30 space-y-2 shrink-0">
+ <div className="flex items-center justify-between">
+ <span className="text-[10px] text-foreground/30 uppercase tracking-widest">
+ Dead code
+ </span>
+ <span className="text-[10px] text-red-400/80 tabular-nums">
+ {deadCount.toLocaleString()} dead
+ </span>
+ </div>
+
+ <CheckRow
+ checked={deadCodeView}
+ onToggle={onToggleDeadCodeView}
+ label="Color by status"
+ />
+ <CheckRow
+ checked={showOnlyDead}
+ onToggle={onToggleShowOnlyDead}
+ label="Show only dead code"
+ />
+ <CheckRow
+ checked={hideEntryPoints}
+ onToggle={onToggleHideEntryPoints}
+ label="Hide entry points"
+ />
+ <CheckRow checked={hideTests} onToggle={onToggleHideTests} label="Hide tests" />
+
+ {/* Legend (only meaningful while colored by status) */}
+ {deadCodeView && (
+ <div className="flex flex-wrap gap-x-2 gap-y-1 pt-1">
+ {STATUS_LEGEND.map((s) => (
+ <span
+ key={s.status}
+ className="inline-flex items-center gap-1 text-[9px] text-foreground/40"
+ >
+ <span
+ className="w-[6px] h-[6px] rounded-full"
+ style={{ backgroundColor: s.color }}
+ />
+ {s.label}
+ </span>
+ ))}
+ </div>
+ )}
+ </div>
++
+ {/* 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>
);
}