import React, { useState } from "react"; import dataImage1 from "../../assets/images/data-table-user-1.png"; import LoadingSpinner from "../Spinners/LoadingSpinner"; import { useNavigate, useLocation, Link } from "react-router-dom"; import { handlePagingFunc } from "../Pagination/HandlePagination"; import PaginatedList from "../Pagination/PaginatedList"; export default function FamilyTable({ className, familyList, loader }) { const filterCategories = ["All Categories", "Explore", "Featured"]; const [selectedCategory, setCategory] = useState(filterCategories[0]); const navigate = useNavigate(); // let location = useLocation(); const [currentPage, setCurrentPage] = useState(0); const indexOfFirstItem = Number(currentPage); const indexOfLastItem = Number(indexOfFirstItem) + Number(process.env.REACT_APP_ITEM_PER_PAGE); const currentFamilyList = familyList?.slice(indexOfFirstItem, indexOfLastItem); const handlePagination = (e) => { handlePagingFunc(e, setCurrentPage); }; return (
{loader ? (
) : ( <> <> {familyList?.length > 0 ? ( currentFamilyList?.map((props, idx) => { let { firstname, lastname, age, added, last_login, task_count, family_uid, } = props; let addedDate = added?.split(" ")[0]; let LoginDate = last_login?.split(" ")[0]; return ( ); }) ) : ( )}
Name Last Login No of Tasks
data

{`${firstname} ${lastname} (${age})`}

Added:{" "} {addedDate}
{LoginDate}
{task_count}
No Family Accounts Found!
)}
{/* PAGINATION BUTTON */} = familyList?.length ? true : false } data={familyList} start={indexOfFirstItem} stop={indexOfLastItem} /> {/* END OF PAGINATION BUTTON */}
); }