Skip to content

Commit 5424c11

Browse files
committed
feat(explore): AIC-117 — hide stale tools filter in FilterPanel
1 parent 36c0331 commit 5424c11

2 files changed

Lines changed: 33 additions & 1 deletion

File tree

components/graph/ExploreGraph.tsx

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -380,6 +380,7 @@ export default function ExploreGraph({
380380
const [viewMode, setViewMode] = useState<"grid" | "layers" | "3d">("3d");
381381
const [onlyMyTools, setOnlyMyTools] = useState(false);
382382
const [myToolIds, setMyToolIds] = useState<Set<string>>(new Set());
383+
const [hideStale, setHideStale] = useState(false);
383384
const { user } = useUser();
384385

385386
useEffect(() => {
@@ -450,8 +451,9 @@ export default function ExploreGraph({
450451
let result = tools;
451452
if (stackFilteredToolIds) result = result.filter((t) => stackFilteredToolIds.has(t.id));
452453
if (onlyMyTools && myToolIds.size > 0) result = result.filter((t) => myToolIds.has(t.id));
454+
if (hideStale) result = result.filter((t) => !t.is_stale);
453455
return result;
454-
}, [tools, stackFilteredToolIds, onlyMyTools, myToolIds]);
456+
}, [tools, stackFilteredToolIds, onlyMyTools, myToolIds, hideStale]);
455457

456458
const mergedHighlightedIds = useMemo(() => {
457459
if (initialStackIds.size > 0) return new Set([...highlightedIds, ...initialStackIds]);
@@ -503,6 +505,8 @@ export default function ExploreGraph({
503505
onlyMyTools={onlyMyTools}
504506
onToggleMyTools={() => setOnlyMyTools((v) => !v)}
505507
isAuthenticated={!!user}
508+
hideStale={hideStale}
509+
onToggleHideStale={() => setHideStale((v) => !v)}
506510
/>
507511
</div>
508512

@@ -751,6 +755,8 @@ export default function ExploreGraph({
751755
onlyMyTools={onlyMyTools}
752756
onToggleMyTools={() => setOnlyMyTools((v) => !v)}
753757
isAuthenticated={!!user}
758+
hideStale={hideStale}
759+
onToggleHideStale={() => setHideStale((v) => !v)}
754760
/>
755761
<div className="px-4 pb-4 pt-2">
756762
<button

components/panels/FilterPanel.tsx

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,8 @@ interface Props {
6666
onlyMyTools: boolean;
6767
onToggleMyTools: () => void;
6868
isAuthenticated: boolean;
69+
hideStale: boolean;
70+
onToggleHideStale: () => void;
6971
}
7072

7173
const REL_TYPES: { id: RelationshipType; label: string; style: string }[] = [
@@ -111,6 +113,8 @@ export default function FilterPanel({
111113
onlyMyTools,
112114
onToggleMyTools,
113115
isAuthenticated,
116+
hideStale,
117+
onToggleHideStale,
114118
}: Props) {
115119
const { openSuggest } = useSuggestTool();
116120
const allOn = activeCategories.size === CATEGORIES.length;
@@ -214,6 +218,28 @@ export default function FilterPanel({
214218
</button>
215219
)}
216220

221+
{/* Health filter */}
222+
<button
223+
onClick={onToggleHideStale}
224+
className="w-full flex items-center gap-2 px-2.5 py-1.5 rounded-md text-xs transition-colors text-left"
225+
style={
226+
hideStale
227+
? {
228+
background: "#f39c1218",
229+
border: "1px solid #f39c1244",
230+
color: "#f39c12",
231+
}
232+
: {
233+
background: "var(--surface-2)",
234+
border: "1px solid var(--border)",
235+
color: "var(--text-muted)",
236+
}
237+
}
238+
>
239+
<span style={{ fontSize: 10 }}>{hideStale ? "●" : "○"}</span>
240+
Hide stale tools
241+
</button>
242+
217243
{/* Stack Filter */}
218244
<div>
219245
<div className="w-full flex items-center gap-1.5 mb-1.5">

0 commit comments

Comments
 (0)