@@ -13,21 +13,21 @@ import Paper from '@material-ui/core/Paper';
1313import styles from '../../../assets/jss/material-dashboard-react/views/dashboardStyle' ;
1414import { getPushes } from '../../../services/git-push' ;
1515import { KeyboardArrowRight } from '@material-ui/icons' ;
16- import Search from '../../../components/Search/Search' ; // Import the Search component
17- import Pagination from '../../../components/Pagination/Pagination' ; // Import Pagination component
16+ import Search from '../../../components/Search/Search' ;
17+ import Pagination from '../../../components/Pagination/Pagination' ;
1818
1919export default function PushesTable ( props ) {
2020 const useStyles = makeStyles ( styles ) ;
2121 const classes = useStyles ( ) ;
2222 const [ data , setData ] = useState ( [ ] ) ;
23- const [ filteredData , setFilteredData ] = useState ( [ ] ) ; // State for filtered data
23+ const [ filteredData , setFilteredData ] = useState ( [ ] ) ;
2424 const [ isLoading , setIsLoading ] = useState ( false ) ;
2525 const [ isError , setIsError ] = useState ( false ) ;
2626 const navigate = useNavigate ( ) ;
2727 const [ , setAuth ] = useState ( true ) ;
28- const [ currentPage , setCurrentPage ] = useState ( 1 ) ; // State for current page
28+ const [ currentPage , setCurrentPage ] = useState ( 1 ) ;
2929 const itemsPerPage = 5 ;
30- const [ searchTerm , setSearchTerm ] = useState ( '' ) ; // Define searchTerm state
30+ const [ searchTerm , setSearchTerm ] = useState ( '' ) ;
3131 const openPush = ( push ) => navigate ( `/admin/push/${ push } ` , { replace : true } ) ;
3232
3333 useEffect ( ( ) => {
@@ -56,27 +56,24 @@ export default function PushesTable(props) {
5656 setCurrentPage ( 1 ) ;
5757 } , [ searchTerm , data ] ) ;
5858
59- // Handler function for search input
6059 const handleSearch = ( term ) => setSearchTerm ( term . trim ( ) ) ;
6160
6261 const handlePageChange = ( page ) => {
63- setCurrentPage ( page ) ; // Update current page
62+ setCurrentPage ( page ) ;
6463 } ;
6564
66- // Logic for pagination (getting items for the current page)
6765 const indexOfLastItem = currentPage * itemsPerPage ;
6866 const indexOfFirstItem = indexOfLastItem - itemsPerPage ;
6967 const currentItems = filteredData . slice ( indexOfFirstItem , indexOfLastItem ) ;
7068
71- // Change page
7269 const paginate = ( pageNumber ) => setCurrentPage ( pageNumber ) ;
7370
7471 if ( isLoading ) return < div > Loading...</ div > ;
7572 if ( isError ) return < div > Something went wrong ...</ div > ;
7673
7774 return (
7875 < div >
79- < Search onSearch = { handleSearch } /> { /* Use the Search component */ }
76+ < Search onSearch = { handleSearch } /> { }
8077 < TableContainer component = { Paper } >
8178 < Table className = { classes . table } aria-label = 'simple table' >
8279 < TableHead >
0 commit comments