From aef6ec8749e327c8c59176395efdd271c4e284ae Mon Sep 17 00:00:00 2001 From: Tom Butcher Date: Tue, 1 Sep 2026 20:14:03 +0100 Subject: [PATCH] Enhance SortSidebarButton with Badge and Sorting State Management - Integrated Badge component to display the count of active sorters in the SortSidebarButton. - Utilized useLocation and useTableState hooks to manage sorting state based on the current route. - Updated TableStateContext to include pageSorters state and setPageSorter function for improved sorting functionality across the dashboard. --- .../Dashboard/common/SortSidebarButton.jsx | 48 ++++++++++++------- .../Dashboard/context/TableStateContext.jsx | 35 ++++++++++++-- 2 files changed, 64 insertions(+), 19 deletions(-) diff --git a/src/components/Dashboard/common/SortSidebarButton.jsx b/src/components/Dashboard/common/SortSidebarButton.jsx index 4d561b58..3de33001 100644 --- a/src/components/Dashboard/common/SortSidebarButton.jsx +++ b/src/components/Dashboard/common/SortSidebarButton.jsx @@ -1,23 +1,39 @@ import PropTypes from 'prop-types' -import { Button } from 'antd' +import { Badge, Button } from 'antd' +import { useLocation } from 'react-router-dom' import SortCircleFilledIcon from '../../Icons/SortCircleFilledIcon' import SortCircleIcon from '../../Icons/SortCircleIcon' +import { useTableState } from '../context/TableStateContext' -const SortSidebarButton = ({ active, onClick, ...buttonProps }) => ( -