From 7d49fb490101b38d72d6cd9d4a5b61d8403f246f Mon Sep 17 00:00:00 2001 From: Kaic Bento Date: Wed, 7 Jan 2026 16:19:50 -0300 Subject: [PATCH] feat(ui): add select all button to category headers --- .../SoftwareSelector/CategorySection.jsx | 60 ++++++++++++++++--- 1 file changed, 51 insertions(+), 9 deletions(-) diff --git a/src/components/SoftwareSelector/CategorySection.jsx b/src/components/SoftwareSelector/CategorySection.jsx index e5ab365..a830696 100644 --- a/src/components/SoftwareSelector/CategorySection.jsx +++ b/src/components/SoftwareSelector/CategorySection.jsx @@ -1,38 +1,80 @@ import { useState } from 'react'; import SoftwareCard from './SoftwareCard'; +import { useSelection } from '../../context/SelectionContext'; const CategorySection = ({ category, software }) => { const [expanded, setExpanded] = useState(true); + const { isAllCategorySelected, selectAllInCategory, deselectAllInCategory } = useSelection(); + + const allSelected = isAllCategorySelected(category.id); + + const handleSelectAll = (e) => { + e.stopPropagation(); + if (allSelected) { + deselectAllInCategory(category.id); + } else { + selectAllInCategory(category.id); + } + }; return (
-
+
+ +