Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions src/components/sections/skills.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ export const SkillsSection = () => {
const { selected } = useFilter();

const areas = selected["areas"];
const skills = selected["skills"];

// ⚡ Optimization: Memoize areaMatchingSkills separately from the query filter.
// This avoids re-calculating the matching skills set when only the search query changes.
Expand All @@ -30,6 +31,8 @@ export const SkillsSection = () => {
return matchingSkills;
}, [areas]);

const selectedSkills = useMemo(() => new Set(skills || []), [skills]);

// ⚡ Optimization: filteredSkills now only depends on debouncedQuery and the memoized areaMatchingSkills.
const filteredSkills = useMemo(() => {
const lowercaseQuery = debouncedQuery.toLowerCase();
Expand All @@ -38,9 +41,10 @@ export const SkillsSection = () => {
const matchesQuery =
!lowercaseQuery || skill.name.toLowerCase().includes(lowercaseQuery);
const matchesArea = areaMatchingSkills.has(key);
return matchesQuery && matchesArea;
const matchesSkill = selectedSkills.size === 0 || selectedSkills.has(key);
return matchesQuery && matchesArea && matchesSkill;
});
}, [debouncedQuery, areaMatchingSkills]);
}, [debouncedQuery, areaMatchingSkills, selectedSkills]);

return (
<Section id="skills" title="Technical Skills">
Expand Down
12 changes: 6 additions & 6 deletions src/components/unified-filter-bar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@ export const UnifiedFilterBar = () => {
<Filter className="rounded-l-none rounded-r-2xl border-l-0 bg-white dark:bg-slate-800 h-[38px] min-w-[48px] hover:bg-slate-50 dark:hover:bg-slate-700 transition-colors border-zinc-200 dark:border-zinc-700">
<Selections
label="Areas"
values={Object.values(areas).map((a) => ({
id: a.name.toLowerCase(),
values={Object.entries(areas).map(([id, a]) => ({
id,
name: a.name,
icon: a.icon,
}))}
Expand All @@ -47,8 +47,8 @@ export const UnifiedFilterBar = () => {
/>
<Selections
label="Skills"
values={Object.values(skills).map((s) => ({
id: s.name.toLowerCase(),
values={Object.entries(skills).map(([id, s]) => ({
id,
name: s.name,
icon: s.icon,
}))}
Expand All @@ -57,8 +57,8 @@ export const UnifiedFilterBar = () => {
/>
<Selections
label="Roles"
values={Object.values(roles).map((r) => ({
id: r.name.toLowerCase(),
values={Object.entries(roles).map(([id, r]) => ({
id,
name: r.name,
}))}
selected={selected["roles"] || []}
Expand Down