Skip to content

Commit f838532

Browse files
authored
feat: add search bar to skills view (#1582)
### Problem With many built-in skills plus local repo skills, scrolling through the skills list is painful. There was no way to search/filter. ### Fix Added a search bar at the top of the skills view using the same `TextField.Root` + `MagnifyingGlass` pattern from the archived tasks view (reference: #1509). Filters skills by name and description in real-time. ### Verification - All CI checks pass - Type `review` in the search bar → filters to matching skills Fixes #1526
1 parent 82ded12 commit f838532

1 file changed

Lines changed: 25 additions & 3 deletions

File tree

apps/code/src/renderer/features/skills/components/SkillsView.tsx

Lines changed: 25 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { ResizableSidebar } from "@components/ResizableSidebar";
22
import { useSetHeaderContent } from "@hooks/useSetHeaderContent";
3-
import { Lightbulb } from "@phosphor-icons/react";
4-
import { Box, Flex, ScrollArea, Text } from "@radix-ui/themes";
3+
import { Lightbulb, MagnifyingGlass } from "@phosphor-icons/react";
4+
import { Box, Flex, ScrollArea, Text, TextField } from "@radix-ui/themes";
55
import { useTRPC } from "@renderer/trpc";
66
import type { SkillInfo, SkillSource } from "@shared/types/skills";
77
import { useQuery } from "@tanstack/react-query";
@@ -19,6 +19,7 @@ export function SkillsView() {
1919
);
2020

2121
const [selectedPath, setSelectedPath] = useState<string | null>(null);
22+
const [searchQuery, setSearchQuery] = useState("");
2223

2324
const {
2425
width: sidebarWidth,
@@ -48,14 +49,22 @@ export function SkillsView() {
4849
for (const source of SOURCE_ORDER) {
4950
map.set(source, []);
5051
}
52+
const query = searchQuery.trim().toLowerCase();
5153
for (const skill of skills) {
54+
if (
55+
query &&
56+
!skill.name.toLowerCase().includes(query) &&
57+
!(skill.description?.toLowerCase().includes(query) ?? false)
58+
) {
59+
continue;
60+
}
5261
const list = map.get(skill.source);
5362
if (list) {
5463
list.push(skill);
5564
}
5665
}
5766
return map;
58-
}, [skills]);
67+
}, [skills, searchQuery]);
5968

6069
const headerContent = useMemo(
6170
() => (
@@ -86,6 +95,19 @@ export function SkillsView() {
8695
style={{ height: "100%" }}
8796
>
8897
<Box px="4" py="3">
98+
<Box pb="3">
99+
<TextField.Root
100+
size="2"
101+
placeholder="Search skills..."
102+
value={searchQuery}
103+
onChange={(e) => setSearchQuery(e.target.value)}
104+
className="text-[13px]"
105+
>
106+
<TextField.Slot>
107+
<MagnifyingGlass size={14} />
108+
</TextField.Slot>
109+
</TextField.Root>
110+
</Box>
89111
{skills.length === 0 && !isLoading ? (
90112
<Flex
91113
align="center"

0 commit comments

Comments
 (0)